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