stream-chat 4.1.0 → 4.4.0

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