stream-chat 4.2.0 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,9 +88,9 @@ var decodeBase64 = function decodeBase64(s) {
88
88
 
89
89
  var https = null;
90
90
 
91
- 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; }
91
+ 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; }
92
92
 
93
- 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; }
93
+ 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; }
94
94
 
95
95
  /**
96
96
  * ChannelState - A container class for the channel state.
@@ -158,7 +158,7 @@ var ChannelState = /*#__PURE__*/function () {
158
158
  var m = messages[i];
159
159
 
160
160
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
161
- messages[i] = _objectSpread$4(_objectSpread$4({}, m), {}, {
161
+ messages[i] = _objectSpread$5(_objectSpread$5({}, m), {}, {
162
162
  user: user
163
163
  });
164
164
  }
@@ -211,7 +211,7 @@ var ChannelState = /*#__PURE__*/function () {
211
211
  user: m.user
212
212
  };
213
213
  } else {
214
- messages[i] = _objectSpread$4(_objectSpread$4({}, m), {}, {
214
+ messages[i] = _objectSpread$5(_objectSpread$5({}, m), {}, {
215
215
  type: 'deleted',
216
216
  deleted_at: user.deleted_at
217
217
  });
@@ -279,7 +279,7 @@ var ChannelState = /*#__PURE__*/function () {
279
279
  }, {
280
280
  key: "formatMessage",
281
281
  value: function formatMessage(message) {
282
- return _objectSpread$4(_objectSpread$4({}, message), {}, {
282
+ return _objectSpread$5(_objectSpread$5({}, message), {}, {
283
283
  /**
284
284
  * @deprecated please use `html`
285
285
  */
@@ -469,7 +469,7 @@ var ChannelState = /*#__PURE__*/function () {
469
469
  var parseMessage = function parseMessage(m) {
470
470
  var _m$pinned_at, _m$updated_at;
471
471
 
472
- return _objectSpread$4(_objectSpread$4({}, m), {}, {
472
+ return _objectSpread$5(_objectSpread$5({}, m), {}, {
473
473
  created_at: m.created_at.toString(),
474
474
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toString(),
475
475
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toString()
@@ -479,8 +479,8 @@ var ChannelState = /*#__PURE__*/function () {
479
479
  var updatedMessages = this.messages.filter(function (msg) {
480
480
  return msg.quoted_message_id === message.id;
481
481
  }).map(parseMessage).map(function (msg) {
482
- return _objectSpread$4(_objectSpread$4({}, msg), {}, {
483
- quoted_message: _objectSpread$4(_objectSpread$4({}, message), {}, {
482
+ return _objectSpread$5(_objectSpread$5({}, msg), {}, {
483
+ quoted_message: _objectSpread$5(_objectSpread$5({}, message), {}, {
484
484
  attachments: []
485
485
  })
486
486
  });
@@ -700,9 +700,9 @@ var ChannelState = /*#__PURE__*/function () {
700
700
  return ChannelState;
701
701
  }();
702
702
 
703
- 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; }
703
+ 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; }
704
704
 
705
- 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; }
705
+ 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; }
706
706
 
707
707
  var EVENT_MAP = {
708
708
  'channel.created': true,
@@ -749,7 +749,7 @@ var EVENT_MAP = {
749
749
  'connection.recovered': true
750
750
  };
751
751
 
752
- var IS_VALID_EVENT_MAP_TYPE = _objectSpread$3(_objectSpread$3({}, EVENT_MAP), {}, {
752
+ var IS_VALID_EVENT_MAP_TYPE = _objectSpread$4(_objectSpread$4({}, EVENT_MAP), {}, {
753
753
  all: true
754
754
  });
755
755
 
@@ -882,17 +882,52 @@ function retryInterval(numberOfFailures) {
882
882
  var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
883
883
  return Math.floor(Math.random() * (max - min) + min);
884
884
  }
885
- /** adopted from https://github.com/ai/nanoid/blob/master/non-secure/index.js */
886
-
887
- var alphabet = 'ModuleSymbhasOwnPr0123456789ABCDEFGHNRVfgctiUvzKqYTJkLxpZXIjQW';
888
885
  function randomId() {
889
- var id = '';
886
+ return generateUUIDv4();
887
+ }
888
+
889
+ function hex(bytes) {
890
+ var s = '';
891
+
892
+ for (var i = 0; i < bytes.length; i++) {
893
+ s += bytes[i].toString(16).padStart(2, '0');
894
+ }
895
+
896
+ return s;
897
+ } // https://tools.ietf.org/html/rfc4122
898
+
899
+
900
+ function generateUUIDv4() {
901
+ var bytes = getRandomBytes(16);
902
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
903
+
904
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
905
+
906
+ 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));
907
+ }
908
+
909
+ function getRandomValuesWithMathRandom(bytes) {
910
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
911
+
912
+ for (var i = 0; i < bytes.length; i++) {
913
+ bytes[i] = Math.random() * max;
914
+ }
915
+ }
890
916
 
891
- for (var i = 0; i < 21; i++) {
892
- id += alphabet[Math.random() * 64 | 0];
917
+ var getRandomValues = function () {
918
+ if (typeof crypto !== 'undefined') {
919
+ return crypto.getRandomValues.bind(crypto);
920
+ } else if (typeof msCrypto !== 'undefined') {
921
+ return msCrypto.getRandomValues.bind(msCrypto);
922
+ } else {
923
+ return getRandomValuesWithMathRandom;
893
924
  }
925
+ }();
894
926
 
895
- return id;
927
+ function getRandomBytes(length) {
928
+ var bytes = new Uint8Array(length);
929
+ getRandomValues(bytes);
930
+ return bytes;
896
931
  }
897
932
 
898
933
  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; } } }; }
@@ -901,9 +936,9 @@ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o
901
936
 
902
937
  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; }
903
938
 
904
- 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; }
939
+ 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; }
905
940
 
906
- 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; }
941
+ 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; }
907
942
 
908
943
  /**
909
944
  * Channel - The Channel class manages it's own state.
@@ -1023,7 +1058,7 @@ var Channel = /*#__PURE__*/function () {
1023
1058
 
1024
1059
  this.data = data; // this._data is used for the requests...
1025
1060
 
1026
- this._data = _objectSpread$2({}, data);
1061
+ this._data = _objectSpread$3({}, data);
1027
1062
  this.cid = "".concat(type, ":").concat(id);
1028
1063
  this.listeners = {}; // perhaps the state variable should be private
1029
1064
 
@@ -1065,7 +1100,8 @@ var Channel = /*#__PURE__*/function () {
1065
1100
  * sendMessage - Send a message to this channel
1066
1101
  *
1067
1102
  * @param {Message<AttachmentType, MessageType, UserType>} message The Message object
1068
- * @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications
1103
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1104
+ * @param {boolean} [options.skip_push] Skip sending push notifications
1069
1105
  *
1070
1106
  * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1071
1107
  */
@@ -1080,7 +1116,7 @@ var Channel = /*#__PURE__*/function () {
1080
1116
  switch (_context2.prev = _context2.next) {
1081
1117
  case 0:
1082
1118
  _context2.next = 2;
1083
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$2({
1119
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$3({
1084
1120
  message: message
1085
1121
  }, options));
1086
1122
 
@@ -1199,7 +1235,7 @@ var Channel = /*#__PURE__*/function () {
1199
1235
 
1200
1236
  case 3:
1201
1237
  // Return a list of channels
1202
- payload = _objectSpread$2(_objectSpread$2({
1238
+ payload = _objectSpread$3(_objectSpread$3({
1203
1239
  filter_conditions: {
1204
1240
  cid: this.cid
1205
1241
  }
@@ -1260,8 +1296,8 @@ var Channel = /*#__PURE__*/function () {
1260
1296
  * queryMembers - Query Members
1261
1297
  *
1262
1298
  * @param {UserFilters<UserType>} filterConditions object MongoDB style filters
1263
- * @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1264
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
1299
+ * @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1300
+ * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
1265
1301
  * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
1266
1302
  *
1267
1303
  * @return {Promise<ChannelMemberAPIResponse<UserType>>} Query Members response
@@ -1296,7 +1332,7 @@ var Channel = /*#__PURE__*/function () {
1296
1332
 
1297
1333
  _context5.next = 6;
1298
1334
  return this.getClient().get(this.getClient().baseURL + '/members', {
1299
- payload: _objectSpread$2({
1335
+ payload: _objectSpread$3({
1300
1336
  type: type,
1301
1337
  id: id,
1302
1338
  members: members,
@@ -1357,7 +1393,7 @@ var Channel = /*#__PURE__*/function () {
1357
1393
 
1358
1394
  case 4:
1359
1395
  _context6.next = 6;
1360
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$2({
1396
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$3({
1361
1397
  reaction: reaction
1362
1398
  }, options));
1363
1399
 
@@ -1438,7 +1474,7 @@ var Channel = /*#__PURE__*/function () {
1438
1474
  delete channelData[key];
1439
1475
  });
1440
1476
  _context7.next = 7;
1441
- return this._update(_objectSpread$2({
1477
+ return this._update(_objectSpread$3({
1442
1478
  message: updateMessage,
1443
1479
  data: channelData
1444
1480
  }, options));
@@ -1663,7 +1699,7 @@ var Channel = /*#__PURE__*/function () {
1663
1699
  case 0:
1664
1700
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
1665
1701
  _context13.next = 3;
1666
- return this._update(_objectSpread$2({
1702
+ return this._update(_objectSpread$3({
1667
1703
  accept_invite: true
1668
1704
  }, options));
1669
1705
 
@@ -1704,7 +1740,7 @@ var Channel = /*#__PURE__*/function () {
1704
1740
  case 0:
1705
1741
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
1706
1742
  _context14.next = 3;
1707
- return this._update(_objectSpread$2({
1743
+ return this._update(_objectSpread$3({
1708
1744
  reject_invite: true
1709
1745
  }, options));
1710
1746
 
@@ -2022,7 +2058,7 @@ var Channel = /*#__PURE__*/function () {
2022
2058
  case 0:
2023
2059
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2024
2060
  _context22.next = 3;
2025
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$2({
2061
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$3({
2026
2062
  channel_cid: this.cid
2027
2063
  }, opts));
2028
2064
 
@@ -2064,7 +2100,7 @@ var Channel = /*#__PURE__*/function () {
2064
2100
  case 0:
2065
2101
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2066
2102
  _context23.next = 3;
2067
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$2({
2103
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$3({
2068
2104
  channel_cid: this.cid
2069
2105
  }, opts));
2070
2106
 
@@ -2273,7 +2309,7 @@ var Channel = /*#__PURE__*/function () {
2273
2309
 
2274
2310
  case 4:
2275
2311
  _context26.next = 6;
2276
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$2({}, data));
2312
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$3({}, data));
2277
2313
 
2278
2314
  case 6:
2279
2315
  return _context26.abrupt("return", _context26.sent);
@@ -2341,7 +2377,7 @@ var Channel = /*#__PURE__*/function () {
2341
2377
  defaultOptions.watch = false;
2342
2378
  }
2343
2379
 
2344
- combined = _objectSpread$2(_objectSpread$2({}, defaultOptions), options);
2380
+ combined = _objectSpread$3(_objectSpread$3({}, defaultOptions), options);
2345
2381
  _context27.next = 7;
2346
2382
  return this.query(combined);
2347
2383
 
@@ -2432,7 +2468,7 @@ var Channel = /*#__PURE__*/function () {
2432
2468
  switch (_context29.prev = _context29.next) {
2433
2469
  case 0:
2434
2470
  _context29.next = 2;
2435
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$2({}, options));
2471
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$3({}, options));
2436
2472
 
2437
2473
  case 2:
2438
2474
  data = _context29.sent;
@@ -2470,7 +2506,7 @@ var Channel = /*#__PURE__*/function () {
2470
2506
  }, {
2471
2507
  key: "getReactions",
2472
2508
  value: function getReactions(message_id, options) {
2473
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$2({}, options));
2509
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$3({}, options));
2474
2510
  }
2475
2511
  /**
2476
2512
  * getMessagesById - Retrieves a list of messages by ID
@@ -2513,6 +2549,7 @@ var Channel = /*#__PURE__*/function () {
2513
2549
  if (message.silent) return false;
2514
2550
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2515
2551
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2552
+ if (message.type === 'system') return false;
2516
2553
  if (this.muteStatus().muted) return false;
2517
2554
  return true;
2518
2555
  }
@@ -2601,7 +2638,7 @@ var Channel = /*#__PURE__*/function () {
2601
2638
  }
2602
2639
 
2603
2640
  _context30.next = 6;
2604
- return this.getClient().post(queryURL + '/query', _objectSpread$2({
2641
+ return this.getClient().post(queryURL + '/query', _objectSpread$3({
2605
2642
  data: this._data,
2606
2643
  state: true
2607
2644
  }, options));
@@ -2672,7 +2709,7 @@ var Channel = /*#__PURE__*/function () {
2672
2709
  this._checkInitialized();
2673
2710
 
2674
2711
  _context31.next = 3;
2675
- return this.getClient().banUser(targetUserID, _objectSpread$2(_objectSpread$2({}, options), {}, {
2712
+ return this.getClient().banUser(targetUserID, _objectSpread$3(_objectSpread$3({}, options), {}, {
2676
2713
  type: this.type,
2677
2714
  id: this.id
2678
2715
  }));
@@ -2844,7 +2881,7 @@ var Channel = /*#__PURE__*/function () {
2844
2881
  this._checkInitialized();
2845
2882
 
2846
2883
  _context35.next = 3;
2847
- return this.getClient().shadowBan(targetUserID, _objectSpread$2(_objectSpread$2({}, options), {}, {
2884
+ return this.getClient().shadowBan(targetUserID, _objectSpread$3(_objectSpread$3({}, options), {}, {
2848
2885
  type: this.type,
2849
2886
  id: this.id
2850
2887
  }));
@@ -3257,7 +3294,7 @@ var Channel = /*#__PURE__*/function () {
3257
3294
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3258
3295
  var read = _step3.value;
3259
3296
 
3260
- var parsedRead = _objectSpread$2(_objectSpread$2({}, read), {}, {
3297
+ var parsedRead = _objectSpread$3(_objectSpread$3({}, read), {}, {
3261
3298
  last_read: new Date(read.last_read)
3262
3299
  });
3263
3300
 
@@ -3384,6 +3421,61 @@ var ClientState = /*#__PURE__*/function () {
3384
3421
  return ClientState;
3385
3422
  }();
3386
3423
 
3424
+ 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; }
3425
+
3426
+ 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; }
3427
+
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
+ this.connectionStartTimestamp = null;
3438
+ this.wsTotalFailures = 0;
3439
+ this.wsConsecutiveFailures = 0;
3440
+ };
3441
+ function buildWsFatalInsight(connection, event) {
3442
+ return _objectSpread$2({
3443
+ err: {
3444
+ wasClean: event.wasClean,
3445
+ code: event.code,
3446
+ reason: event.reason
3447
+ }
3448
+ }, buildWsBaseInsight(connection));
3449
+ }
3450
+
3451
+ function buildWsBaseInsight(connection) {
3452
+ var _connection$ws, _navigator, _navigator2;
3453
+
3454
+ return {
3455
+ ready_state: (_connection$ws = connection.ws) === null || _connection$ws === void 0 ? void 0 : _connection$ws.readyState,
3456
+ url: connection._buildUrl(connection.requestID),
3457
+ api_key: connection.apiKey,
3458
+ start_ts: connection.insightMetrics.connectionStartTimestamp,
3459
+ end_ts: new Date().getTime(),
3460
+ auth_type: connection.authType,
3461
+ token: connection.tokenManager.token,
3462
+ user_id: connection.userID,
3463
+ user_details: connection.user,
3464
+ device: connection.device,
3465
+ client_id: connection.connectionID,
3466
+ ws_details: connection.ws,
3467
+ ws_consecutive_failures: connection.insightMetrics.wsConsecutiveFailures,
3468
+ ws_total_failures: connection.insightMetrics.wsTotalFailures,
3469
+ request_id: connection.requestID,
3470
+ online: typeof navigator !== 'undefined' ? (_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.onLine : null,
3471
+ user_agent: typeof navigator !== 'undefined' ? (_navigator2 = navigator) === null || _navigator2 === void 0 ? void 0 : _navigator2.userAgent : null
3472
+ };
3473
+ }
3474
+
3475
+ function buildWsSuccessAfterFailureInsight(connection) {
3476
+ return buildWsBaseInsight(connection);
3477
+ }
3478
+
3387
3479
  // Type guards to check WebSocket error type
3388
3480
  var isCloseEvent = function isCloseEvent(res) {
3389
3481
  return res.code !== undefined;
@@ -3426,7 +3518,9 @@ var StableWSConnection = /*#__PURE__*/function () {
3426
3518
  userAgent = _ref.userAgent,
3427
3519
  userID = _ref.userID,
3428
3520
  wsBaseURL = _ref.wsBaseURL,
3429
- device = _ref.device;
3521
+ device = _ref.device,
3522
+ postInsights = _ref.postInsights,
3523
+ insightMetrics = _ref.insightMetrics;
3430
3524
 
3431
3525
  _classCallCheck(this, StableWSConnection);
3432
3526
 
@@ -3480,6 +3574,10 @@ var StableWSConnection = /*#__PURE__*/function () {
3480
3574
 
3481
3575
  _defineProperty(this, "rejectPromise", void 0);
3482
3576
 
3577
+ _defineProperty(this, "requestID", void 0);
3578
+
3579
+ _defineProperty(this, "connectionStartTimestamp", void 0);
3580
+
3483
3581
  _defineProperty(this, "resolvePromise", void 0);
3484
3582
 
3485
3583
  _defineProperty(this, "totalFailures", void 0);
@@ -3488,13 +3586,18 @@ var StableWSConnection = /*#__PURE__*/function () {
3488
3586
 
3489
3587
  _defineProperty(this, "wsID", void 0);
3490
3588
 
3491
- _defineProperty(this, "_buildUrl", function () {
3589
+ _defineProperty(this, "postInsights", void 0);
3590
+
3591
+ _defineProperty(this, "insightMetrics", void 0);
3592
+
3593
+ _defineProperty(this, "_buildUrl", function (reqID) {
3492
3594
  var params = {
3493
3595
  user_id: _this.user.id,
3494
3596
  user_details: _this.user,
3495
3597
  user_token: _this.tokenManager.getToken(),
3496
3598
  server_determines_connection_id: true,
3497
- device: _this.device
3599
+ device: _this.device,
3600
+ request_id: reqID
3498
3601
  };
3499
3602
  var qs = encodeURIComponent(JSON.stringify(params));
3500
3603
 
@@ -3579,6 +3682,14 @@ var StableWSConnection = /*#__PURE__*/function () {
3579
3682
  });
3580
3683
 
3581
3684
  _defineProperty(this, "onclose", function (wsID, event) {
3685
+ if (event.code !== chatCodes.WS_CLOSED_SUCCESS) {
3686
+ var _this$postInsights;
3687
+
3688
+ _this.insightMetrics.wsConsecutiveFailures++;
3689
+ _this.insightMetrics.wsTotalFailures++;
3690
+ (_this$postInsights = _this.postInsights) === null || _this$postInsights === void 0 ? void 0 : _this$postInsights.call(_this, 'ws_fatal', buildWsFatalInsight(_this, event));
3691
+ }
3692
+
3582
3693
  _this.logger('info', 'connection:onclose() - onclose callback - ' + event.code, {
3583
3694
  tags: ['connection'],
3584
3695
  event: event,
@@ -3703,14 +3814,22 @@ var StableWSConnection = /*#__PURE__*/function () {
3703
3814
  });
3704
3815
 
3705
3816
  _defineProperty(this, "_listenForConnectionChanges", function () {
3706
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3817
+ var _window;
3818
+
3819
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3820
+ // and thus (window === undefined) will result in ReferenceError.
3821
+ if (typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.addEventListener) {
3707
3822
  window.addEventListener('offline', _this.onlineStatusChanged);
3708
3823
  window.addEventListener('online', _this.onlineStatusChanged);
3709
3824
  }
3710
3825
  });
3711
3826
 
3712
3827
  _defineProperty(this, "_removeConnectionListeners", function () {
3713
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3828
+ var _window2;
3829
+
3830
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3831
+ // and thus (window === undefined) will result in ReferenceError.
3832
+ if (typeof window !== 'undefined' && (_window2 = window) !== null && _window2 !== void 0 && _window2.removeEventListener) {
3714
3833
  window.removeEventListener('offline', _this.onlineStatusChanged);
3715
3834
  window.removeEventListener('online', _this.onlineStatusChanged);
3716
3835
  }
@@ -3751,8 +3870,7 @@ var StableWSConnection = /*#__PURE__*/function () {
3751
3870
  // send the healthcheck.., server replies with a health check event
3752
3871
  var data = [{
3753
3872
  type: 'health.check',
3754
- client_id: _this.clientID,
3755
- user_id: _this.userID
3873
+ client_id: _this.clientID
3756
3874
  }]; // try to send on the connection
3757
3875
 
3758
3876
  try {
@@ -3826,6 +3944,9 @@ var StableWSConnection = /*#__PURE__*/function () {
3826
3944
  this.connectionCheckTimeout = this.pingInterval + 10 * 1000;
3827
3945
 
3828
3946
  this._listenForConnectionChanges();
3947
+
3948
+ this.postInsights = postInsights;
3949
+ this.insightMetrics = insightMetrics;
3829
3950
  }
3830
3951
  /**
3831
3952
  * connect - Connect to the WS URL
@@ -4031,6 +4152,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4031
4152
 
4032
4153
  return _waitForHealthy;
4033
4154
  }()
4155
+ /**
4156
+ * Builds and returns the url for websocket.
4157
+ * @param reqID Unique identifier generated on client side, to help tracking apis on backend.
4158
+ * @returns url string
4159
+ */
4160
+
4034
4161
  }, {
4035
4162
  key: "disconnect",
4036
4163
  value:
@@ -4108,7 +4235,8 @@ var StableWSConnection = /*#__PURE__*/function () {
4108
4235
  key: "_connect",
4109
4236
  value: function () {
4110
4237
  var _connect3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
4111
- var wsURL, response;
4238
+ var wsURL, response, _this$postInsights2;
4239
+
4112
4240
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
4113
4241
  while (1) {
4114
4242
  switch (_context5.prev = _context5.next) {
@@ -4123,50 +4251,58 @@ var StableWSConnection = /*#__PURE__*/function () {
4123
4251
  case 2:
4124
4252
  // simply ignore _connect if it's currently trying to connect
4125
4253
  this.isConnecting = true;
4126
- _context5.prev = 3;
4127
- _context5.next = 6;
4254
+ this.requestID = randomId();
4255
+ this.insightMetrics.connectionStartTimestamp = new Date().getTime();
4256
+ _context5.prev = 5;
4257
+ _context5.next = 8;
4128
4258
  return this.tokenManager.tokenReady();
4129
4259
 
4130
- case 6:
4260
+ case 8:
4131
4261
  this._setupConnectionPromise();
4132
4262
 
4133
- wsURL = this._buildUrl();
4263
+ wsURL = this._buildUrl(this.requestID);
4134
4264
  this.ws = new WebSocket(wsURL);
4135
4265
  this.ws.onopen = this.onopen.bind(this, this.wsID);
4136
4266
  this.ws.onclose = this.onclose.bind(this, this.wsID);
4137
4267
  this.ws.onerror = this.onerror.bind(this, this.wsID);
4138
4268
  this.ws.onmessage = this.onmessage.bind(this, this.wsID);
4139
- _context5.next = 15;
4269
+ _context5.next = 17;
4140
4270
  return this.connectionOpen;
4141
4271
 
4142
- case 15:
4272
+ case 17:
4143
4273
  response = _context5.sent;
4144
4274
  this.isConnecting = false;
4145
4275
 
4146
4276
  if (!response) {
4147
- _context5.next = 20;
4277
+ _context5.next = 23;
4148
4278
  break;
4149
4279
  }
4150
4280
 
4151
4281
  this.connectionID = response.connection_id;
4282
+
4283
+ if (this.insightMetrics.wsConsecutiveFailures > 0) {
4284
+ (_this$postInsights2 = this.postInsights) === null || _this$postInsights2 === void 0 ? void 0 : _this$postInsights2.call(this, 'ws_success_after_failure', buildWsSuccessAfterFailureInsight(this));
4285
+ this.insightMetrics.wsConsecutiveFailures = 0;
4286
+ }
4287
+
4152
4288
  return _context5.abrupt("return", response);
4153
4289
 
4154
- case 20:
4155
- _context5.next = 26;
4290
+ case 23:
4291
+ _context5.next = 29;
4156
4292
  break;
4157
4293
 
4158
- case 22:
4159
- _context5.prev = 22;
4160
- _context5.t0 = _context5["catch"](3);
4294
+ case 25:
4295
+ _context5.prev = 25;
4296
+ _context5.t0 = _context5["catch"](5);
4161
4297
  this.isConnecting = false;
4162
4298
  throw _context5.t0;
4163
4299
 
4164
- case 26:
4300
+ case 29:
4165
4301
  case "end":
4166
4302
  return _context5.stop();
4167
4303
  }
4168
4304
  }
4169
- }, _callee5, this, [[3, 22]]);
4305
+ }, _callee5, this, [[5, 25]]);
4170
4306
  }));
4171
4307
 
4172
4308
  function _connect() {
@@ -4369,7 +4505,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4369
4505
 
4370
4506
  var jwt = null;
4371
4507
 
4372
- var crypto = null;
4508
+ var crypto$1 = null;
4373
4509
 
4374
4510
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4375
4511
 
@@ -4456,7 +4592,7 @@ function DevToken(userId) {
4456
4592
 
4457
4593
  function CheckSignature(body, secret, signature) {
4458
4594
  var key = Buffer.from(secret, 'ascii');
4459
- var hash = crypto.createHmac('sha256', key).update(body).digest('hex');
4595
+ var hash = crypto$1.createHmac('sha256', key).update(body).digest('hex');
4460
4596
  return hash === signature;
4461
4597
  }
4462
4598
 
@@ -4726,6 +4862,8 @@ var StreamChat = /*#__PURE__*/function () {
4726
4862
 
4727
4863
  _defineProperty(this, "consecutiveFailures", void 0);
4728
4864
 
4865
+ _defineProperty(this, "insightMetrics", void 0);
4866
+
4729
4867
  _defineProperty(this, "_hasConnectionID", function () {
4730
4868
  var _this$wsConnection;
4731
4869
 
@@ -5372,10 +5510,73 @@ var StreamChat = /*#__PURE__*/function () {
5372
5510
 
5373
5511
  _defineProperty(this, "updateUser", this.upsertUser);
5374
5512
 
5513
+ _defineProperty(this, "markAllRead", this.markChannelsRead);
5514
+
5375
5515
  _defineProperty(this, "_isUsingServerAuth", function () {
5376
5516
  return !!_this.secret;
5377
5517
  });
5378
5518
 
5519
+ _defineProperty(this, "postInsights", /*#__PURE__*/function () {
5520
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(insightType, insights) {
5521
+ var maxAttempts, i;
5522
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
5523
+ while (1) {
5524
+ switch (_context6.prev = _context6.next) {
5525
+ case 0:
5526
+ maxAttempts = 3;
5527
+ i = 0;
5528
+
5529
+ case 2:
5530
+ if (!(i < maxAttempts)) {
5531
+ _context6.next = 18;
5532
+ break;
5533
+ }
5534
+
5535
+ _context6.prev = 3;
5536
+ _context6.next = 6;
5537
+ return _this.axiosInstance.post("https://insights.stream-io-api.com/insights/".concat(insightType), insights);
5538
+
5539
+ case 6:
5540
+ _context6.next = 14;
5541
+ break;
5542
+
5543
+ case 8:
5544
+ _context6.prev = 8;
5545
+ _context6.t0 = _context6["catch"](3);
5546
+
5547
+ _this.logger('warn', "failed to send insights event ".concat(insightType), {
5548
+ tags: ['insights', 'connection'],
5549
+ error: _context6.t0,
5550
+ insights: insights
5551
+ });
5552
+
5553
+ _context6.next = 13;
5554
+ return sleep((i + 1) * 3000);
5555
+
5556
+ case 13:
5557
+ return _context6.abrupt("continue", 15);
5558
+
5559
+ case 14:
5560
+ return _context6.abrupt("break", 18);
5561
+
5562
+ case 15:
5563
+ i++;
5564
+ _context6.next = 2;
5565
+ break;
5566
+
5567
+ case 18:
5568
+ case "end":
5569
+ return _context6.stop();
5570
+ }
5571
+ }
5572
+ }, _callee6, null, [[3, 8]]);
5573
+ }));
5574
+
5575
+ return function (_x7, _x8) {
5576
+ return _ref6.apply(this, arguments);
5577
+ };
5578
+ }());
5579
+
5379
5580
  // set the key
5380
5581
  this.key = _key;
5381
5582
  this.listeners = {};
@@ -5431,6 +5632,7 @@ var StreamChat = /*#__PURE__*/function () {
5431
5632
 
5432
5633
  this.tokenManager = new TokenManager(this.secret);
5433
5634
  this.consecutiveFailures = 0;
5635
+ this.insightMetrics = new InsightMetrics();
5434
5636
  /**
5435
5637
  * logger function should accept 3 parameters:
5436
5638
  * @param logLevel string
@@ -5579,32 +5781,32 @@ var StreamChat = /*#__PURE__*/function () {
5579
5781
  }
5580
5782
  */
5581
5783
  function () {
5582
- var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(options) {
5784
+ var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(options) {
5583
5785
  var _options$apn_config;
5584
5786
 
5585
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
5787
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
5586
5788
  while (1) {
5587
- switch (_context6.prev = _context6.next) {
5789
+ switch (_context7.prev = _context7.next) {
5588
5790
  case 0:
5589
5791
  if ((_options$apn_config = options.apn_config) !== null && _options$apn_config !== void 0 && _options$apn_config.p12_cert) {
5590
5792
  options.apn_config.p12_cert = Buffer.from(options.apn_config.p12_cert).toString('base64');
5591
5793
  }
5592
5794
 
5593
- _context6.next = 3;
5795
+ _context7.next = 3;
5594
5796
  return this.patch(this.baseURL + '/app', options);
5595
5797
 
5596
5798
  case 3:
5597
- return _context6.abrupt("return", _context6.sent);
5799
+ return _context7.abrupt("return", _context7.sent);
5598
5800
 
5599
5801
  case 4:
5600
5802
  case "end":
5601
- return _context6.stop();
5803
+ return _context7.stop();
5602
5804
  }
5603
5805
  }
5604
- }, _callee6, this);
5806
+ }, _callee7, this);
5605
5807
  }));
5606
5808
 
5607
- function updateAppSettings(_x7) {
5809
+ function updateAppSettings(_x9) {
5608
5810
  return _updateAppSettings.apply(this, arguments);
5609
5811
  }
5610
5812
 
@@ -5617,28 +5819,28 @@ var StreamChat = /*#__PURE__*/function () {
5617
5819
  * Revokes all tokens on application level issued before given time
5618
5820
  */
5619
5821
  function () {
5620
- var _revokeTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(before) {
5621
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
5822
+ var _revokeTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(before) {
5823
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
5622
5824
  while (1) {
5623
- switch (_context7.prev = _context7.next) {
5825
+ switch (_context8.prev = _context8.next) {
5624
5826
  case 0:
5625
- _context7.next = 2;
5827
+ _context8.next = 2;
5626
5828
  return this.updateAppSettings({
5627
5829
  revoke_tokens_issued_before: this._normalizeDate(before)
5628
5830
  });
5629
5831
 
5630
5832
  case 2:
5631
- return _context7.abrupt("return", _context7.sent);
5833
+ return _context8.abrupt("return", _context8.sent);
5632
5834
 
5633
5835
  case 3:
5634
5836
  case "end":
5635
- return _context7.stop();
5837
+ return _context8.stop();
5636
5838
  }
5637
5839
  }
5638
- }, _callee7, this);
5840
+ }, _callee8, this);
5639
5841
  }));
5640
5842
 
5641
- function revokeTokens(_x8) {
5843
+ function revokeTokens(_x10) {
5642
5844
  return _revokeTokens.apply(this, arguments);
5643
5845
  }
5644
5846
 
@@ -5651,26 +5853,26 @@ var StreamChat = /*#__PURE__*/function () {
5651
5853
  }, {
5652
5854
  key: "revokeUserToken",
5653
5855
  value: function () {
5654
- var _revokeUserToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(userID, before) {
5655
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
5856
+ var _revokeUserToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(userID, before) {
5857
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
5656
5858
  while (1) {
5657
- switch (_context8.prev = _context8.next) {
5859
+ switch (_context9.prev = _context9.next) {
5658
5860
  case 0:
5659
- _context8.next = 2;
5861
+ _context9.next = 2;
5660
5862
  return this.revokeUsersToken([userID], before);
5661
5863
 
5662
5864
  case 2:
5663
- return _context8.abrupt("return", _context8.sent);
5865
+ return _context9.abrupt("return", _context9.sent);
5664
5866
 
5665
5867
  case 3:
5666
5868
  case "end":
5667
- return _context8.stop();
5869
+ return _context9.stop();
5668
5870
  }
5669
5871
  }
5670
- }, _callee8, this);
5872
+ }, _callee9, this);
5671
5873
  }));
5672
5874
 
5673
- function revokeUserToken(_x9, _x10) {
5875
+ function revokeUserToken(_x11, _x12) {
5674
5876
  return _revokeUserToken.apply(this, arguments);
5675
5877
  }
5676
5878
 
@@ -5683,12 +5885,12 @@ var StreamChat = /*#__PURE__*/function () {
5683
5885
  }, {
5684
5886
  key: "revokeUsersToken",
5685
5887
  value: function () {
5686
- var _revokeUsersToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(userIDs, before) {
5888
+ var _revokeUsersToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(userIDs, before) {
5687
5889
  var users, _iterator, _step, userID;
5688
5890
 
5689
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
5891
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
5690
5892
  while (1) {
5691
- switch (_context9.prev = _context9.next) {
5893
+ switch (_context10.prev = _context10.next) {
5692
5894
  case 0:
5693
5895
  if (before === undefined) {
5694
5896
  before = new Date().toISOString();
@@ -5715,21 +5917,21 @@ var StreamChat = /*#__PURE__*/function () {
5715
5917
  _iterator.f();
5716
5918
  }
5717
5919
 
5718
- _context9.next = 6;
5920
+ _context10.next = 6;
5719
5921
  return this.partialUpdateUsers(users);
5720
5922
 
5721
5923
  case 6:
5722
- return _context9.abrupt("return", _context9.sent);
5924
+ return _context10.abrupt("return", _context10.sent);
5723
5925
 
5724
5926
  case 7:
5725
5927
  case "end":
5726
- return _context9.stop();
5928
+ return _context10.stop();
5727
5929
  }
5728
5930
  }
5729
- }, _callee9, this);
5931
+ }, _callee10, this);
5730
5932
  }));
5731
5933
 
5732
- function revokeUsersToken(_x11, _x12) {
5934
+ function revokeUsersToken(_x13, _x14) {
5733
5935
  return _revokeUsersToken.apply(this, arguments);
5734
5936
  }
5735
5937
 
@@ -5742,23 +5944,23 @@ var StreamChat = /*#__PURE__*/function () {
5742
5944
  }, {
5743
5945
  key: "getAppSettings",
5744
5946
  value: function () {
5745
- var _getAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
5746
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
5947
+ var _getAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
5948
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
5747
5949
  while (1) {
5748
- switch (_context10.prev = _context10.next) {
5950
+ switch (_context11.prev = _context11.next) {
5749
5951
  case 0:
5750
- _context10.next = 2;
5952
+ _context11.next = 2;
5751
5953
  return this.get(this.baseURL + '/app');
5752
5954
 
5753
5955
  case 2:
5754
- return _context10.abrupt("return", _context10.sent);
5956
+ return _context11.abrupt("return", _context11.sent);
5755
5957
 
5756
5958
  case 3:
5757
5959
  case "end":
5758
- return _context10.stop();
5960
+ return _context11.stop();
5759
5961
  }
5760
5962
  }
5761
- }, _callee10, this);
5963
+ }, _callee11, this);
5762
5964
  }));
5763
5965
 
5764
5966
  function getAppSettings() {
@@ -5777,6 +5979,7 @@ var StreamChat = /*#__PURE__*/function () {
5777
5979
  apnTemplate: '{}', //if app doesn't have apn configured it will error
5778
5980
  firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5779
5981
  firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5982
+ huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error
5780
5983
  skipDevices: true, // skip config/device checks and sending to real devices
5781
5984
  }
5782
5985
  */
@@ -5784,16 +5987,16 @@ var StreamChat = /*#__PURE__*/function () {
5784
5987
  }, {
5785
5988
  key: "testPushSettings",
5786
5989
  value: function () {
5787
- var _testPushSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(userID) {
5990
+ var _testPushSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(userID) {
5788
5991
  var data,
5789
- _args11 = arguments;
5790
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
5992
+ _args12 = arguments;
5993
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
5791
5994
  while (1) {
5792
- switch (_context11.prev = _context11.next) {
5995
+ switch (_context12.prev = _context12.next) {
5793
5996
  case 0:
5794
- data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
5795
- _context11.next = 3;
5796
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5997
+ data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
5998
+ _context12.next = 3;
5999
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5797
6000
  user_id: userID
5798
6001
  }, data.messageID ? {
5799
6002
  message_id: data.messageID
@@ -5803,22 +6006,24 @@ var StreamChat = /*#__PURE__*/function () {
5803
6006
  firebase_template: data.firebaseTemplate
5804
6007
  } : {}), data.firebaseDataTemplate ? {
5805
6008
  firebase_data_template: data.firebaseDataTemplate
6009
+ } : {}), data.huaweiDataTemplate ? {
6010
+ huawei_data_template: data.huaweiDataTemplate
5806
6011
  } : {}), data.skipDevices ? {
5807
6012
  skip_devices: true
5808
6013
  } : {}));
5809
6014
 
5810
6015
  case 3:
5811
- return _context11.abrupt("return", _context11.sent);
6016
+ return _context12.abrupt("return", _context12.sent);
5812
6017
 
5813
6018
  case 4:
5814
6019
  case "end":
5815
- return _context11.stop();
6020
+ return _context12.stop();
5816
6021
  }
5817
6022
  }
5818
- }, _callee11, this);
6023
+ }, _callee12, this);
5819
6024
  }));
5820
6025
 
5821
- function testPushSettings(_x13) {
6026
+ function testPushSettings(_x15) {
5822
6027
  return _testPushSettings.apply(this, arguments);
5823
6028
  }
5824
6029
 
@@ -5827,39 +6032,37 @@ var StreamChat = /*#__PURE__*/function () {
5827
6032
  /**
5828
6033
  * testSQSSettings - Tests that the given or configured SQS configuration is valid
5829
6034
  *
5830
- * @param {string} userID User ID. If user has no devices, it will error
5831
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
6035
+ * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
5832
6036
  * IE: {
5833
- messageID: 'id-of-message',//will error if message does not exist
5834
- apnTemplate: '{}', //if app doesn't have apn configured it will error
5835
- firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5836
- firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
6037
+ sqs_key: 'auth_key',
6038
+ sqs_secret: 'auth_secret',
6039
+ sqs_url: 'url_to_queue',
5837
6040
  }
5838
6041
  */
5839
6042
 
5840
6043
  }, {
5841
6044
  key: "testSQSSettings",
5842
6045
  value: function () {
5843
- var _testSQSSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
6046
+ var _testSQSSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
5844
6047
  var data,
5845
- _args12 = arguments;
5846
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
6048
+ _args13 = arguments;
6049
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
5847
6050
  while (1) {
5848
- switch (_context12.prev = _context12.next) {
6051
+ switch (_context13.prev = _context13.next) {
5849
6052
  case 0:
5850
- data = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
5851
- _context12.next = 3;
6053
+ data = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
6054
+ _context13.next = 3;
5852
6055
  return this.post(this.baseURL + '/check_sqs', data);
5853
6056
 
5854
6057
  case 3:
5855
- return _context12.abrupt("return", _context12.sent);
6058
+ return _context13.abrupt("return", _context13.sent);
5856
6059
 
5857
6060
  case 4:
5858
6061
  case "end":
5859
- return _context12.stop();
6062
+ return _context13.stop();
5860
6063
  }
5861
6064
  }
5862
- }, _callee12, this);
6065
+ }, _callee13, this);
5863
6066
  }));
5864
6067
 
5865
6068
  function testSQSSettings() {
@@ -5886,50 +6089,50 @@ var StreamChat = /*#__PURE__*/function () {
5886
6089
  * @return {ConnectAPIResponse<ChannelType, CommandType, UserType>} Returns a promise that resolves when the connection is setup
5887
6090
  */
5888
6091
  function () {
5889
- var _setGuestUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(user) {
6092
+ var _setGuestUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(user) {
5890
6093
  var response, _response$user, guestUser;
5891
6094
 
5892
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
6095
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
5893
6096
  while (1) {
5894
- switch (_context13.prev = _context13.next) {
6097
+ switch (_context14.prev = _context14.next) {
5895
6098
  case 0:
5896
6099
  this.anonymous = true;
5897
- _context13.prev = 1;
5898
- _context13.next = 4;
6100
+ _context14.prev = 1;
6101
+ _context14.next = 4;
5899
6102
  return this.post(this.baseURL + '/guest', {
5900
6103
  user: user
5901
6104
  });
5902
6105
 
5903
6106
  case 4:
5904
- response = _context13.sent;
5905
- _context13.next = 11;
6107
+ response = _context14.sent;
6108
+ _context14.next = 11;
5906
6109
  break;
5907
6110
 
5908
6111
  case 7:
5909
- _context13.prev = 7;
5910
- _context13.t0 = _context13["catch"](1);
6112
+ _context14.prev = 7;
6113
+ _context14.t0 = _context14["catch"](1);
5911
6114
  this.anonymous = false;
5912
- throw _context13.t0;
6115
+ throw _context14.t0;
5913
6116
 
5914
6117
  case 11:
5915
6118
  this.anonymous = false; // eslint-disable-next-line @typescript-eslint/no-unused-vars
5916
6119
 
5917
6120
  _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"]);
5918
- _context13.next = 15;
6121
+ _context14.next = 15;
5919
6122
  return this.connectUser(guestUser, response.access_token);
5920
6123
 
5921
6124
  case 15:
5922
- return _context13.abrupt("return", _context13.sent);
6125
+ return _context14.abrupt("return", _context14.sent);
5923
6126
 
5924
6127
  case 16:
5925
6128
  case "end":
5926
- return _context13.stop();
6129
+ return _context14.stop();
5927
6130
  }
5928
6131
  }
5929
- }, _callee13, this, [[1, 7]]);
6132
+ }, _callee14, this, [[1, 7]]);
5930
6133
  }));
5931
6134
 
5932
- function setGuestUser(_x14) {
6135
+ function setGuestUser(_x16) {
5933
6136
  return _setGuestUser.apply(this, arguments);
5934
6137
  }
5935
6138
 
@@ -6239,17 +6442,17 @@ var StreamChat = /*#__PURE__*/function () {
6239
6442
  * @private
6240
6443
  */
6241
6444
  function () {
6242
- var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
6445
+ var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
6243
6446
  var client, warmUpPromise, handshake;
6244
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
6447
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
6245
6448
  while (1) {
6246
- switch (_context14.prev = _context14.next) {
6449
+ switch (_context15.prev = _context15.next) {
6247
6450
  case 0:
6248
6451
  client = this;
6249
6452
  this.failures = 0;
6250
6453
 
6251
6454
  if (!(client.userID == null || this._user == null)) {
6252
- _context14.next = 4;
6455
+ _context15.next = 4;
6253
6456
  break;
6254
6457
  }
6255
6458
 
@@ -6257,7 +6460,7 @@ var StreamChat = /*#__PURE__*/function () {
6257
6460
 
6258
6461
  case 4:
6259
6462
  if (!(client.wsBaseURL == null)) {
6260
- _context14.next = 6;
6463
+ _context15.next = 6;
6261
6464
  break;
6262
6465
  }
6263
6466
 
@@ -6265,7 +6468,7 @@ var StreamChat = /*#__PURE__*/function () {
6265
6468
 
6266
6469
  case 6:
6267
6470
  if (!(client.clientID == null)) {
6268
- _context14.next = 8;
6471
+ _context15.next = 8;
6269
6472
  break;
6270
6473
  }
6271
6474
 
@@ -6286,42 +6489,44 @@ var StreamChat = /*#__PURE__*/function () {
6286
6489
  messageCallback: this.handleEvent,
6287
6490
  eventCallback: this.dispatchEvent,
6288
6491
  logger: this.logger,
6289
- device: this.options.device
6492
+ device: this.options.device,
6493
+ postInsights: this.options.enableInsights ? this.postInsights : undefined,
6494
+ insightMetrics: this.insightMetrics
6290
6495
  });
6291
6496
 
6292
6497
  if (this.options.warmUp) {
6293
6498
  warmUpPromise = this.doAxiosRequest('options', this.baseURL + '/connect');
6294
6499
  }
6295
6500
 
6296
- _context14.next = 12;
6501
+ _context15.next = 12;
6297
6502
  return this.wsConnection.connect();
6298
6503
 
6299
6504
  case 12:
6300
- handshake = _context14.sent;
6301
- _context14.prev = 13;
6302
- _context14.next = 16;
6505
+ handshake = _context15.sent;
6506
+ _context15.prev = 13;
6507
+ _context15.next = 16;
6303
6508
  return warmUpPromise;
6304
6509
 
6305
6510
  case 16:
6306
- _context14.next = 21;
6511
+ _context15.next = 21;
6307
6512
  break;
6308
6513
 
6309
6514
  case 18:
6310
- _context14.prev = 18;
6311
- _context14.t0 = _context14["catch"](13);
6515
+ _context15.prev = 18;
6516
+ _context15.t0 = _context15["catch"](13);
6312
6517
  this.logger('error', 'Warmup request failed', {
6313
- error: _context14.t0
6518
+ error: _context15.t0
6314
6519
  });
6315
6520
 
6316
6521
  case 21:
6317
- return _context14.abrupt("return", handshake);
6522
+ return _context15.abrupt("return", handshake);
6318
6523
 
6319
6524
  case 22:
6320
6525
  case "end":
6321
- return _context14.stop();
6526
+ return _context15.stop();
6322
6527
  }
6323
6528
  }
6324
- }, _callee14, this, [[13, 18]]);
6529
+ }, _callee15, this, [[13, 18]]);
6325
6530
  }));
6326
6531
 
6327
6532
  function connect() {
@@ -6344,23 +6549,23 @@ var StreamChat = /*#__PURE__*/function () {
6344
6549
  }, {
6345
6550
  key: "queryUsers",
6346
6551
  value: function () {
6347
- var _queryUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(filterConditions) {
6552
+ var _queryUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(filterConditions) {
6348
6553
  var sort,
6349
6554
  options,
6350
6555
  defaultOptions,
6351
6556
  data,
6352
- _args15 = arguments;
6353
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
6557
+ _args16 = arguments;
6558
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
6354
6559
  while (1) {
6355
- switch (_context15.prev = _context15.next) {
6560
+ switch (_context16.prev = _context16.next) {
6356
6561
  case 0:
6357
- sort = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : [];
6358
- options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
6562
+ sort = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : [];
6563
+ options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
6359
6564
  defaultOptions = {
6360
6565
  presence: false
6361
6566
  }; // Make sure we wait for the connect promise if there is a pending one
6362
6567
 
6363
- _context15.next = 5;
6568
+ _context16.next = 5;
6364
6569
  return this.setUserPromise;
6365
6570
 
6366
6571
  case 5:
@@ -6369,7 +6574,7 @@ var StreamChat = /*#__PURE__*/function () {
6369
6574
  } // Return a list of users
6370
6575
 
6371
6576
 
6372
- _context15.next = 8;
6577
+ _context16.next = 8;
6373
6578
  return this.get(this.baseURL + '/users', {
6374
6579
  payload: _objectSpread(_objectSpread({
6375
6580
  filter_conditions: filterConditions,
@@ -6378,19 +6583,19 @@ var StreamChat = /*#__PURE__*/function () {
6378
6583
  });
6379
6584
 
6380
6585
  case 8:
6381
- data = _context15.sent;
6586
+ data = _context16.sent;
6382
6587
  this.state.updateUsers(data.users);
6383
- return _context15.abrupt("return", data);
6588
+ return _context16.abrupt("return", data);
6384
6589
 
6385
6590
  case 11:
6386
6591
  case "end":
6387
- return _context15.stop();
6592
+ return _context16.stop();
6388
6593
  }
6389
6594
  }
6390
- }, _callee15, this);
6595
+ }, _callee16, this);
6391
6596
  }));
6392
6597
 
6393
- function queryUsers(_x15) {
6598
+ function queryUsers(_x17) {
6394
6599
  return _queryUsers.apply(this, arguments);
6395
6600
  }
6396
6601
 
@@ -6409,19 +6614,19 @@ var StreamChat = /*#__PURE__*/function () {
6409
6614
  }, {
6410
6615
  key: "queryBannedUsers",
6411
6616
  value: function () {
6412
- var _queryBannedUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
6617
+ var _queryBannedUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
6413
6618
  var filterConditions,
6414
6619
  sort,
6415
6620
  options,
6416
- _args16 = arguments;
6417
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
6621
+ _args17 = arguments;
6622
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
6418
6623
  while (1) {
6419
- switch (_context16.prev = _context16.next) {
6624
+ switch (_context17.prev = _context17.next) {
6420
6625
  case 0:
6421
- filterConditions = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
6422
- sort = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : [];
6423
- options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
6424
- _context16.next = 5;
6626
+ filterConditions = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
6627
+ sort = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : [];
6628
+ options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
6629
+ _context17.next = 5;
6425
6630
  return this.get(this.baseURL + '/query_banned_users', {
6426
6631
  payload: _objectSpread({
6427
6632
  filter_conditions: filterConditions,
@@ -6430,14 +6635,14 @@ var StreamChat = /*#__PURE__*/function () {
6430
6635
  });
6431
6636
 
6432
6637
  case 5:
6433
- return _context16.abrupt("return", _context16.sent);
6638
+ return _context17.abrupt("return", _context17.sent);
6434
6639
 
6435
6640
  case 6:
6436
6641
  case "end":
6437
- return _context16.stop();
6642
+ return _context17.stop();
6438
6643
  }
6439
6644
  }
6440
- }, _callee16, this);
6645
+ }, _callee17, this);
6441
6646
  }));
6442
6647
 
6443
6648
  function queryBannedUsers() {
@@ -6458,17 +6663,17 @@ var StreamChat = /*#__PURE__*/function () {
6458
6663
  }, {
6459
6664
  key: "queryMessageFlags",
6460
6665
  value: function () {
6461
- var _queryMessageFlags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
6666
+ var _queryMessageFlags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
6462
6667
  var filterConditions,
6463
6668
  options,
6464
- _args17 = arguments;
6465
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
6669
+ _args18 = arguments;
6670
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
6466
6671
  while (1) {
6467
- switch (_context17.prev = _context17.next) {
6672
+ switch (_context18.prev = _context18.next) {
6468
6673
  case 0:
6469
- filterConditions = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
6470
- options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {};
6471
- _context17.next = 4;
6674
+ filterConditions = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
6675
+ options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
6676
+ _context18.next = 4;
6472
6677
  return this.get(this.baseURL + '/moderation/flags/message', {
6473
6678
  payload: _objectSpread({
6474
6679
  filter_conditions: filterConditions
@@ -6476,14 +6681,14 @@ var StreamChat = /*#__PURE__*/function () {
6476
6681
  });
6477
6682
 
6478
6683
  case 4:
6479
- return _context17.abrupt("return", _context17.sent);
6684
+ return _context18.abrupt("return", _context18.sent);
6480
6685
 
6481
6686
  case 5:
6482
6687
  case "end":
6483
- return _context17.stop();
6688
+ return _context18.stop();
6484
6689
  }
6485
6690
  }
6486
- }, _callee17, this);
6691
+ }, _callee18, this);
6487
6692
  }));
6488
6693
 
6489
6694
  function queryMessageFlags() {
@@ -6508,7 +6713,7 @@ var StreamChat = /*#__PURE__*/function () {
6508
6713
  }, {
6509
6714
  key: "queryChannels",
6510
6715
  value: function () {
6511
- var _queryChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(filterConditions) {
6716
+ var _queryChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(filterConditions) {
6512
6717
  var sort,
6513
6718
  options,
6514
6719
  stateOptions,
@@ -6524,15 +6729,15 @@ var StreamChat = /*#__PURE__*/function () {
6524
6729
  _step3,
6525
6730
  _channelState,
6526
6731
  c,
6527
- _args18 = arguments;
6732
+ _args19 = arguments;
6528
6733
 
6529
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
6734
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
6530
6735
  while (1) {
6531
- switch (_context18.prev = _context18.next) {
6736
+ switch (_context19.prev = _context19.next) {
6532
6737
  case 0:
6533
- sort = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : [];
6534
- options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
6535
- stateOptions = _args18.length > 3 && _args18[3] !== undefined ? _args18[3] : {};
6738
+ sort = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : [];
6739
+ options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
6740
+ stateOptions = _args19.length > 3 && _args19[3] !== undefined ? _args19[3] : {};
6536
6741
  skipInitialization = stateOptions.skipInitialization;
6537
6742
  defaultOptions = {
6538
6743
  state: true,
@@ -6540,7 +6745,7 @@ var StreamChat = /*#__PURE__*/function () {
6540
6745
  presence: false
6541
6746
  }; // Make sure we wait for the connect promise if there is a pending one
6542
6747
 
6543
- _context18.next = 7;
6748
+ _context19.next = 7;
6544
6749
  return this.setUserPromise;
6545
6750
 
6546
6751
  case 7:
@@ -6553,11 +6758,11 @@ var StreamChat = /*#__PURE__*/function () {
6553
6758
  filter_conditions: filterConditions,
6554
6759
  sort: normalizeQuerySort(sort)
6555
6760
  }, defaultOptions), options);
6556
- _context18.next = 11;
6761
+ _context19.next = 11;
6557
6762
  return this.post(this.baseURL + '/channels', payload);
6558
6763
 
6559
6764
  case 11:
6560
- data = _context18.sent;
6765
+ data = _context19.sent;
6561
6766
  channels = []; // update our cache of the configs
6562
6767
 
6563
6768
  _iterator2 = _createForOfIteratorHelper(data.channels);
@@ -6599,17 +6804,17 @@ var StreamChat = /*#__PURE__*/function () {
6599
6804
  _iterator3.f();
6600
6805
  }
6601
6806
 
6602
- return _context18.abrupt("return", channels);
6807
+ return _context19.abrupt("return", channels);
6603
6808
 
6604
6809
  case 18:
6605
6810
  case "end":
6606
- return _context18.stop();
6811
+ return _context19.stop();
6607
6812
  }
6608
6813
  }
6609
- }, _callee18, this);
6814
+ }, _callee19, this);
6610
6815
  }));
6611
6816
 
6612
- function queryChannels(_x16) {
6817
+ function queryChannels(_x18) {
6613
6818
  return _queryChannels.apply(this, arguments);
6614
6819
  }
6615
6820
 
@@ -6628,18 +6833,18 @@ var StreamChat = /*#__PURE__*/function () {
6628
6833
  }, {
6629
6834
  key: "search",
6630
6835
  value: function () {
6631
- var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(filterConditions, query) {
6836
+ var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(filterConditions, query) {
6632
6837
  var options,
6633
6838
  payload,
6634
- _args19 = arguments;
6635
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
6839
+ _args20 = arguments;
6840
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
6636
6841
  while (1) {
6637
- switch (_context19.prev = _context19.next) {
6842
+ switch (_context20.prev = _context20.next) {
6638
6843
  case 0:
6639
- options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
6844
+ options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
6640
6845
 
6641
6846
  if (!(options.offset && (options.sort || options.next))) {
6642
- _context19.next = 3;
6847
+ _context20.next = 3;
6643
6848
  break;
6644
6849
  }
6645
6850
 
@@ -6653,49 +6858,49 @@ var StreamChat = /*#__PURE__*/function () {
6653
6858
  });
6654
6859
 
6655
6860
  if (!(typeof query === 'string')) {
6656
- _context19.next = 8;
6861
+ _context20.next = 8;
6657
6862
  break;
6658
6863
  }
6659
6864
 
6660
6865
  payload.query = query;
6661
- _context19.next = 13;
6866
+ _context20.next = 13;
6662
6867
  break;
6663
6868
 
6664
6869
  case 8:
6665
6870
  if (!(_typeof(query) === 'object')) {
6666
- _context19.next = 12;
6871
+ _context20.next = 12;
6667
6872
  break;
6668
6873
  }
6669
6874
 
6670
6875
  payload.message_filter_conditions = query;
6671
- _context19.next = 13;
6876
+ _context20.next = 13;
6672
6877
  break;
6673
6878
 
6674
6879
  case 12:
6675
6880
  throw Error("Invalid type ".concat(_typeof(query), " for query parameter"));
6676
6881
 
6677
6882
  case 13:
6678
- _context19.next = 15;
6883
+ _context20.next = 15;
6679
6884
  return this.setUserPromise;
6680
6885
 
6681
6886
  case 15:
6682
- _context19.next = 17;
6887
+ _context20.next = 17;
6683
6888
  return this.get(this.baseURL + '/search', {
6684
6889
  payload: payload
6685
6890
  });
6686
6891
 
6687
6892
  case 17:
6688
- return _context19.abrupt("return", _context19.sent);
6893
+ return _context20.abrupt("return", _context20.sent);
6689
6894
 
6690
6895
  case 18:
6691
6896
  case "end":
6692
- return _context19.stop();
6897
+ return _context20.stop();
6693
6898
  }
6694
6899
  }
6695
- }, _callee19, this);
6900
+ }, _callee20, this);
6696
6901
  }));
6697
6902
 
6698
- function search(_x17, _x18) {
6903
+ function search(_x19, _x20) {
6699
6904
  return _search.apply(this, arguments);
6700
6905
  }
6701
6906
 
@@ -6706,7 +6911,7 @@ var StreamChat = /*#__PURE__*/function () {
6706
6911
  *
6707
6912
  * @param {BaseDeviceFields} device the device object
6708
6913
  * @param {string} device.id device id
6709
- * @param {string} device.push_provider the push provider (apn or firebase)
6914
+ * @param {string} device.push_provider the push provider
6710
6915
  *
6711
6916
  */
6712
6917
 
@@ -6723,7 +6928,7 @@ var StreamChat = /*#__PURE__*/function () {
6723
6928
  * addDevice - Adds a push device for a user.
6724
6929
  *
6725
6930
  * @param {string} id the device id
6726
- * @param {'apn' | 'firebase'} push_provider the push provider (apn or firebase)
6931
+ * @param {PushProvider} push_provider the push provider
6727
6932
  * @param {string} [userID] the user id (defaults to current user)
6728
6933
  *
6729
6934
  */
@@ -6731,12 +6936,12 @@ var StreamChat = /*#__PURE__*/function () {
6731
6936
  }, {
6732
6937
  key: "addDevice",
6733
6938
  value: function () {
6734
- var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(id, push_provider, userID) {
6735
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
6939
+ var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(id, push_provider, userID) {
6940
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
6736
6941
  while (1) {
6737
- switch (_context20.prev = _context20.next) {
6942
+ switch (_context21.prev = _context21.next) {
6738
6943
  case 0:
6739
- _context20.next = 2;
6944
+ _context21.next = 2;
6740
6945
  return this.post(this.baseURL + '/devices', _objectSpread({
6741
6946
  id: id,
6742
6947
  push_provider: push_provider
@@ -6745,17 +6950,17 @@ var StreamChat = /*#__PURE__*/function () {
6745
6950
  } : {}));
6746
6951
 
6747
6952
  case 2:
6748
- return _context20.abrupt("return", _context20.sent);
6953
+ return _context21.abrupt("return", _context21.sent);
6749
6954
 
6750
6955
  case 3:
6751
6956
  case "end":
6752
- return _context20.stop();
6957
+ return _context21.stop();
6753
6958
  }
6754
6959
  }
6755
- }, _callee20, this);
6960
+ }, _callee21, this);
6756
6961
  }));
6757
6962
 
6758
- function addDevice(_x19, _x20, _x21) {
6963
+ function addDevice(_x21, _x22, _x23) {
6759
6964
  return _addDevice.apply(this, arguments);
6760
6965
  }
6761
6966
 
@@ -6772,28 +6977,28 @@ var StreamChat = /*#__PURE__*/function () {
6772
6977
  }, {
6773
6978
  key: "getDevices",
6774
6979
  value: function () {
6775
- var _getDevices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(userID) {
6776
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
6980
+ var _getDevices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(userID) {
6981
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
6777
6982
  while (1) {
6778
- switch (_context21.prev = _context21.next) {
6983
+ switch (_context22.prev = _context22.next) {
6779
6984
  case 0:
6780
- _context21.next = 2;
6985
+ _context22.next = 2;
6781
6986
  return this.get(this.baseURL + '/devices', userID ? {
6782
6987
  user_id: userID
6783
6988
  } : {});
6784
6989
 
6785
6990
  case 2:
6786
- return _context21.abrupt("return", _context21.sent);
6991
+ return _context22.abrupt("return", _context22.sent);
6787
6992
 
6788
6993
  case 3:
6789
6994
  case "end":
6790
- return _context21.stop();
6995
+ return _context22.stop();
6791
6996
  }
6792
6997
  }
6793
- }, _callee21, this);
6998
+ }, _callee22, this);
6794
6999
  }));
6795
7000
 
6796
- function getDevices(_x22) {
7001
+ function getDevices(_x24) {
6797
7002
  return _getDevices.apply(this, arguments);
6798
7003
  }
6799
7004
 
@@ -6810,12 +7015,12 @@ var StreamChat = /*#__PURE__*/function () {
6810
7015
  }, {
6811
7016
  key: "removeDevice",
6812
7017
  value: function () {
6813
- var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(id, userID) {
6814
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
7018
+ var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(id, userID) {
7019
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
6815
7020
  while (1) {
6816
- switch (_context22.prev = _context22.next) {
7021
+ switch (_context23.prev = _context23.next) {
6817
7022
  case 0:
6818
- _context22.next = 2;
7023
+ _context23.next = 2;
6819
7024
  return this.delete(this.baseURL + '/devices', _objectSpread({
6820
7025
  id: id
6821
7026
  }, userID ? {
@@ -6823,17 +7028,17 @@ var StreamChat = /*#__PURE__*/function () {
6823
7028
  } : {}));
6824
7029
 
6825
7030
  case 2:
6826
- return _context22.abrupt("return", _context22.sent);
7031
+ return _context23.abrupt("return", _context23.sent);
6827
7032
 
6828
7033
  case 3:
6829
7034
  case "end":
6830
- return _context22.stop();
7035
+ return _context23.stop();
6831
7036
  }
6832
7037
  }
6833
- }, _callee22, this);
7038
+ }, _callee23, this);
6834
7039
  }));
6835
7040
 
6836
- function removeDevice(_x23, _x24) {
7041
+ function removeDevice(_x25, _x26) {
6837
7042
  return _removeDevice.apply(this, arguments);
6838
7043
  }
6839
7044
 
@@ -6850,15 +7055,15 @@ var StreamChat = /*#__PURE__*/function () {
6850
7055
  }, {
6851
7056
  key: "getRateLimits",
6852
7057
  value: function () {
6853
- var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(params) {
6854
- var _ref6, serverSide, web, android, ios, endpoints;
7058
+ var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(params) {
7059
+ var _ref7, serverSide, web, android, ios, endpoints;
6855
7060
 
6856
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
7061
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
6857
7062
  while (1) {
6858
- switch (_context23.prev = _context23.next) {
7063
+ switch (_context24.prev = _context24.next) {
6859
7064
  case 0:
6860
- _ref6 = params || {}, serverSide = _ref6.serverSide, web = _ref6.web, android = _ref6.android, ios = _ref6.ios, endpoints = _ref6.endpoints;
6861
- return _context23.abrupt("return", this.get(this.baseURL + '/rate_limits', {
7065
+ _ref7 = params || {}, serverSide = _ref7.serverSide, web = _ref7.web, android = _ref7.android, ios = _ref7.ios, endpoints = _ref7.endpoints;
7066
+ return _context24.abrupt("return", this.get(this.baseURL + '/rate_limits', {
6862
7067
  server_side: serverSide,
6863
7068
  web: web,
6864
7069
  android: android,
@@ -6868,13 +7073,13 @@ var StreamChat = /*#__PURE__*/function () {
6868
7073
 
6869
7074
  case 2:
6870
7075
  case "end":
6871
- return _context23.stop();
7076
+ return _context24.stop();
6872
7077
  }
6873
7078
  }
6874
- }, _callee23, this);
7079
+ }, _callee24, this);
6875
7080
  }));
6876
7081
 
6877
- function getRateLimits(_x25) {
7082
+ function getRateLimits(_x27) {
6878
7083
  return _getRateLimits.apply(this, arguments);
6879
7084
  }
6880
7085
 
@@ -6956,26 +7161,26 @@ var StreamChat = /*#__PURE__*/function () {
6956
7161
  * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>} list of updated users
6957
7162
  */
6958
7163
  function () {
6959
- var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(partialUserObject) {
6960
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
7164
+ var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(partialUserObject) {
7165
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
6961
7166
  while (1) {
6962
- switch (_context24.prev = _context24.next) {
7167
+ switch (_context25.prev = _context25.next) {
6963
7168
  case 0:
6964
- _context24.next = 2;
7169
+ _context25.next = 2;
6965
7170
  return this.partialUpdateUsers([partialUserObject]);
6966
7171
 
6967
7172
  case 2:
6968
- return _context24.abrupt("return", _context24.sent);
7173
+ return _context25.abrupt("return", _context25.sent);
6969
7174
 
6970
7175
  case 3:
6971
7176
  case "end":
6972
- return _context24.stop();
7177
+ return _context25.stop();
6973
7178
  }
6974
7179
  }
6975
- }, _callee24, this);
7180
+ }, _callee25, this);
6976
7181
  }));
6977
7182
 
6978
- function partialUpdateUser(_x26) {
7183
+ function partialUpdateUser(_x28) {
6979
7184
  return _partialUpdateUser.apply(this, arguments);
6980
7185
  }
6981
7186
 
@@ -6992,29 +7197,29 @@ var StreamChat = /*#__PURE__*/function () {
6992
7197
  }, {
6993
7198
  key: "upsertUsers",
6994
7199
  value: function () {
6995
- var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(users) {
7200
+ var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(users) {
6996
7201
  var userMap, _iterator4, _step4, userObject;
6997
7202
 
6998
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
7203
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
6999
7204
  while (1) {
7000
- switch (_context25.prev = _context25.next) {
7205
+ switch (_context26.prev = _context26.next) {
7001
7206
  case 0:
7002
7207
  userMap = {};
7003
7208
  _iterator4 = _createForOfIteratorHelper(users);
7004
- _context25.prev = 2;
7209
+ _context26.prev = 2;
7005
7210
 
7006
7211
  _iterator4.s();
7007
7212
 
7008
7213
  case 4:
7009
7214
  if ((_step4 = _iterator4.n()).done) {
7010
- _context25.next = 11;
7215
+ _context26.next = 11;
7011
7216
  break;
7012
7217
  }
7013
7218
 
7014
7219
  userObject = _step4.value;
7015
7220
 
7016
7221
  if (userObject.id) {
7017
- _context25.next = 8;
7222
+ _context26.next = 8;
7018
7223
  break;
7019
7224
  }
7020
7225
 
@@ -7024,44 +7229,44 @@ var StreamChat = /*#__PURE__*/function () {
7024
7229
  userMap[userObject.id] = userObject;
7025
7230
 
7026
7231
  case 9:
7027
- _context25.next = 4;
7232
+ _context26.next = 4;
7028
7233
  break;
7029
7234
 
7030
7235
  case 11:
7031
- _context25.next = 16;
7236
+ _context26.next = 16;
7032
7237
  break;
7033
7238
 
7034
7239
  case 13:
7035
- _context25.prev = 13;
7036
- _context25.t0 = _context25["catch"](2);
7240
+ _context26.prev = 13;
7241
+ _context26.t0 = _context26["catch"](2);
7037
7242
 
7038
- _iterator4.e(_context25.t0);
7243
+ _iterator4.e(_context26.t0);
7039
7244
 
7040
7245
  case 16:
7041
- _context25.prev = 16;
7246
+ _context26.prev = 16;
7042
7247
 
7043
7248
  _iterator4.f();
7044
7249
 
7045
- return _context25.finish(16);
7250
+ return _context26.finish(16);
7046
7251
 
7047
7252
  case 19:
7048
- _context25.next = 21;
7253
+ _context26.next = 21;
7049
7254
  return this.post(this.baseURL + '/users', {
7050
7255
  users: userMap
7051
7256
  });
7052
7257
 
7053
7258
  case 21:
7054
- return _context25.abrupt("return", _context25.sent);
7259
+ return _context26.abrupt("return", _context26.sent);
7055
7260
 
7056
7261
  case 22:
7057
7262
  case "end":
7058
- return _context25.stop();
7263
+ return _context26.stop();
7059
7264
  }
7060
7265
  }
7061
- }, _callee25, this, [[2, 13, 16, 19]]);
7266
+ }, _callee26, this, [[2, 13, 16, 19]]);
7062
7267
  }));
7063
7268
 
7064
- function upsertUsers(_x27) {
7269
+ function upsertUsers(_x29) {
7065
7270
  return _upsertUsers.apply(this, arguments);
7066
7271
  }
7067
7272
 
@@ -7109,72 +7314,72 @@ var StreamChat = /*#__PURE__*/function () {
7109
7314
  * @return {Promise<APIResponse & { users: { [key: string]: UserResponse<UserType> } }>}
7110
7315
  */
7111
7316
  function () {
7112
- var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(users) {
7317
+ var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(users) {
7113
7318
  var _iterator5, _step5, userObject;
7114
7319
 
7115
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
7320
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
7116
7321
  while (1) {
7117
- switch (_context26.prev = _context26.next) {
7322
+ switch (_context27.prev = _context27.next) {
7118
7323
  case 0:
7119
7324
  _iterator5 = _createForOfIteratorHelper(users);
7120
- _context26.prev = 1;
7325
+ _context27.prev = 1;
7121
7326
 
7122
7327
  _iterator5.s();
7123
7328
 
7124
7329
  case 3:
7125
7330
  if ((_step5 = _iterator5.n()).done) {
7126
- _context26.next = 9;
7331
+ _context27.next = 9;
7127
7332
  break;
7128
7333
  }
7129
7334
 
7130
7335
  userObject = _step5.value;
7131
7336
 
7132
7337
  if (userObject.id) {
7133
- _context26.next = 7;
7338
+ _context27.next = 7;
7134
7339
  break;
7135
7340
  }
7136
7341
 
7137
7342
  throw Error('User ID is required when updating a user');
7138
7343
 
7139
7344
  case 7:
7140
- _context26.next = 3;
7345
+ _context27.next = 3;
7141
7346
  break;
7142
7347
 
7143
7348
  case 9:
7144
- _context26.next = 14;
7349
+ _context27.next = 14;
7145
7350
  break;
7146
7351
 
7147
7352
  case 11:
7148
- _context26.prev = 11;
7149
- _context26.t0 = _context26["catch"](1);
7353
+ _context27.prev = 11;
7354
+ _context27.t0 = _context27["catch"](1);
7150
7355
 
7151
- _iterator5.e(_context26.t0);
7356
+ _iterator5.e(_context27.t0);
7152
7357
 
7153
7358
  case 14:
7154
- _context26.prev = 14;
7359
+ _context27.prev = 14;
7155
7360
 
7156
7361
  _iterator5.f();
7157
7362
 
7158
- return _context26.finish(14);
7363
+ return _context27.finish(14);
7159
7364
 
7160
7365
  case 17:
7161
- _context26.next = 19;
7366
+ _context27.next = 19;
7162
7367
  return this.patch(this.baseURL + '/users', {
7163
7368
  users: users
7164
7369
  });
7165
7370
 
7166
7371
  case 19:
7167
- return _context26.abrupt("return", _context26.sent);
7372
+ return _context27.abrupt("return", _context27.sent);
7168
7373
 
7169
7374
  case 20:
7170
7375
  case "end":
7171
- return _context26.stop();
7376
+ return _context27.stop();
7172
7377
  }
7173
7378
  }
7174
- }, _callee26, this, [[1, 11, 14, 17]]);
7379
+ }, _callee27, this, [[1, 11, 14, 17]]);
7175
7380
  }));
7176
7381
 
7177
- function partialUpdateUsers(_x28) {
7382
+ function partialUpdateUsers(_x30) {
7178
7383
  return _partialUpdateUsers.apply(this, arguments);
7179
7384
  }
7180
7385
 
@@ -7183,26 +7388,26 @@ var StreamChat = /*#__PURE__*/function () {
7183
7388
  }, {
7184
7389
  key: "deleteUser",
7185
7390
  value: function () {
7186
- var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(userID, params) {
7187
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
7391
+ var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(userID, params) {
7392
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
7188
7393
  while (1) {
7189
- switch (_context27.prev = _context27.next) {
7394
+ switch (_context28.prev = _context28.next) {
7190
7395
  case 0:
7191
- _context27.next = 2;
7396
+ _context28.next = 2;
7192
7397
  return this.delete(this.baseURL + "/users/".concat(userID), params);
7193
7398
 
7194
7399
  case 2:
7195
- return _context27.abrupt("return", _context27.sent);
7400
+ return _context28.abrupt("return", _context28.sent);
7196
7401
 
7197
7402
  case 3:
7198
7403
  case "end":
7199
- return _context27.stop();
7404
+ return _context28.stop();
7200
7405
  }
7201
7406
  }
7202
- }, _callee27, this);
7407
+ }, _callee28, this);
7203
7408
  }));
7204
7409
 
7205
- function deleteUser(_x29, _x30) {
7410
+ function deleteUser(_x31, _x32) {
7206
7411
  return _deleteUser.apply(this, arguments);
7207
7412
  }
7208
7413
 
@@ -7211,26 +7416,26 @@ var StreamChat = /*#__PURE__*/function () {
7211
7416
  }, {
7212
7417
  key: "reactivateUser",
7213
7418
  value: function () {
7214
- var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(userID, options) {
7215
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
7419
+ var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(userID, options) {
7420
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
7216
7421
  while (1) {
7217
- switch (_context28.prev = _context28.next) {
7422
+ switch (_context29.prev = _context29.next) {
7218
7423
  case 0:
7219
- _context28.next = 2;
7424
+ _context29.next = 2;
7220
7425
  return this.post(this.baseURL + "/users/".concat(userID, "/reactivate"), _objectSpread({}, options));
7221
7426
 
7222
7427
  case 2:
7223
- return _context28.abrupt("return", _context28.sent);
7428
+ return _context29.abrupt("return", _context29.sent);
7224
7429
 
7225
7430
  case 3:
7226
7431
  case "end":
7227
- return _context28.stop();
7432
+ return _context29.stop();
7228
7433
  }
7229
7434
  }
7230
- }, _callee28, this);
7435
+ }, _callee29, this);
7231
7436
  }));
7232
7437
 
7233
- function reactivateUser(_x31, _x32) {
7438
+ function reactivateUser(_x33, _x34) {
7234
7439
  return _reactivateUser.apply(this, arguments);
7235
7440
  }
7236
7441
 
@@ -7239,26 +7444,26 @@ var StreamChat = /*#__PURE__*/function () {
7239
7444
  }, {
7240
7445
  key: "deactivateUser",
7241
7446
  value: function () {
7242
- var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(userID, options) {
7243
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
7447
+ var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(userID, options) {
7448
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
7244
7449
  while (1) {
7245
- switch (_context29.prev = _context29.next) {
7450
+ switch (_context30.prev = _context30.next) {
7246
7451
  case 0:
7247
- _context29.next = 2;
7452
+ _context30.next = 2;
7248
7453
  return this.post(this.baseURL + "/users/".concat(userID, "/deactivate"), _objectSpread({}, options));
7249
7454
 
7250
7455
  case 2:
7251
- return _context29.abrupt("return", _context29.sent);
7456
+ return _context30.abrupt("return", _context30.sent);
7252
7457
 
7253
7458
  case 3:
7254
7459
  case "end":
7255
- return _context29.stop();
7460
+ return _context30.stop();
7256
7461
  }
7257
7462
  }
7258
- }, _callee29, this);
7463
+ }, _callee30, this);
7259
7464
  }));
7260
7465
 
7261
- function deactivateUser(_x33, _x34) {
7466
+ function deactivateUser(_x35, _x36) {
7262
7467
  return _deactivateUser.apply(this, arguments);
7263
7468
  }
7264
7469
 
@@ -7267,26 +7472,26 @@ var StreamChat = /*#__PURE__*/function () {
7267
7472
  }, {
7268
7473
  key: "exportUser",
7269
7474
  value: function () {
7270
- var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(userID, options) {
7271
- return _regeneratorRuntime.wrap(function _callee30$(_context30) {
7475
+ var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(userID, options) {
7476
+ return _regeneratorRuntime.wrap(function _callee31$(_context31) {
7272
7477
  while (1) {
7273
- switch (_context30.prev = _context30.next) {
7478
+ switch (_context31.prev = _context31.next) {
7274
7479
  case 0:
7275
- _context30.next = 2;
7480
+ _context31.next = 2;
7276
7481
  return this.get(this.baseURL + "/users/".concat(userID, "/export"), _objectSpread({}, options));
7277
7482
 
7278
7483
  case 2:
7279
- return _context30.abrupt("return", _context30.sent);
7484
+ return _context31.abrupt("return", _context31.sent);
7280
7485
 
7281
7486
  case 3:
7282
7487
  case "end":
7283
- return _context30.stop();
7488
+ return _context31.stop();
7284
7489
  }
7285
7490
  }
7286
- }, _callee30, this);
7491
+ }, _callee31, this);
7287
7492
  }));
7288
7493
 
7289
- function exportUser(_x35, _x36) {
7494
+ function exportUser(_x37, _x38) {
7290
7495
  return _exportUser.apply(this, arguments);
7291
7496
  }
7292
7497
 
@@ -7302,10 +7507,10 @@ var StreamChat = /*#__PURE__*/function () {
7302
7507
  }, {
7303
7508
  key: "banUser",
7304
7509
  value: function () {
7305
- var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(targetUserID, options) {
7306
- return _regeneratorRuntime.wrap(function _callee31$(_context31) {
7510
+ var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(targetUserID, options) {
7511
+ return _regeneratorRuntime.wrap(function _callee32$(_context32) {
7307
7512
  while (1) {
7308
- switch (_context31.prev = _context31.next) {
7513
+ switch (_context32.prev = _context32.next) {
7309
7514
  case 0:
7310
7515
  if ((options === null || options === void 0 ? void 0 : options.user_id) !== undefined) {
7311
7516
  options.banned_by_id = options.user_id;
@@ -7319,23 +7524,23 @@ var StreamChat = /*#__PURE__*/function () {
7319
7524
  console.warn("banUser: 'user' is deprecated, please consider switching to 'banned_by'");
7320
7525
  }
7321
7526
 
7322
- _context31.next = 4;
7527
+ _context32.next = 4;
7323
7528
  return this.post(this.baseURL + '/moderation/ban', _objectSpread({
7324
7529
  target_user_id: targetUserID
7325
7530
  }, options));
7326
7531
 
7327
7532
  case 4:
7328
- return _context31.abrupt("return", _context31.sent);
7533
+ return _context32.abrupt("return", _context32.sent);
7329
7534
 
7330
7535
  case 5:
7331
7536
  case "end":
7332
- return _context31.stop();
7537
+ return _context32.stop();
7333
7538
  }
7334
7539
  }
7335
- }, _callee31, this);
7540
+ }, _callee32, this);
7336
7541
  }));
7337
7542
 
7338
- function banUser(_x37, _x38) {
7543
+ function banUser(_x39, _x40) {
7339
7544
  return _banUser.apply(this, arguments);
7340
7545
  }
7341
7546
 
@@ -7351,28 +7556,28 @@ var StreamChat = /*#__PURE__*/function () {
7351
7556
  }, {
7352
7557
  key: "unbanUser",
7353
7558
  value: function () {
7354
- var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(targetUserID, options) {
7355
- return _regeneratorRuntime.wrap(function _callee32$(_context32) {
7559
+ var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(targetUserID, options) {
7560
+ return _regeneratorRuntime.wrap(function _callee33$(_context33) {
7356
7561
  while (1) {
7357
- switch (_context32.prev = _context32.next) {
7562
+ switch (_context33.prev = _context33.next) {
7358
7563
  case 0:
7359
- _context32.next = 2;
7564
+ _context33.next = 2;
7360
7565
  return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
7361
7566
  target_user_id: targetUserID
7362
7567
  }, options));
7363
7568
 
7364
7569
  case 2:
7365
- return _context32.abrupt("return", _context32.sent);
7570
+ return _context33.abrupt("return", _context33.sent);
7366
7571
 
7367
7572
  case 3:
7368
7573
  case "end":
7369
- return _context32.stop();
7574
+ return _context33.stop();
7370
7575
  }
7371
7576
  }
7372
- }, _callee32, this);
7577
+ }, _callee33, this);
7373
7578
  }));
7374
7579
 
7375
- function unbanUser(_x39, _x40) {
7580
+ function unbanUser(_x41, _x42) {
7376
7581
  return _unbanUser.apply(this, arguments);
7377
7582
  }
7378
7583
 
@@ -7388,28 +7593,28 @@ var StreamChat = /*#__PURE__*/function () {
7388
7593
  }, {
7389
7594
  key: "shadowBan",
7390
7595
  value: function () {
7391
- var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(targetUserID, options) {
7392
- return _regeneratorRuntime.wrap(function _callee33$(_context33) {
7596
+ var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(targetUserID, options) {
7597
+ return _regeneratorRuntime.wrap(function _callee34$(_context34) {
7393
7598
  while (1) {
7394
- switch (_context33.prev = _context33.next) {
7599
+ switch (_context34.prev = _context34.next) {
7395
7600
  case 0:
7396
- _context33.next = 2;
7601
+ _context34.next = 2;
7397
7602
  return this.banUser(targetUserID, _objectSpread({
7398
7603
  shadow: true
7399
7604
  }, options));
7400
7605
 
7401
7606
  case 2:
7402
- return _context33.abrupt("return", _context33.sent);
7607
+ return _context34.abrupt("return", _context34.sent);
7403
7608
 
7404
7609
  case 3:
7405
7610
  case "end":
7406
- return _context33.stop();
7611
+ return _context34.stop();
7407
7612
  }
7408
7613
  }
7409
- }, _callee33, this);
7614
+ }, _callee34, this);
7410
7615
  }));
7411
7616
 
7412
- function shadowBan(_x41, _x42) {
7617
+ function shadowBan(_x43, _x44) {
7413
7618
  return _shadowBan.apply(this, arguments);
7414
7619
  }
7415
7620
 
@@ -7425,28 +7630,28 @@ var StreamChat = /*#__PURE__*/function () {
7425
7630
  }, {
7426
7631
  key: "removeShadowBan",
7427
7632
  value: function () {
7428
- var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(targetUserID, options) {
7429
- return _regeneratorRuntime.wrap(function _callee34$(_context34) {
7633
+ var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(targetUserID, options) {
7634
+ return _regeneratorRuntime.wrap(function _callee35$(_context35) {
7430
7635
  while (1) {
7431
- switch (_context34.prev = _context34.next) {
7636
+ switch (_context35.prev = _context35.next) {
7432
7637
  case 0:
7433
- _context34.next = 2;
7638
+ _context35.next = 2;
7434
7639
  return this.unbanUser(targetUserID, _objectSpread({
7435
7640
  shadow: true
7436
7641
  }, options));
7437
7642
 
7438
7643
  case 2:
7439
- return _context34.abrupt("return", _context34.sent);
7644
+ return _context35.abrupt("return", _context35.sent);
7440
7645
 
7441
7646
  case 3:
7442
7647
  case "end":
7443
- return _context34.stop();
7648
+ return _context35.stop();
7444
7649
  }
7445
7650
  }
7446
- }, _callee34, this);
7651
+ }, _callee35, this);
7447
7652
  }));
7448
7653
 
7449
- function removeShadowBan(_x43, _x44) {
7654
+ function removeShadowBan(_x45, _x46) {
7450
7655
  return _removeShadowBan.apply(this, arguments);
7451
7656
  }
7452
7657
 
@@ -7463,15 +7668,15 @@ var StreamChat = /*#__PURE__*/function () {
7463
7668
  }, {
7464
7669
  key: "muteUser",
7465
7670
  value: function () {
7466
- var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(targetID, userID) {
7671
+ var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(targetID, userID) {
7467
7672
  var options,
7468
- _args35 = arguments;
7469
- return _regeneratorRuntime.wrap(function _callee35$(_context35) {
7673
+ _args36 = arguments;
7674
+ return _regeneratorRuntime.wrap(function _callee36$(_context36) {
7470
7675
  while (1) {
7471
- switch (_context35.prev = _context35.next) {
7676
+ switch (_context36.prev = _context36.next) {
7472
7677
  case 0:
7473
- options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
7474
- _context35.next = 3;
7678
+ options = _args36.length > 2 && _args36[2] !== undefined ? _args36[2] : {};
7679
+ _context36.next = 3;
7475
7680
  return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
7476
7681
  target_id: targetID
7477
7682
  }, userID ? {
@@ -7479,17 +7684,17 @@ var StreamChat = /*#__PURE__*/function () {
7479
7684
  } : {}), options));
7480
7685
 
7481
7686
  case 3:
7482
- return _context35.abrupt("return", _context35.sent);
7687
+ return _context36.abrupt("return", _context36.sent);
7483
7688
 
7484
7689
  case 4:
7485
7690
  case "end":
7486
- return _context35.stop();
7691
+ return _context36.stop();
7487
7692
  }
7488
7693
  }
7489
- }, _callee35, this);
7694
+ }, _callee36, this);
7490
7695
  }));
7491
7696
 
7492
- function muteUser(_x45, _x46) {
7697
+ function muteUser(_x47, _x48) {
7493
7698
  return _muteUser.apply(this, arguments);
7494
7699
  }
7495
7700
 
@@ -7505,12 +7710,12 @@ var StreamChat = /*#__PURE__*/function () {
7505
7710
  }, {
7506
7711
  key: "unmuteUser",
7507
7712
  value: function () {
7508
- var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(targetID, currentUserID) {
7509
- return _regeneratorRuntime.wrap(function _callee36$(_context36) {
7713
+ var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(targetID, currentUserID) {
7714
+ return _regeneratorRuntime.wrap(function _callee37$(_context37) {
7510
7715
  while (1) {
7511
- switch (_context36.prev = _context36.next) {
7716
+ switch (_context37.prev = _context37.next) {
7512
7717
  case 0:
7513
- _context36.next = 2;
7718
+ _context37.next = 2;
7514
7719
  return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
7515
7720
  target_id: targetID
7516
7721
  }, currentUserID ? {
@@ -7518,17 +7723,17 @@ var StreamChat = /*#__PURE__*/function () {
7518
7723
  } : {}));
7519
7724
 
7520
7725
  case 2:
7521
- return _context36.abrupt("return", _context36.sent);
7726
+ return _context37.abrupt("return", _context37.sent);
7522
7727
 
7523
7728
  case 3:
7524
7729
  case "end":
7525
- return _context36.stop();
7730
+ return _context37.stop();
7526
7731
  }
7527
7732
  }
7528
- }, _callee36, this);
7733
+ }, _callee37, this);
7529
7734
  }));
7530
7735
 
7531
- function unmuteUser(_x47, _x48) {
7736
+ function unmuteUser(_x49, _x50) {
7532
7737
  return _unmuteUser.apply(this, arguments);
7533
7738
  }
7534
7739
 
@@ -7563,31 +7768,31 @@ var StreamChat = /*#__PURE__*/function () {
7563
7768
  }, {
7564
7769
  key: "flagMessage",
7565
7770
  value: function () {
7566
- var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(targetMessageID) {
7771
+ var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetMessageID) {
7567
7772
  var options,
7568
- _args37 = arguments;
7569
- return _regeneratorRuntime.wrap(function _callee37$(_context37) {
7773
+ _args38 = arguments;
7774
+ return _regeneratorRuntime.wrap(function _callee38$(_context38) {
7570
7775
  while (1) {
7571
- switch (_context37.prev = _context37.next) {
7776
+ switch (_context38.prev = _context38.next) {
7572
7777
  case 0:
7573
- options = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : {};
7574
- _context37.next = 3;
7778
+ options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
7779
+ _context38.next = 3;
7575
7780
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
7576
7781
  target_message_id: targetMessageID
7577
7782
  }, options));
7578
7783
 
7579
7784
  case 3:
7580
- return _context37.abrupt("return", _context37.sent);
7785
+ return _context38.abrupt("return", _context38.sent);
7581
7786
 
7582
7787
  case 4:
7583
7788
  case "end":
7584
- return _context37.stop();
7789
+ return _context38.stop();
7585
7790
  }
7586
7791
  }
7587
- }, _callee37, this);
7792
+ }, _callee38, this);
7588
7793
  }));
7589
7794
 
7590
- function flagMessage(_x49) {
7795
+ function flagMessage(_x51) {
7591
7796
  return _flagMessage.apply(this, arguments);
7592
7797
  }
7593
7798
 
@@ -7603,31 +7808,31 @@ var StreamChat = /*#__PURE__*/function () {
7603
7808
  }, {
7604
7809
  key: "flagUser",
7605
7810
  value: function () {
7606
- var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetID) {
7811
+ var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetID) {
7607
7812
  var options,
7608
- _args38 = arguments;
7609
- return _regeneratorRuntime.wrap(function _callee38$(_context38) {
7813
+ _args39 = arguments;
7814
+ return _regeneratorRuntime.wrap(function _callee39$(_context39) {
7610
7815
  while (1) {
7611
- switch (_context38.prev = _context38.next) {
7816
+ switch (_context39.prev = _context39.next) {
7612
7817
  case 0:
7613
- options = _args38.length > 1 && _args38[1] !== undefined ? _args38[1] : {};
7614
- _context38.next = 3;
7818
+ options = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
7819
+ _context39.next = 3;
7615
7820
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
7616
7821
  target_user_id: targetID
7617
7822
  }, options));
7618
7823
 
7619
7824
  case 3:
7620
- return _context38.abrupt("return", _context38.sent);
7825
+ return _context39.abrupt("return", _context39.sent);
7621
7826
 
7622
7827
  case 4:
7623
7828
  case "end":
7624
- return _context38.stop();
7829
+ return _context39.stop();
7625
7830
  }
7626
7831
  }
7627
- }, _callee38, this);
7832
+ }, _callee39, this);
7628
7833
  }));
7629
7834
 
7630
- function flagUser(_x50) {
7835
+ function flagUser(_x52) {
7631
7836
  return _flagUser.apply(this, arguments);
7632
7837
  }
7633
7838
 
@@ -7643,31 +7848,31 @@ var StreamChat = /*#__PURE__*/function () {
7643
7848
  }, {
7644
7849
  key: "unflagMessage",
7645
7850
  value: function () {
7646
- var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetMessageID) {
7851
+ var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetMessageID) {
7647
7852
  var options,
7648
- _args39 = arguments;
7649
- return _regeneratorRuntime.wrap(function _callee39$(_context39) {
7853
+ _args40 = arguments;
7854
+ return _regeneratorRuntime.wrap(function _callee40$(_context40) {
7650
7855
  while (1) {
7651
- switch (_context39.prev = _context39.next) {
7856
+ switch (_context40.prev = _context40.next) {
7652
7857
  case 0:
7653
- options = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {};
7654
- _context39.next = 3;
7858
+ options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
7859
+ _context40.next = 3;
7655
7860
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
7656
7861
  target_message_id: targetMessageID
7657
7862
  }, options));
7658
7863
 
7659
7864
  case 3:
7660
- return _context39.abrupt("return", _context39.sent);
7865
+ return _context40.abrupt("return", _context40.sent);
7661
7866
 
7662
7867
  case 4:
7663
7868
  case "end":
7664
- return _context39.stop();
7869
+ return _context40.stop();
7665
7870
  }
7666
7871
  }
7667
- }, _callee39, this);
7872
+ }, _callee40, this);
7668
7873
  }));
7669
7874
 
7670
- function unflagMessage(_x51) {
7875
+ function unflagMessage(_x53) {
7671
7876
  return _unflagMessage.apply(this, arguments);
7672
7877
  }
7673
7878
 
@@ -7683,37 +7888,39 @@ var StreamChat = /*#__PURE__*/function () {
7683
7888
  }, {
7684
7889
  key: "unflagUser",
7685
7890
  value: function () {
7686
- var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetID) {
7891
+ var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetID) {
7687
7892
  var options,
7688
- _args40 = arguments;
7689
- return _regeneratorRuntime.wrap(function _callee40$(_context40) {
7893
+ _args41 = arguments;
7894
+ return _regeneratorRuntime.wrap(function _callee41$(_context41) {
7690
7895
  while (1) {
7691
- switch (_context40.prev = _context40.next) {
7896
+ switch (_context41.prev = _context41.next) {
7692
7897
  case 0:
7693
- options = _args40.length > 1 && _args40[1] !== undefined ? _args40[1] : {};
7694
- _context40.next = 3;
7898
+ options = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {};
7899
+ _context41.next = 3;
7695
7900
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
7696
7901
  target_user_id: targetID
7697
7902
  }, options));
7698
7903
 
7699
7904
  case 3:
7700
- return _context40.abrupt("return", _context40.sent);
7905
+ return _context41.abrupt("return", _context41.sent);
7701
7906
 
7702
7907
  case 4:
7703
7908
  case "end":
7704
- return _context40.stop();
7909
+ return _context41.stop();
7705
7910
  }
7706
7911
  }
7707
- }, _callee40, this);
7912
+ }, _callee41, this);
7708
7913
  }));
7709
7914
 
7710
- function unflagUser(_x52) {
7915
+ function unflagUser(_x54) {
7711
7916
  return _unflagUser.apply(this, arguments);
7712
7917
  }
7713
7918
 
7714
7919
  return unflagUser;
7715
7920
  }()
7716
7921
  /**
7922
+ * @deprecated use markChannelsRead instead
7923
+ *
7717
7924
  * markAllRead - marks all channels for this user as read
7718
7925
  * @param {MarkAllReadOptions<UserType>} [data]
7719
7926
  *
@@ -7721,32 +7928,41 @@ var StreamChat = /*#__PURE__*/function () {
7721
7928
  */
7722
7929
 
7723
7930
  }, {
7724
- key: "markAllRead",
7725
- value: function () {
7726
- var _markAllRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
7931
+ key: "markChannelsRead",
7932
+ value:
7933
+ /**
7934
+ * markChannelsRead - marks channels read -
7935
+ * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
7936
+ *
7937
+ * @param {MarkChannelsReadOptions <UserType>} [data]
7938
+ *
7939
+ * @return {Promise<APIResponse>}
7940
+ */
7941
+ function () {
7942
+ var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42() {
7727
7943
  var data,
7728
- _args41 = arguments;
7729
- return _regeneratorRuntime.wrap(function _callee41$(_context41) {
7944
+ _args42 = arguments;
7945
+ return _regeneratorRuntime.wrap(function _callee42$(_context42) {
7730
7946
  while (1) {
7731
- switch (_context41.prev = _context41.next) {
7947
+ switch (_context42.prev = _context42.next) {
7732
7948
  case 0:
7733
- data = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
7734
- _context41.next = 3;
7949
+ data = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
7950
+ _context42.next = 3;
7735
7951
  return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
7736
7952
 
7737
7953
  case 3:
7738
7954
  case "end":
7739
- return _context41.stop();
7955
+ return _context42.stop();
7740
7956
  }
7741
7957
  }
7742
- }, _callee41, this);
7958
+ }, _callee42, this);
7743
7959
  }));
7744
7960
 
7745
- function markAllRead() {
7746
- return _markAllRead.apply(this, arguments);
7961
+ function markChannelsRead() {
7962
+ return _markChannelsRead.apply(this, arguments);
7747
7963
  }
7748
7964
 
7749
- return markAllRead;
7965
+ return markChannelsRead;
7750
7966
  }()
7751
7967
  }, {
7752
7968
  key: "createCommand",
@@ -7814,28 +8030,28 @@ var StreamChat = /*#__PURE__*/function () {
7814
8030
  }, {
7815
8031
  key: "translateMessage",
7816
8032
  value: function () {
7817
- var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(messageId, language) {
7818
- return _regeneratorRuntime.wrap(function _callee42$(_context42) {
8033
+ var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(messageId, language) {
8034
+ return _regeneratorRuntime.wrap(function _callee43$(_context43) {
7819
8035
  while (1) {
7820
- switch (_context42.prev = _context42.next) {
8036
+ switch (_context43.prev = _context43.next) {
7821
8037
  case 0:
7822
- _context42.next = 2;
8038
+ _context43.next = 2;
7823
8039
  return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
7824
8040
  language: language
7825
8041
  });
7826
8042
 
7827
8043
  case 2:
7828
- return _context42.abrupt("return", _context42.sent);
8044
+ return _context43.abrupt("return", _context43.sent);
7829
8045
 
7830
8046
  case 3:
7831
8047
  case "end":
7832
- return _context42.stop();
8048
+ return _context43.stop();
7833
8049
  }
7834
8050
  }
7835
- }, _callee42, this);
8051
+ }, _callee43, this);
7836
8052
  }));
7837
8053
 
7838
- function translateMessage(_x53, _x54) {
8054
+ function translateMessage(_x55, _x56) {
7839
8055
  return _translateMessage.apply(this, arguments);
7840
8056
  }
7841
8057
 
@@ -7927,6 +8143,7 @@ var StreamChat = /*#__PURE__*/function () {
7927
8143
  *
7928
8144
  * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
7929
8145
  * @param {string | { id: string }} [userId]
8146
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
7930
8147
  *
7931
8148
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
7932
8149
  */
@@ -7934,14 +8151,14 @@ var StreamChat = /*#__PURE__*/function () {
7934
8151
  }, {
7935
8152
  key: "updateMessage",
7936
8153
  value: function () {
7937
- var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(message, userId) {
8154
+ var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(message, userId, options) {
7938
8155
  var clonedMessage, reservedMessageFields;
7939
- return _regeneratorRuntime.wrap(function _callee43$(_context43) {
8156
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
7940
8157
  while (1) {
7941
- switch (_context43.prev = _context43.next) {
8158
+ switch (_context44.prev = _context44.next) {
7942
8159
  case 0:
7943
8160
  if (message.id) {
7944
- _context43.next = 2;
8161
+ _context44.next = 2;
7945
8162
  break;
7946
8163
  }
7947
8164
 
@@ -7978,23 +8195,23 @@ var StreamChat = /*#__PURE__*/function () {
7978
8195
  });
7979
8196
  }
7980
8197
 
7981
- _context43.next = 10;
7982
- return this.post(this.baseURL + "/messages/".concat(message.id), {
8198
+ _context44.next = 10;
8199
+ return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
7983
8200
  message: clonedMessage
7984
- });
8201
+ }, options));
7985
8202
 
7986
8203
  case 10:
7987
- return _context43.abrupt("return", _context43.sent);
8204
+ return _context44.abrupt("return", _context44.sent);
7988
8205
 
7989
8206
  case 11:
7990
8207
  case "end":
7991
- return _context43.stop();
8208
+ return _context44.stop();
7992
8209
  }
7993
8210
  }
7994
- }, _callee43, this);
8211
+ }, _callee44, this);
7995
8212
  }));
7996
8213
 
7997
- function updateMessage(_x55, _x56) {
8214
+ function updateMessage(_x57, _x58, _x59) {
7998
8215
  return _updateMessage.apply(this, arguments);
7999
8216
  }
8000
8217
 
@@ -8009,20 +8226,22 @@ var StreamChat = /*#__PURE__*/function () {
8009
8226
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
8010
8227
  * @param {string | { id: string }} [userId]
8011
8228
  *
8229
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8230
+ *
8012
8231
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
8013
8232
  */
8014
8233
 
8015
8234
  }, {
8016
8235
  key: "partialUpdateMessage",
8017
8236
  value: function () {
8018
- var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(id, partialMessageObject, userId) {
8237
+ var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(id, partialMessageObject, userId, options) {
8019
8238
  var user;
8020
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
8239
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8021
8240
  while (1) {
8022
- switch (_context44.prev = _context44.next) {
8241
+ switch (_context45.prev = _context45.next) {
8023
8242
  case 0:
8024
8243
  if (id) {
8025
- _context44.next = 2;
8244
+ _context45.next = 2;
8026
8245
  break;
8027
8246
  }
8028
8247
 
@@ -8037,23 +8256,23 @@ var StreamChat = /*#__PURE__*/function () {
8037
8256
  };
8038
8257
  }
8039
8258
 
8040
- _context44.next = 6;
8041
- return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread({}, partialMessageObject), {}, {
8259
+ _context45.next = 6;
8260
+ return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8042
8261
  user: user
8043
8262
  }));
8044
8263
 
8045
8264
  case 6:
8046
- return _context44.abrupt("return", _context44.sent);
8265
+ return _context45.abrupt("return", _context45.sent);
8047
8266
 
8048
8267
  case 7:
8049
8268
  case "end":
8050
- return _context44.stop();
8269
+ return _context45.stop();
8051
8270
  }
8052
8271
  }
8053
- }, _callee44, this);
8272
+ }, _callee45, this);
8054
8273
  }));
8055
8274
 
8056
- function partialUpdateMessage(_x57, _x58, _x59) {
8275
+ function partialUpdateMessage(_x60, _x61, _x62, _x63) {
8057
8276
  return _partialUpdateMessage.apply(this, arguments);
8058
8277
  }
8059
8278
 
@@ -8062,11 +8281,11 @@ var StreamChat = /*#__PURE__*/function () {
8062
8281
  }, {
8063
8282
  key: "deleteMessage",
8064
8283
  value: function () {
8065
- var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(messageID, hardDelete) {
8284
+ var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageID, hardDelete) {
8066
8285
  var params;
8067
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8286
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8068
8287
  while (1) {
8069
- switch (_context45.prev = _context45.next) {
8288
+ switch (_context46.prev = _context46.next) {
8070
8289
  case 0:
8071
8290
  params = {};
8072
8291
 
@@ -8076,21 +8295,21 @@ var StreamChat = /*#__PURE__*/function () {
8076
8295
  };
8077
8296
  }
8078
8297
 
8079
- _context45.next = 4;
8298
+ _context46.next = 4;
8080
8299
  return this.delete(this.baseURL + "/messages/".concat(messageID), params);
8081
8300
 
8082
8301
  case 4:
8083
- return _context45.abrupt("return", _context45.sent);
8302
+ return _context46.abrupt("return", _context46.sent);
8084
8303
 
8085
8304
  case 5:
8086
8305
  case "end":
8087
- return _context45.stop();
8306
+ return _context46.stop();
8088
8307
  }
8089
8308
  }
8090
- }, _callee45, this);
8309
+ }, _callee46, this);
8091
8310
  }));
8092
8311
 
8093
- function deleteMessage(_x60, _x61) {
8312
+ function deleteMessage(_x64, _x65) {
8094
8313
  return _deleteMessage.apply(this, arguments);
8095
8314
  }
8096
8315
 
@@ -8099,26 +8318,26 @@ var StreamChat = /*#__PURE__*/function () {
8099
8318
  }, {
8100
8319
  key: "getMessage",
8101
8320
  value: function () {
8102
- var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageID) {
8103
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8321
+ var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(messageID) {
8322
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
8104
8323
  while (1) {
8105
- switch (_context46.prev = _context46.next) {
8324
+ switch (_context47.prev = _context47.next) {
8106
8325
  case 0:
8107
- _context46.next = 2;
8326
+ _context47.next = 2;
8108
8327
  return this.get(this.baseURL + "/messages/".concat(messageID));
8109
8328
 
8110
8329
  case 2:
8111
- return _context46.abrupt("return", _context46.sent);
8330
+ return _context47.abrupt("return", _context47.sent);
8112
8331
 
8113
8332
  case 3:
8114
8333
  case "end":
8115
- return _context46.stop();
8334
+ return _context47.stop();
8116
8335
  }
8117
8336
  }
8118
- }, _callee46, this);
8337
+ }, _callee47, this);
8119
8338
  }));
8120
8339
 
8121
- function getMessage(_x62) {
8340
+ function getMessage(_x66) {
8122
8341
  return _getMessage.apply(this, arguments);
8123
8342
  }
8124
8343
 
@@ -8127,7 +8346,7 @@ var StreamChat = /*#__PURE__*/function () {
8127
8346
  }, {
8128
8347
  key: "getUserAgent",
8129
8348
  value: function getUserAgent() {
8130
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.2.0");
8349
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.4.1");
8131
8350
  }
8132
8351
  }, {
8133
8352
  key: "setUserAgent",
@@ -8308,28 +8527,28 @@ var StreamChat = /*#__PURE__*/function () {
8308
8527
  }, {
8309
8528
  key: "sendUserCustomEvent",
8310
8529
  value: function () {
8311
- var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(targetUserID, event) {
8312
- return _regeneratorRuntime.wrap(function _callee47$(_context47) {
8530
+ var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(targetUserID, event) {
8531
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
8313
8532
  while (1) {
8314
- switch (_context47.prev = _context47.next) {
8533
+ switch (_context48.prev = _context48.next) {
8315
8534
  case 0:
8316
- _context47.next = 2;
8535
+ _context48.next = 2;
8317
8536
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
8318
8537
  event: event
8319
8538
  });
8320
8539
 
8321
8540
  case 2:
8322
- return _context47.abrupt("return", _context47.sent);
8541
+ return _context48.abrupt("return", _context48.sent);
8323
8542
 
8324
8543
  case 3:
8325
8544
  case "end":
8326
- return _context47.stop();
8545
+ return _context48.stop();
8327
8546
  }
8328
8547
  }
8329
- }, _callee47, this);
8548
+ }, _callee48, this);
8330
8549
  }));
8331
8550
 
8332
- function sendUserCustomEvent(_x63, _x64) {
8551
+ function sendUserCustomEvent(_x67, _x68) {
8333
8552
  return _sendUserCustomEvent.apply(this, arguments);
8334
8553
  }
8335
8554
 
@@ -8392,32 +8611,32 @@ var StreamChat = /*#__PURE__*/function () {
8392
8611
  }, {
8393
8612
  key: "createSegment",
8394
8613
  value: function () {
8395
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(params) {
8614
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(params) {
8396
8615
  var _yield$this$post, segment;
8397
8616
 
8398
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
8617
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
8399
8618
  while (1) {
8400
- switch (_context48.prev = _context48.next) {
8619
+ switch (_context49.prev = _context49.next) {
8401
8620
  case 0:
8402
- _context48.next = 2;
8621
+ _context49.next = 2;
8403
8622
  return this.post(this.baseURL + "/segments", {
8404
8623
  segment: params
8405
8624
  });
8406
8625
 
8407
8626
  case 2:
8408
- _yield$this$post = _context48.sent;
8627
+ _yield$this$post = _context49.sent;
8409
8628
  segment = _yield$this$post.segment;
8410
- return _context48.abrupt("return", segment);
8629
+ return _context49.abrupt("return", segment);
8411
8630
 
8412
8631
  case 5:
8413
8632
  case "end":
8414
- return _context48.stop();
8633
+ return _context49.stop();
8415
8634
  }
8416
8635
  }
8417
- }, _callee48, this);
8636
+ }, _callee49, this);
8418
8637
  }));
8419
8638
 
8420
- function createSegment(_x65) {
8639
+ function createSegment(_x69) {
8421
8640
  return _createSegment.apply(this, arguments);
8422
8641
  }
8423
8642
 
@@ -8434,30 +8653,30 @@ var StreamChat = /*#__PURE__*/function () {
8434
8653
  }, {
8435
8654
  key: "getSegment",
8436
8655
  value: function () {
8437
- var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(id) {
8656
+ var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(id) {
8438
8657
  var _yield$this$get, segment;
8439
8658
 
8440
- return _regeneratorRuntime.wrap(function _callee49$(_context49) {
8659
+ return _regeneratorRuntime.wrap(function _callee50$(_context50) {
8441
8660
  while (1) {
8442
- switch (_context49.prev = _context49.next) {
8661
+ switch (_context50.prev = _context50.next) {
8443
8662
  case 0:
8444
- _context49.next = 2;
8663
+ _context50.next = 2;
8445
8664
  return this.get(this.baseURL + "/segments/".concat(id));
8446
8665
 
8447
8666
  case 2:
8448
- _yield$this$get = _context49.sent;
8667
+ _yield$this$get = _context50.sent;
8449
8668
  segment = _yield$this$get.segment;
8450
- return _context49.abrupt("return", segment);
8669
+ return _context50.abrupt("return", segment);
8451
8670
 
8452
8671
  case 5:
8453
8672
  case "end":
8454
- return _context49.stop();
8673
+ return _context50.stop();
8455
8674
  }
8456
8675
  }
8457
- }, _callee49, this);
8676
+ }, _callee50, this);
8458
8677
  }));
8459
8678
 
8460
- function getSegment(_x66) {
8679
+ function getSegment(_x70) {
8461
8680
  return _getSegment.apply(this, arguments);
8462
8681
  }
8463
8682
 
@@ -8473,30 +8692,30 @@ var StreamChat = /*#__PURE__*/function () {
8473
8692
  }, {
8474
8693
  key: "listSegments",
8475
8694
  value: function () {
8476
- var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(options) {
8695
+ var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(options) {
8477
8696
  var _yield$this$get2, segments;
8478
8697
 
8479
- return _regeneratorRuntime.wrap(function _callee50$(_context50) {
8698
+ return _regeneratorRuntime.wrap(function _callee51$(_context51) {
8480
8699
  while (1) {
8481
- switch (_context50.prev = _context50.next) {
8700
+ switch (_context51.prev = _context51.next) {
8482
8701
  case 0:
8483
- _context50.next = 2;
8702
+ _context51.next = 2;
8484
8703
  return this.get(this.baseURL + "/segments", options);
8485
8704
 
8486
8705
  case 2:
8487
- _yield$this$get2 = _context50.sent;
8706
+ _yield$this$get2 = _context51.sent;
8488
8707
  segments = _yield$this$get2.segments;
8489
- return _context50.abrupt("return", segments);
8708
+ return _context51.abrupt("return", segments);
8490
8709
 
8491
8710
  case 5:
8492
8711
  case "end":
8493
- return _context50.stop();
8712
+ return _context51.stop();
8494
8713
  }
8495
8714
  }
8496
- }, _callee50, this);
8715
+ }, _callee51, this);
8497
8716
  }));
8498
8717
 
8499
- function listSegments(_x67) {
8718
+ function listSegments(_x71) {
8500
8719
  return _listSegments.apply(this, arguments);
8501
8720
  }
8502
8721
 
@@ -8514,32 +8733,32 @@ var StreamChat = /*#__PURE__*/function () {
8514
8733
  }, {
8515
8734
  key: "updateSegment",
8516
8735
  value: function () {
8517
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(id, params) {
8736
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(id, params) {
8518
8737
  var _yield$this$put, segment;
8519
8738
 
8520
- return _regeneratorRuntime.wrap(function _callee51$(_context51) {
8739
+ return _regeneratorRuntime.wrap(function _callee52$(_context52) {
8521
8740
  while (1) {
8522
- switch (_context51.prev = _context51.next) {
8741
+ switch (_context52.prev = _context52.next) {
8523
8742
  case 0:
8524
- _context51.next = 2;
8743
+ _context52.next = 2;
8525
8744
  return this.put(this.baseURL + "/segments/".concat(id), {
8526
8745
  segment: params
8527
8746
  });
8528
8747
 
8529
8748
  case 2:
8530
- _yield$this$put = _context51.sent;
8749
+ _yield$this$put = _context52.sent;
8531
8750
  segment = _yield$this$put.segment;
8532
- return _context51.abrupt("return", segment);
8751
+ return _context52.abrupt("return", segment);
8533
8752
 
8534
8753
  case 5:
8535
8754
  case "end":
8536
- return _context51.stop();
8755
+ return _context52.stop();
8537
8756
  }
8538
8757
  }
8539
- }, _callee51, this);
8758
+ }, _callee52, this);
8540
8759
  }));
8541
8760
 
8542
- function updateSegment(_x68, _x69) {
8761
+ function updateSegment(_x72, _x73) {
8543
8762
  return _updateSegment.apply(this, arguments);
8544
8763
  }
8545
8764
 
@@ -8556,22 +8775,22 @@ var StreamChat = /*#__PURE__*/function () {
8556
8775
  }, {
8557
8776
  key: "deleteSegment",
8558
8777
  value: function () {
8559
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(id) {
8560
- return _regeneratorRuntime.wrap(function _callee52$(_context52) {
8778
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(id) {
8779
+ return _regeneratorRuntime.wrap(function _callee53$(_context53) {
8561
8780
  while (1) {
8562
- switch (_context52.prev = _context52.next) {
8781
+ switch (_context53.prev = _context53.next) {
8563
8782
  case 0:
8564
- return _context52.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
8783
+ return _context53.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
8565
8784
 
8566
8785
  case 1:
8567
8786
  case "end":
8568
- return _context52.stop();
8787
+ return _context53.stop();
8569
8788
  }
8570
8789
  }
8571
- }, _callee52, this);
8790
+ }, _callee53, this);
8572
8791
  }));
8573
8792
 
8574
- function deleteSegment(_x70) {
8793
+ function deleteSegment(_x74) {
8575
8794
  return _deleteSegment.apply(this, arguments);
8576
8795
  }
8577
8796
 
@@ -8588,32 +8807,32 @@ var StreamChat = /*#__PURE__*/function () {
8588
8807
  }, {
8589
8808
  key: "createCampaign",
8590
8809
  value: function () {
8591
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(params) {
8810
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(params) {
8592
8811
  var _yield$this$post2, campaign;
8593
8812
 
8594
- return _regeneratorRuntime.wrap(function _callee53$(_context53) {
8813
+ return _regeneratorRuntime.wrap(function _callee54$(_context54) {
8595
8814
  while (1) {
8596
- switch (_context53.prev = _context53.next) {
8815
+ switch (_context54.prev = _context54.next) {
8597
8816
  case 0:
8598
- _context53.next = 2;
8817
+ _context54.next = 2;
8599
8818
  return this.post(this.baseURL + "/campaigns", {
8600
8819
  campaign: params
8601
8820
  });
8602
8821
 
8603
8822
  case 2:
8604
- _yield$this$post2 = _context53.sent;
8823
+ _yield$this$post2 = _context54.sent;
8605
8824
  campaign = _yield$this$post2.campaign;
8606
- return _context53.abrupt("return", campaign);
8825
+ return _context54.abrupt("return", campaign);
8607
8826
 
8608
8827
  case 5:
8609
8828
  case "end":
8610
- return _context53.stop();
8829
+ return _context54.stop();
8611
8830
  }
8612
8831
  }
8613
- }, _callee53, this);
8832
+ }, _callee54, this);
8614
8833
  }));
8615
8834
 
8616
- function createCampaign(_x71) {
8835
+ function createCampaign(_x75) {
8617
8836
  return _createCampaign.apply(this, arguments);
8618
8837
  }
8619
8838
 
@@ -8630,30 +8849,30 @@ var StreamChat = /*#__PURE__*/function () {
8630
8849
  }, {
8631
8850
  key: "getCampaign",
8632
8851
  value: function () {
8633
- var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(id) {
8852
+ var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(id) {
8634
8853
  var _yield$this$get3, campaign;
8635
8854
 
8636
- return _regeneratorRuntime.wrap(function _callee54$(_context54) {
8855
+ return _regeneratorRuntime.wrap(function _callee55$(_context55) {
8637
8856
  while (1) {
8638
- switch (_context54.prev = _context54.next) {
8857
+ switch (_context55.prev = _context55.next) {
8639
8858
  case 0:
8640
- _context54.next = 2;
8859
+ _context55.next = 2;
8641
8860
  return this.get(this.baseURL + "/campaigns/".concat(id));
8642
8861
 
8643
8862
  case 2:
8644
- _yield$this$get3 = _context54.sent;
8863
+ _yield$this$get3 = _context55.sent;
8645
8864
  campaign = _yield$this$get3.campaign;
8646
- return _context54.abrupt("return", campaign);
8865
+ return _context55.abrupt("return", campaign);
8647
8866
 
8648
8867
  case 5:
8649
8868
  case "end":
8650
- return _context54.stop();
8869
+ return _context55.stop();
8651
8870
  }
8652
8871
  }
8653
- }, _callee54, this);
8872
+ }, _callee55, this);
8654
8873
  }));
8655
8874
 
8656
- function getCampaign(_x72) {
8875
+ function getCampaign(_x76) {
8657
8876
  return _getCampaign.apply(this, arguments);
8658
8877
  }
8659
8878
 
@@ -8669,30 +8888,30 @@ var StreamChat = /*#__PURE__*/function () {
8669
8888
  }, {
8670
8889
  key: "listCampaigns",
8671
8890
  value: function () {
8672
- var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(options) {
8891
+ var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(options) {
8673
8892
  var _yield$this$get4, campaigns;
8674
8893
 
8675
- return _regeneratorRuntime.wrap(function _callee55$(_context55) {
8894
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
8676
8895
  while (1) {
8677
- switch (_context55.prev = _context55.next) {
8896
+ switch (_context56.prev = _context56.next) {
8678
8897
  case 0:
8679
- _context55.next = 2;
8898
+ _context56.next = 2;
8680
8899
  return this.get(this.baseURL + "/campaigns", options);
8681
8900
 
8682
8901
  case 2:
8683
- _yield$this$get4 = _context55.sent;
8902
+ _yield$this$get4 = _context56.sent;
8684
8903
  campaigns = _yield$this$get4.campaigns;
8685
- return _context55.abrupt("return", campaigns);
8904
+ return _context56.abrupt("return", campaigns);
8686
8905
 
8687
8906
  case 5:
8688
8907
  case "end":
8689
- return _context55.stop();
8908
+ return _context56.stop();
8690
8909
  }
8691
8910
  }
8692
- }, _callee55, this);
8911
+ }, _callee56, this);
8693
8912
  }));
8694
8913
 
8695
- function listCampaigns(_x73) {
8914
+ function listCampaigns(_x77) {
8696
8915
  return _listCampaigns.apply(this, arguments);
8697
8916
  }
8698
8917
 
@@ -8710,32 +8929,32 @@ var StreamChat = /*#__PURE__*/function () {
8710
8929
  }, {
8711
8930
  key: "updateCampaign",
8712
8931
  value: function () {
8713
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(id, params) {
8932
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id, params) {
8714
8933
  var _yield$this$put2, campaign;
8715
8934
 
8716
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
8935
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
8717
8936
  while (1) {
8718
- switch (_context56.prev = _context56.next) {
8937
+ switch (_context57.prev = _context57.next) {
8719
8938
  case 0:
8720
- _context56.next = 2;
8939
+ _context57.next = 2;
8721
8940
  return this.put(this.baseURL + "/campaigns/".concat(id), {
8722
8941
  campaign: params
8723
8942
  });
8724
8943
 
8725
8944
  case 2:
8726
- _yield$this$put2 = _context56.sent;
8945
+ _yield$this$put2 = _context57.sent;
8727
8946
  campaign = _yield$this$put2.campaign;
8728
- return _context56.abrupt("return", campaign);
8947
+ return _context57.abrupt("return", campaign);
8729
8948
 
8730
8949
  case 5:
8731
8950
  case "end":
8732
- return _context56.stop();
8951
+ return _context57.stop();
8733
8952
  }
8734
8953
  }
8735
- }, _callee56, this);
8954
+ }, _callee57, this);
8736
8955
  }));
8737
8956
 
8738
- function updateCampaign(_x74, _x75) {
8957
+ function updateCampaign(_x78, _x79) {
8739
8958
  return _updateCampaign.apply(this, arguments);
8740
8959
  }
8741
8960
 
@@ -8752,22 +8971,22 @@ var StreamChat = /*#__PURE__*/function () {
8752
8971
  }, {
8753
8972
  key: "deleteCampaign",
8754
8973
  value: function () {
8755
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id) {
8756
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
8974
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id) {
8975
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
8757
8976
  while (1) {
8758
- switch (_context57.prev = _context57.next) {
8977
+ switch (_context58.prev = _context58.next) {
8759
8978
  case 0:
8760
- return _context57.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
8979
+ return _context58.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
8761
8980
 
8762
8981
  case 1:
8763
8982
  case "end":
8764
- return _context57.stop();
8983
+ return _context58.stop();
8765
8984
  }
8766
8985
  }
8767
- }, _callee57, this);
8986
+ }, _callee58, this);
8768
8987
  }));
8769
8988
 
8770
- function deleteCampaign(_x76) {
8989
+ function deleteCampaign(_x80) {
8771
8990
  return _deleteCampaign.apply(this, arguments);
8772
8991
  }
8773
8992
 
@@ -8785,33 +9004,33 @@ var StreamChat = /*#__PURE__*/function () {
8785
9004
  }, {
8786
9005
  key: "scheduleCampaign",
8787
9006
  value: function () {
8788
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id, params) {
9007
+ var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(id, params) {
8789
9008
  var sendAt, _yield$this$patch, campaign;
8790
9009
 
8791
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
9010
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
8792
9011
  while (1) {
8793
- switch (_context58.prev = _context58.next) {
9012
+ switch (_context59.prev = _context59.next) {
8794
9013
  case 0:
8795
9014
  sendAt = params.sendAt;
8796
- _context58.next = 3;
9015
+ _context59.next = 3;
8797
9016
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
8798
9017
  send_at: sendAt
8799
9018
  });
8800
9019
 
8801
9020
  case 3:
8802
- _yield$this$patch = _context58.sent;
9021
+ _yield$this$patch = _context59.sent;
8803
9022
  campaign = _yield$this$patch.campaign;
8804
- return _context58.abrupt("return", campaign);
9023
+ return _context59.abrupt("return", campaign);
8805
9024
 
8806
9025
  case 6:
8807
9026
  case "end":
8808
- return _context58.stop();
9027
+ return _context59.stop();
8809
9028
  }
8810
9029
  }
8811
- }, _callee58, this);
9030
+ }, _callee59, this);
8812
9031
  }));
8813
9032
 
8814
- function scheduleCampaign(_x77, _x78) {
9033
+ function scheduleCampaign(_x81, _x82) {
8815
9034
  return _scheduleCampaign.apply(this, arguments);
8816
9035
  }
8817
9036
 
@@ -8828,30 +9047,30 @@ var StreamChat = /*#__PURE__*/function () {
8828
9047
  }, {
8829
9048
  key: "stopCampaign",
8830
9049
  value: function () {
8831
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(id) {
9050
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
8832
9051
  var _yield$this$patch2, campaign;
8833
9052
 
8834
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
9053
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
8835
9054
  while (1) {
8836
- switch (_context59.prev = _context59.next) {
9055
+ switch (_context60.prev = _context60.next) {
8837
9056
  case 0:
8838
- _context59.next = 2;
9057
+ _context60.next = 2;
8839
9058
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
8840
9059
 
8841
9060
  case 2:
8842
- _yield$this$patch2 = _context59.sent;
9061
+ _yield$this$patch2 = _context60.sent;
8843
9062
  campaign = _yield$this$patch2.campaign;
8844
- return _context59.abrupt("return", campaign);
9063
+ return _context60.abrupt("return", campaign);
8845
9064
 
8846
9065
  case 5:
8847
9066
  case "end":
8848
- return _context59.stop();
9067
+ return _context60.stop();
8849
9068
  }
8850
9069
  }
8851
- }, _callee59, this);
9070
+ }, _callee60, this);
8852
9071
  }));
8853
9072
 
8854
- function stopCampaign(_x79) {
9073
+ function stopCampaign(_x83) {
8855
9074
  return _stopCampaign.apply(this, arguments);
8856
9075
  }
8857
9076
 
@@ -8868,30 +9087,30 @@ var StreamChat = /*#__PURE__*/function () {
8868
9087
  }, {
8869
9088
  key: "resumeCampaign",
8870
9089
  value: function () {
8871
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
9090
+ var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id) {
8872
9091
  var _yield$this$patch3, campaign;
8873
9092
 
8874
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
9093
+ return _regeneratorRuntime.wrap(function _callee61$(_context61) {
8875
9094
  while (1) {
8876
- switch (_context60.prev = _context60.next) {
9095
+ switch (_context61.prev = _context61.next) {
8877
9096
  case 0:
8878
- _context60.next = 2;
9097
+ _context61.next = 2;
8879
9098
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
8880
9099
 
8881
9100
  case 2:
8882
- _yield$this$patch3 = _context60.sent;
9101
+ _yield$this$patch3 = _context61.sent;
8883
9102
  campaign = _yield$this$patch3.campaign;
8884
- return _context60.abrupt("return", campaign);
9103
+ return _context61.abrupt("return", campaign);
8885
9104
 
8886
9105
  case 5:
8887
9106
  case "end":
8888
- return _context60.stop();
9107
+ return _context61.stop();
8889
9108
  }
8890
9109
  }
8891
- }, _callee60, this);
9110
+ }, _callee61, this);
8892
9111
  }));
8893
9112
 
8894
- function resumeCampaign(_x80) {
9113
+ function resumeCampaign(_x84) {
8895
9114
  return _resumeCampaign.apply(this, arguments);
8896
9115
  }
8897
9116
 
@@ -8908,38 +9127,208 @@ var StreamChat = /*#__PURE__*/function () {
8908
9127
  }, {
8909
9128
  key: "testCampaign",
8910
9129
  value: function () {
8911
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id, params) {
9130
+ var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id, params) {
8912
9131
  var users, _yield$this$post3, campaign;
8913
9132
 
8914
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
9133
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
8915
9134
  while (1) {
8916
- switch (_context61.prev = _context61.next) {
9135
+ switch (_context62.prev = _context62.next) {
8917
9136
  case 0:
8918
9137
  users = params.users;
8919
- _context61.next = 3;
9138
+ _context62.next = 3;
8920
9139
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
8921
9140
  users: users
8922
9141
  });
8923
9142
 
8924
9143
  case 3:
8925
- _yield$this$post3 = _context61.sent;
9144
+ _yield$this$post3 = _context62.sent;
8926
9145
  campaign = _yield$this$post3.campaign;
8927
- return _context61.abrupt("return", campaign);
9146
+ return _context62.abrupt("return", campaign);
8928
9147
 
8929
9148
  case 6:
8930
9149
  case "end":
8931
- return _context61.stop();
9150
+ return _context62.stop();
8932
9151
  }
8933
9152
  }
8934
- }, _callee61, this);
9153
+ }, _callee62, this);
8935
9154
  }));
8936
9155
 
8937
- function testCampaign(_x81, _x82) {
9156
+ function testCampaign(_x85, _x86) {
8938
9157
  return _testCampaign.apply(this, arguments);
8939
9158
  }
8940
9159
 
8941
9160
  return testCampaign;
8942
9161
  }()
9162
+ /**
9163
+ * enrichURL - Get OpenGraph data of the given link
9164
+ *
9165
+ * @param {string} url link
9166
+ * @return {OGAttachment} OG Attachment
9167
+ */
9168
+
9169
+ }, {
9170
+ key: "enrichURL",
9171
+ value: function () {
9172
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(url) {
9173
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
9174
+ while (1) {
9175
+ switch (_context63.prev = _context63.next) {
9176
+ case 0:
9177
+ return _context63.abrupt("return", this.get(this.baseURL + "/og", {
9178
+ url: url
9179
+ }));
9180
+
9181
+ case 1:
9182
+ case "end":
9183
+ return _context63.stop();
9184
+ }
9185
+ }
9186
+ }, _callee63, this);
9187
+ }));
9188
+
9189
+ function enrichURL(_x87) {
9190
+ return _enrichURL.apply(this, arguments);
9191
+ }
9192
+
9193
+ return enrichURL;
9194
+ }()
9195
+ /**
9196
+ * getTask - Gets status of a long running task
9197
+ *
9198
+ * @param {string} id Task ID
9199
+ *
9200
+ * @return {TaskStatus} The task status
9201
+ */
9202
+
9203
+ }, {
9204
+ key: "getTask",
9205
+ value: function () {
9206
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id) {
9207
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9208
+ while (1) {
9209
+ switch (_context64.prev = _context64.next) {
9210
+ case 0:
9211
+ return _context64.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9212
+
9213
+ case 1:
9214
+ case "end":
9215
+ return _context64.stop();
9216
+ }
9217
+ }
9218
+ }, _callee64, this);
9219
+ }));
9220
+
9221
+ function getTask(_x88) {
9222
+ return _getTask.apply(this, arguments);
9223
+ }
9224
+
9225
+ return getTask;
9226
+ }()
9227
+ /**
9228
+ * deleteChannels - Deletes a list of channel
9229
+ *
9230
+ * @param {string[]} cids Channel CIDs
9231
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
9232
+ *
9233
+ * @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well
9234
+ */
9235
+
9236
+ }, {
9237
+ key: "deleteChannels",
9238
+ value: function () {
9239
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(cids) {
9240
+ var options,
9241
+ _args65 = arguments;
9242
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9243
+ while (1) {
9244
+ switch (_context65.prev = _context65.next) {
9245
+ case 0:
9246
+ options = _args65.length > 1 && _args65[1] !== undefined ? _args65[1] : {};
9247
+ _context65.next = 3;
9248
+ return this.post(this.baseURL + "/channels/delete", _objectSpread({
9249
+ cids: cids
9250
+ }, options));
9251
+
9252
+ case 3:
9253
+ return _context65.abrupt("return", _context65.sent);
9254
+
9255
+ case 4:
9256
+ case "end":
9257
+ return _context65.stop();
9258
+ }
9259
+ }
9260
+ }, _callee65, this);
9261
+ }));
9262
+
9263
+ function deleteChannels(_x89) {
9264
+ return _deleteChannels.apply(this, arguments);
9265
+ }
9266
+
9267
+ return deleteChannels;
9268
+ }()
9269
+ }, {
9270
+ key: "deleteUsers",
9271
+ value:
9272
+ /**
9273
+ * deleteUsers - Batch Delete Users
9274
+ *
9275
+ * @param {string[]} user_ids which users to delete
9276
+ * @param {DeleteUserOptions} options Configuration how to delete users
9277
+ *
9278
+ * @return {APIResponse} A task ID
9279
+ */
9280
+ function () {
9281
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(user_ids, options) {
9282
+ return _regeneratorRuntime.wrap(function _callee66$(_context66) {
9283
+ while (1) {
9284
+ switch (_context66.prev = _context66.next) {
9285
+ case 0:
9286
+ if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
9287
+ _context66.next = 2;
9288
+ break;
9289
+ }
9290
+
9291
+ throw new Error('Invalid delete user options. user must be one of [soft hard]');
9292
+
9293
+ case 2:
9294
+ if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
9295
+ _context66.next = 4;
9296
+ break;
9297
+ }
9298
+
9299
+ throw new Error('Invalid delete user options. messages must be one of [soft hard]');
9300
+
9301
+ case 4:
9302
+ if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
9303
+ _context66.next = 6;
9304
+ break;
9305
+ }
9306
+
9307
+ throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
9308
+
9309
+ case 6:
9310
+ _context66.next = 8;
9311
+ return this.post(this.baseURL + "/users/delete", _objectSpread({
9312
+ user_ids: user_ids
9313
+ }, options));
9314
+
9315
+ case 8:
9316
+ return _context66.abrupt("return", _context66.sent);
9317
+
9318
+ case 9:
9319
+ case "end":
9320
+ return _context66.stop();
9321
+ }
9322
+ }
9323
+ }, _callee66, this);
9324
+ }));
9325
+
9326
+ function deleteUsers(_x90, _x91) {
9327
+ return _deleteUsers.apply(this, arguments);
9328
+ }
9329
+
9330
+ return deleteUsers;
9331
+ }()
8943
9332
  }], [{
8944
9333
  key: "getInstance",
8945
9334
  value: function getInstance(key, secretOrOptions, options) {
@@ -9034,5 +9423,5 @@ var BuiltinPermissions = {
9034
9423
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
9035
9424
  };
9036
9425
 
9037
- 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 };
9426
+ 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 };
9038
9427
  //# sourceMappingURL=browser.es.js.map