stream-chat 8.14.5 → 8.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -94,9 +94,347 @@ var decodeBase64 = function decodeBase64(s) {
94
94
  return r;
95
95
  };
96
96
 
97
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
97
+ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
98
98
 
99
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
99
+ function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
100
+
101
+ function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
102
+
103
+ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
104
+
105
+ function _arrayLikeToArray$4(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; }
106
+
107
+ /**
108
+ * logChatPromiseExecution - utility function for logging the execution of a promise..
109
+ * use this when you want to run the promise and handle errors by logging a warning
110
+ *
111
+ * @param {Promise<T>} promise The promise you want to run and log
112
+ * @param {string} name A descriptive name of what the promise does for log output
113
+ *
114
+ */
115
+ function logChatPromiseExecution(promise, name) {
116
+ promise.then().catch(function (error) {
117
+ console.warn("failed to do ".concat(name, ", ran into error: "), error);
118
+ });
119
+ }
120
+ var sleep = function sleep(m) {
121
+ return new Promise(function (r) {
122
+ return setTimeout(r, m);
123
+ });
124
+ };
125
+ function isFunction(value) {
126
+ return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
127
+ }
128
+ var chatCodes = {
129
+ TOKEN_EXPIRED: 40,
130
+ WS_CLOSED_SUCCESS: 1000
131
+ };
132
+
133
+ function isReadableStream(obj) {
134
+ return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
135
+ }
136
+
137
+ function isBuffer(obj) {
138
+ return obj != null && obj.constructor != null && // @ts-expect-error
139
+ typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
140
+ obj.constructor.isBuffer(obj);
141
+ }
142
+
143
+ function isFileWebAPI(uri) {
144
+ return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
145
+ }
146
+
147
+ function isOwnUser(user) {
148
+ return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
149
+ }
150
+
151
+ function isBlobWebAPI(uri) {
152
+ return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
153
+ }
154
+
155
+ function isOwnUserBaseProperty(property) {
156
+ var ownUserBaseProperties = {
157
+ channel_mutes: true,
158
+ devices: true,
159
+ mutes: true,
160
+ total_unread_count: true,
161
+ unread_channels: true,
162
+ unread_count: true,
163
+ invisible: true,
164
+ roles: true
165
+ };
166
+ return ownUserBaseProperties[property];
167
+ }
168
+ function addFileToFormData(uri, name, contentType) {
169
+ var data = new FormData();
170
+
171
+ if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
172
+ if (name) data.append('file', uri, name);else data.append('file', uri);
173
+ } else {
174
+ data.append('file', {
175
+ uri: uri,
176
+ name: name || uri.split('/').reverse()[0],
177
+ contentType: contentType || undefined,
178
+ type: contentType || undefined
179
+ });
180
+ }
181
+
182
+ return data;
183
+ }
184
+ function normalizeQuerySort(sort) {
185
+ var sortFields = [];
186
+ var sortArr = Array.isArray(sort) ? sort : [sort];
187
+
188
+ var _iterator = _createForOfIteratorHelper$4(sortArr),
189
+ _step;
190
+
191
+ try {
192
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
193
+ var item = _step.value;
194
+ var entries = Object.entries(item);
195
+
196
+ if (entries.length > 1) {
197
+ console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
198
+ }
199
+
200
+ for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
201
+ var _entries$_i = _slicedToArray(_entries[_i], 2),
202
+ field = _entries$_i[0],
203
+ direction = _entries$_i[1];
204
+
205
+ sortFields.push({
206
+ field: field,
207
+ direction: direction
208
+ });
209
+ }
210
+ }
211
+ } catch (err) {
212
+ _iterator.e(err);
213
+ } finally {
214
+ _iterator.f();
215
+ }
216
+
217
+ return sortFields;
218
+ }
219
+ /**
220
+ * retryInterval - A retry interval which increases acc to number of failures
221
+ *
222
+ * @return {number} Duration to wait in milliseconds
223
+ */
224
+
225
+ function retryInterval(numberOfFailures) {
226
+ // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
227
+ var max = Math.min(500 + numberOfFailures * 2000, 25000);
228
+ var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
229
+ return Math.floor(Math.random() * (max - min) + min);
230
+ }
231
+ function randomId() {
232
+ return generateUUIDv4();
233
+ }
234
+
235
+ function hex(bytes) {
236
+ var s = '';
237
+
238
+ for (var i = 0; i < bytes.length; i++) {
239
+ s += bytes[i].toString(16).padStart(2, '0');
240
+ }
241
+
242
+ return s;
243
+ } // https://tools.ietf.org/html/rfc4122
244
+
245
+
246
+ function generateUUIDv4() {
247
+ var bytes = getRandomBytes(16);
248
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
249
+
250
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
251
+
252
+ 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));
253
+ }
254
+
255
+ function getRandomValuesWithMathRandom(bytes) {
256
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
257
+
258
+ for (var i = 0; i < bytes.length; i++) {
259
+ bytes[i] = Math.random() * max;
260
+ }
261
+ }
262
+
263
+ var getRandomValues = function () {
264
+ var _crypto;
265
+
266
+ if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
267
+ return crypto.getRandomValues.bind(crypto);
268
+ } else if (typeof msCrypto !== 'undefined') {
269
+ return msCrypto.getRandomValues.bind(msCrypto);
270
+ } else {
271
+ return getRandomValuesWithMathRandom;
272
+ }
273
+ }();
274
+
275
+ function getRandomBytes(length) {
276
+ var bytes = new Uint8Array(length);
277
+ getRandomValues(bytes);
278
+ return bytes;
279
+ }
280
+
281
+ function convertErrorToJson(err) {
282
+ var jsonObj = {};
283
+ if (!err) return jsonObj;
284
+
285
+ try {
286
+ Object.getOwnPropertyNames(err).forEach(function (key) {
287
+ jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
288
+ });
289
+ } catch (_) {
290
+ return {
291
+ error: 'failed to serialize the error'
292
+ };
293
+ }
294
+
295
+ return jsonObj;
296
+ }
297
+ /**
298
+ * isOnline safely return the navigator.online value for browser env
299
+ * if navigator is not in global object, it always return true
300
+ */
301
+
302
+ function isOnline() {
303
+ var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
304
+
305
+ if (!nav) {
306
+ console.warn('isOnline failed to access window.navigator and assume browser is online');
307
+ return true;
308
+ } // RN navigator has undefined for onLine
309
+
310
+
311
+ if (typeof nav.onLine !== 'boolean') {
312
+ return true;
313
+ }
314
+
315
+ return nav.onLine;
316
+ }
317
+ /**
318
+ * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
319
+ */
320
+
321
+ function addConnectionEventListeners(cb) {
322
+ if (typeof window !== 'undefined' && window.addEventListener) {
323
+ window.addEventListener('offline', cb);
324
+ window.addEventListener('online', cb);
325
+ }
326
+ }
327
+ function removeConnectionEventListeners(cb) {
328
+ if (typeof window !== 'undefined' && window.removeEventListener) {
329
+ window.removeEventListener('offline', cb);
330
+ window.removeEventListener('online', cb);
331
+ }
332
+ }
333
+ var axiosParamsSerializer = function axiosParamsSerializer(params) {
334
+ var newParams = [];
335
+
336
+ for (var k in params) {
337
+ // Stream backend doesn't treat "undefined" value same as value not being present.
338
+ // So, we need to skip the undefined values.
339
+ if (params[k] === undefined) continue;
340
+
341
+ if (Array.isArray(params[k]) || _typeof(params[k]) === 'object') {
342
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
343
+ } else {
344
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
345
+ }
346
+ }
347
+
348
+ return newParams.join('&');
349
+ };
350
+ /**
351
+ * formatMessage - Takes the message object. Parses the dates, sets __html
352
+ * and sets the status to received if missing. Returns a message object
353
+ *
354
+ * @param {MessageResponse<StreamChatGenerics>} message a message object
355
+ *
356
+ */
357
+
358
+ function formatMessage(message) {
359
+ return _objectSpread$8(_objectSpread$8({}, message), {}, {
360
+ /**
361
+ * @deprecated please use `html`
362
+ */
363
+ __html: message.html,
364
+ // parse the date..
365
+ pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
366
+ created_at: message.created_at ? new Date(message.created_at) : new Date(),
367
+ updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
368
+ status: message.status || 'received'
369
+ });
370
+ }
371
+ function addToMessageList(messages, message) {
372
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
373
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
374
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
375
+ var addMessageToList = addIfDoesNotExist || timestampChanged;
376
+ var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
377
+ // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
378
+
379
+ if (timestampChanged) {
380
+ messageArr = messageArr.filter(function (msg) {
381
+ return !(msg.id && message.id === msg.id);
382
+ });
383
+ } // Get array length after filtering
384
+
385
+
386
+ var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
387
+
388
+ if (messageArrayLength === 0 && addMessageToList) {
389
+ return messageArr.concat(message);
390
+ } else if (messageArrayLength === 0) {
391
+ return _toConsumableArray(messageArr);
392
+ }
393
+
394
+ var messageTime = message[sortBy].getTime();
395
+ var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
396
+
397
+ if (messageIsNewest && addMessageToList) {
398
+ return messageArr.concat(message);
399
+ } else if (messageIsNewest) {
400
+ return _toConsumableArray(messageArr);
401
+ } // find the closest index to push the new message
402
+
403
+
404
+ var left = 0;
405
+ var middle = 0;
406
+ var right = messageArrayLength - 1;
407
+
408
+ while (left <= right) {
409
+ middle = Math.floor((right + left) / 2);
410
+ if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
411
+ } // message already exists and not filtered due to timestampChanged, update and return
412
+
413
+
414
+ if (!timestampChanged && message.id) {
415
+ if (messageArr[left] && message.id === messageArr[left].id) {
416
+ messageArr[left] = message;
417
+ return _toConsumableArray(messageArr);
418
+ }
419
+
420
+ if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
421
+ messageArr[left - 1] = message;
422
+ return _toConsumableArray(messageArr);
423
+ }
424
+ } // Do not add updated or deleted messages to the list if they do not already exist
425
+ // or have a timestamp change.
426
+
427
+
428
+ if (addMessageToList) {
429
+ messageArr.splice(left, 0, message);
430
+ }
431
+
432
+ return _toConsumableArray(messageArr);
433
+ }
434
+
435
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
436
+
437
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
100
438
 
101
439
  /**
102
440
  * ChannelState - A container class for the channel state.
@@ -173,7 +511,7 @@ var ChannelState = /*#__PURE__*/function () {
173
511
  var m = messages[i];
174
512
 
175
513
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
176
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
514
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
177
515
  user: user
178
516
  });
179
517
  }
@@ -228,7 +566,7 @@ var ChannelState = /*#__PURE__*/function () {
228
566
  user: m.user
229
567
  };
230
568
  } else {
231
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
569
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
232
570
  type: 'deleted',
233
571
  deleted_at: user.deleted_at
234
572
  });
@@ -335,7 +673,7 @@ var ChannelState = /*#__PURE__*/function () {
335
673
  }, {
336
674
  key: "formatMessage",
337
675
  value: function formatMessage(message) {
338
- return _objectSpread$6(_objectSpread$6({}, message), {}, {
676
+ return _objectSpread$7(_objectSpread$7({}, message), {}, {
339
677
  /**
340
678
  * @deprecated please use `html`
341
679
  */
@@ -553,7 +891,7 @@ var ChannelState = /*#__PURE__*/function () {
553
891
  var parseMessage = function parseMessage(m) {
554
892
  var _m$pinned_at, _m$updated_at;
555
893
 
556
- return _objectSpread$6(_objectSpread$6({}, m), {}, {
894
+ return _objectSpread$7(_objectSpread$7({}, m), {}, {
557
895
  created_at: m.created_at.toISOString(),
558
896
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
559
897
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
@@ -564,8 +902,8 @@ var ChannelState = /*#__PURE__*/function () {
564
902
  var updatedMessages = set.messages.filter(function (msg) {
565
903
  return msg.quoted_message_id === message.id;
566
904
  }).map(parseMessage).map(function (msg) {
567
- return _objectSpread$6(_objectSpread$6({}, msg), {}, {
568
- quoted_message: _objectSpread$6(_objectSpread$6({}, message), {}, {
905
+ return _objectSpread$7(_objectSpread$7({}, msg), {}, {
906
+ quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
569
907
  attachments: []
570
908
  })
571
909
  });
@@ -646,66 +984,9 @@ var ChannelState = /*#__PURE__*/function () {
646
984
  */
647
985
  function _addToMessageList(messages, message) {
648
986
  var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
649
- var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
650
- var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
651
- var addMessageToList = addIfDoesNotExist || timestampChanged;
652
- var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
653
- // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
654
-
655
- if (timestampChanged) {
656
- messageArr = messageArr.filter(function (msg) {
657
- return !(msg.id && message.id === msg.id);
658
- });
659
- } // Get array length after filtering
660
-
661
-
662
- var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
663
-
664
- if (messageArrayLength === 0 && addMessageToList) {
665
- return messageArr.concat(message);
666
- } else if (messageArrayLength === 0) {
667
- return _toConsumableArray(messageArr);
668
- }
669
-
670
- var messageTime = message[sortBy].getTime();
671
- var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
672
-
673
- if (messageIsNewest && addMessageToList) {
674
- return messageArr.concat(message);
675
- } else if (messageIsNewest) {
676
- return _toConsumableArray(messageArr);
677
- } // find the closest index to push the new message
678
-
679
-
680
- var left = 0;
681
- var middle = 0;
682
- var right = messageArrayLength - 1;
683
-
684
- while (left <= right) {
685
- middle = Math.floor((right + left) / 2);
686
- if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
687
- } // message already exists and not filtered due to timestampChanged, update and return
688
-
689
-
690
- if (!timestampChanged && message.id) {
691
- if (messageArr[left] && message.id === messageArr[left].id) {
692
- messageArr[left] = message;
693
- return _toConsumableArray(messageArr);
694
- }
695
-
696
- if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
697
- messageArr[left - 1] = message;
698
- return _toConsumableArray(messageArr);
699
- }
700
- } // Do not add updated or deleted messages to the list if they do not already exist
701
- // or have a timestamp change.
702
-
703
-
704
- if (addMessageToList) {
705
- messageArr.splice(left, 0, message);
706
- }
707
-
708
- return _toConsumableArray(messageArr);
987
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
988
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
989
+ return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
709
990
  }
710
991
  /**
711
992
  * removeMessage - Description
@@ -1017,328 +1298,78 @@ var ChannelState = /*#__PURE__*/function () {
1017
1298
  isLatest: false
1018
1299
  });
1019
1300
  targetMessageSetIndex = this.messageSets.length - 1;
1020
- }
1021
-
1022
- break;
1023
-
1024
- case 'current':
1025
- targetMessageSetIndex = this.messageSets.findIndex(function (s) {
1026
- return s.isCurrent;
1027
- });
1028
- break;
1029
-
1030
- case 'latest':
1031
- targetMessageSetIndex = this.messageSets.findIndex(function (s) {
1032
- return s.isLatest;
1033
- });
1034
- break;
1035
-
1036
- default:
1037
- targetMessageSetIndex = -1;
1038
- } // when merging the target set will be the first one from the overlapping message sets
1039
-
1040
-
1041
- var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
1042
-
1043
- var mergeSourceMessageSetIndices = _toConsumableArray(overlappingMessageSetIndices);
1044
-
1045
- if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
1046
- mergeSourceMessageSetIndices.push(targetMessageSetIndex);
1047
- } // merge message sets
1048
-
1049
-
1050
- if (mergeSourceMessageSetIndices.length > 0) {
1051
- var target = this.messageSets[mergeTargetMessageSetIndex];
1052
- var sources = this.messageSets.filter(function (_, i) {
1053
- return mergeSourceMessageSetIndices.indexOf(i) !== -1;
1054
- });
1055
- sources.forEach(function (messageSet) {
1056
- target.isLatest = target.isLatest || messageSet.isLatest;
1057
- target.isCurrent = target.isCurrent || messageSet.isCurrent;
1058
- messagesToAdd = [].concat(_toConsumableArray(messagesToAdd), _toConsumableArray(messageSet.messages));
1059
- });
1060
- sources.forEach(function (s) {
1061
- return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
1062
- });
1063
- var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
1064
- return _this5.areMessageSetsOverlap(s.messages, newMessages);
1065
- });
1066
- targetMessageSetIndex = overlappingMessageSetIndex;
1067
- }
1068
- } else {
1069
- // assumes that all new messages belong to the same set
1070
- targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
1071
- }
1072
-
1073
- return {
1074
- targetMessageSetIndex: targetMessageSetIndex,
1075
- messagesToAdd: messagesToAdd
1076
- };
1077
- }
1078
- }]);
1079
-
1080
- return ChannelState;
1081
- }();
1082
-
1083
- function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1084
-
1085
- function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1086
-
1087
- function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1088
-
1089
- /**
1090
- * logChatPromiseExecution - utility function for logging the execution of a promise..
1091
- * use this when you want to run the promise and handle errors by logging a warning
1092
- *
1093
- * @param {Promise<T>} promise The promise you want to run and log
1094
- * @param {string} name A descriptive name of what the promise does for log output
1095
- *
1096
- */
1097
- function logChatPromiseExecution(promise, name) {
1098
- promise.then().catch(function (error) {
1099
- console.warn("failed to do ".concat(name, ", ran into error: "), error);
1100
- });
1101
- }
1102
- var sleep = function sleep(m) {
1103
- return new Promise(function (r) {
1104
- return setTimeout(r, m);
1105
- });
1106
- };
1107
- function isFunction(value) {
1108
- return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
1109
- }
1110
- var chatCodes = {
1111
- TOKEN_EXPIRED: 40,
1112
- WS_CLOSED_SUCCESS: 1000
1113
- };
1114
-
1115
- function isReadableStream(obj) {
1116
- return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
1117
- }
1118
-
1119
- function isBuffer(obj) {
1120
- return obj != null && obj.constructor != null && // @ts-expect-error
1121
- typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
1122
- obj.constructor.isBuffer(obj);
1123
- }
1124
-
1125
- function isFileWebAPI(uri) {
1126
- return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
1127
- }
1128
-
1129
- function isOwnUser(user) {
1130
- return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
1131
- }
1132
-
1133
- function isBlobWebAPI(uri) {
1134
- return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
1135
- }
1136
-
1137
- function isOwnUserBaseProperty(property) {
1138
- var ownUserBaseProperties = {
1139
- channel_mutes: true,
1140
- devices: true,
1141
- mutes: true,
1142
- total_unread_count: true,
1143
- unread_channels: true,
1144
- unread_count: true,
1145
- invisible: true,
1146
- roles: true
1147
- };
1148
- return ownUserBaseProperties[property];
1149
- }
1150
- function addFileToFormData(uri, name, contentType) {
1151
- var data = new FormData();
1152
-
1153
- if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
1154
- if (name) data.append('file', uri, name);else data.append('file', uri);
1155
- } else {
1156
- data.append('file', {
1157
- uri: uri,
1158
- name: name || uri.split('/').reverse()[0],
1159
- contentType: contentType || undefined,
1160
- type: contentType || undefined
1161
- });
1162
- }
1163
-
1164
- return data;
1165
- }
1166
- function normalizeQuerySort(sort) {
1167
- var sortFields = [];
1168
- var sortArr = Array.isArray(sort) ? sort : [sort];
1169
-
1170
- var _iterator = _createForOfIteratorHelper$3(sortArr),
1171
- _step;
1172
-
1173
- try {
1174
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1175
- var item = _step.value;
1176
- var entries = Object.entries(item);
1177
-
1178
- if (entries.length > 1) {
1179
- console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
1180
- }
1181
-
1182
- for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
1183
- var _entries$_i = _slicedToArray(_entries[_i], 2),
1184
- field = _entries$_i[0],
1185
- direction = _entries$_i[1];
1186
-
1187
- sortFields.push({
1188
- field: field,
1189
- direction: direction
1190
- });
1191
- }
1192
- }
1193
- } catch (err) {
1194
- _iterator.e(err);
1195
- } finally {
1196
- _iterator.f();
1197
- }
1198
-
1199
- return sortFields;
1200
- }
1201
- /**
1202
- * retryInterval - A retry interval which increases acc to number of failures
1203
- *
1204
- * @return {number} Duration to wait in milliseconds
1205
- */
1206
-
1207
- function retryInterval(numberOfFailures) {
1208
- // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
1209
- var max = Math.min(500 + numberOfFailures * 2000, 25000);
1210
- var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
1211
- return Math.floor(Math.random() * (max - min) + min);
1212
- }
1213
- function randomId() {
1214
- return generateUUIDv4();
1215
- }
1216
-
1217
- function hex(bytes) {
1218
- var s = '';
1219
-
1220
- for (var i = 0; i < bytes.length; i++) {
1221
- s += bytes[i].toString(16).padStart(2, '0');
1222
- }
1223
-
1224
- return s;
1225
- } // https://tools.ietf.org/html/rfc4122
1226
-
1227
-
1228
- function generateUUIDv4() {
1229
- var bytes = getRandomBytes(16);
1230
- bytes[6] = bytes[6] & 0x0f | 0x40; // version
1231
-
1232
- bytes[8] = bytes[8] & 0xbf | 0x80; // variant
1233
-
1234
- 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));
1235
- }
1236
-
1237
- function getRandomValuesWithMathRandom(bytes) {
1238
- var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
1239
-
1240
- for (var i = 0; i < bytes.length; i++) {
1241
- bytes[i] = Math.random() * max;
1242
- }
1243
- }
1244
-
1245
- var getRandomValues = function () {
1246
- var _crypto;
1247
-
1248
- if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
1249
- return crypto.getRandomValues.bind(crypto);
1250
- } else if (typeof msCrypto !== 'undefined') {
1251
- return msCrypto.getRandomValues.bind(msCrypto);
1252
- } else {
1253
- return getRandomValuesWithMathRandom;
1254
- }
1255
- }();
1256
-
1257
- function getRandomBytes(length) {
1258
- var bytes = new Uint8Array(length);
1259
- getRandomValues(bytes);
1260
- return bytes;
1261
- }
1262
-
1263
- function convertErrorToJson(err) {
1264
- var jsonObj = {};
1265
- if (!err) return jsonObj;
1266
-
1267
- try {
1268
- Object.getOwnPropertyNames(err).forEach(function (key) {
1269
- jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
1270
- });
1271
- } catch (_) {
1272
- return {
1273
- error: 'failed to serialize the error'
1274
- };
1275
- }
1301
+ }
1276
1302
 
1277
- return jsonObj;
1278
- }
1279
- /**
1280
- * isOnline safely return the navigator.online value for browser env
1281
- * if navigator is not in global object, it always return true
1282
- */
1303
+ break;
1283
1304
 
1284
- function isOnline() {
1285
- var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
1305
+ case 'current':
1306
+ targetMessageSetIndex = this.messageSets.findIndex(function (s) {
1307
+ return s.isCurrent;
1308
+ });
1309
+ break;
1286
1310
 
1287
- if (!nav) {
1288
- console.warn('isOnline failed to access window.navigator and assume browser is online');
1289
- return true;
1290
- } // RN navigator has undefined for onLine
1311
+ case 'latest':
1312
+ targetMessageSetIndex = this.messageSets.findIndex(function (s) {
1313
+ return s.isLatest;
1314
+ });
1315
+ break;
1291
1316
 
1317
+ default:
1318
+ targetMessageSetIndex = -1;
1319
+ } // when merging the target set will be the first one from the overlapping message sets
1292
1320
 
1293
- if (typeof nav.onLine !== 'boolean') {
1294
- return true;
1295
- }
1296
1321
 
1297
- return nav.onLine;
1298
- }
1299
- /**
1300
- * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
1301
- */
1322
+ var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
1302
1323
 
1303
- function addConnectionEventListeners(cb) {
1304
- if (typeof window !== 'undefined' && window.addEventListener) {
1305
- window.addEventListener('offline', cb);
1306
- window.addEventListener('online', cb);
1307
- }
1308
- }
1309
- function removeConnectionEventListeners(cb) {
1310
- if (typeof window !== 'undefined' && window.removeEventListener) {
1311
- window.removeEventListener('offline', cb);
1312
- window.removeEventListener('online', cb);
1313
- }
1314
- }
1315
- var axiosParamsSerializer = function axiosParamsSerializer(params) {
1316
- var newParams = [];
1324
+ var mergeSourceMessageSetIndices = _toConsumableArray(overlappingMessageSetIndices);
1317
1325
 
1318
- for (var k in params) {
1319
- // Stream backend doesn't treat "undefined" value same as value not being present.
1320
- // So, we need to skip the undefined values.
1321
- if (params[k] === undefined) continue;
1326
+ if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
1327
+ mergeSourceMessageSetIndices.push(targetMessageSetIndex);
1328
+ } // merge message sets
1322
1329
 
1323
- if (Array.isArray(params[k]) || _typeof(params[k]) === 'object') {
1324
- newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1325
- } else {
1326
- newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
1330
+
1331
+ if (mergeSourceMessageSetIndices.length > 0) {
1332
+ var target = this.messageSets[mergeTargetMessageSetIndex];
1333
+ var sources = this.messageSets.filter(function (_, i) {
1334
+ return mergeSourceMessageSetIndices.indexOf(i) !== -1;
1335
+ });
1336
+ sources.forEach(function (messageSet) {
1337
+ target.isLatest = target.isLatest || messageSet.isLatest;
1338
+ target.isCurrent = target.isCurrent || messageSet.isCurrent;
1339
+ messagesToAdd = [].concat(_toConsumableArray(messagesToAdd), _toConsumableArray(messageSet.messages));
1340
+ });
1341
+ sources.forEach(function (s) {
1342
+ return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
1343
+ });
1344
+ var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
1345
+ return _this5.areMessageSetsOverlap(s.messages, newMessages);
1346
+ });
1347
+ targetMessageSetIndex = overlappingMessageSetIndex;
1348
+ }
1349
+ } else {
1350
+ // assumes that all new messages belong to the same set
1351
+ targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
1352
+ }
1353
+
1354
+ return {
1355
+ targetMessageSetIndex: targetMessageSetIndex,
1356
+ messagesToAdd: messagesToAdd
1357
+ };
1327
1358
  }
1328
- }
1359
+ }]);
1329
1360
 
1330
- return newParams.join('&');
1331
- };
1361
+ return ChannelState;
1362
+ }();
1332
1363
 
1333
- function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { 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 = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1364
+ function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1334
1365
 
1335
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
1366
+ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1336
1367
 
1337
- 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; }
1368
+ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1338
1369
 
1339
- 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; }
1370
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1340
1371
 
1341
- 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; }
1372
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1342
1373
 
1343
1374
  /**
1344
1375
  * Channel - The Channel class manages it's own state.
@@ -1411,7 +1442,7 @@ var Channel = /*#__PURE__*/function () {
1411
1442
  while (1) {
1412
1443
  switch (_context.prev = _context.next) {
1413
1444
  case 0:
1414
- defaultOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
1445
+ defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
1415
1446
  watch: false,
1416
1447
  state: false,
1417
1448
  presence: false
@@ -1483,7 +1514,7 @@ var Channel = /*#__PURE__*/function () {
1483
1514
 
1484
1515
  this.data = data; // this._data is used for the requests...
1485
1516
 
1486
- this._data = _objectSpread$5({}, data);
1517
+ this._data = _objectSpread$6({}, data);
1487
1518
  this.cid = "".concat(type, ":").concat(id);
1488
1519
  this.listeners = {}; // perhaps the state variable should be private
1489
1520
 
@@ -1540,23 +1571,19 @@ var Channel = /*#__PURE__*/function () {
1540
1571
  key: "sendMessage",
1541
1572
  value: function () {
1542
1573
  var _sendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(message, options) {
1543
- var sendMessageResponse;
1544
1574
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1545
1575
  while (1) {
1546
1576
  switch (_context2.prev = _context2.next) {
1547
1577
  case 0:
1548
1578
  _context2.next = 2;
1549
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1579
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
1550
1580
  message: message
1551
1581
  }, options));
1552
1582
 
1553
1583
  case 2:
1554
- sendMessageResponse = _context2.sent;
1555
- // Reset unreadCount to 0.
1556
- this.state.unreadCount = 0;
1557
- return _context2.abrupt("return", sendMessageResponse);
1584
+ return _context2.abrupt("return", _context2.sent);
1558
1585
 
1559
- case 5:
1586
+ case 3:
1560
1587
  case "end":
1561
1588
  return _context2.stop();
1562
1589
  }
@@ -1665,7 +1692,7 @@ var Channel = /*#__PURE__*/function () {
1665
1692
 
1666
1693
  case 3:
1667
1694
  // Return a list of channels
1668
- payload = _objectSpread$5(_objectSpread$5({
1695
+ payload = _objectSpread$6(_objectSpread$6({
1669
1696
  filter_conditions: {
1670
1697
  cid: this.cid
1671
1698
  }
@@ -1762,7 +1789,7 @@ var Channel = /*#__PURE__*/function () {
1762
1789
 
1763
1790
  _context5.next = 6;
1764
1791
  return this.getClient().get(this.getClient().baseURL + '/members', {
1765
- payload: _objectSpread$5({
1792
+ payload: _objectSpread$6({
1766
1793
  type: type,
1767
1794
  id: id,
1768
1795
  members: members,
@@ -1823,7 +1850,7 @@ var Channel = /*#__PURE__*/function () {
1823
1850
 
1824
1851
  case 4:
1825
1852
  _context6.next = 6;
1826
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$5({
1853
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
1827
1854
  reaction: reaction
1828
1855
  }, options));
1829
1856
 
@@ -1904,7 +1931,7 @@ var Channel = /*#__PURE__*/function () {
1904
1931
  delete channelData[key];
1905
1932
  });
1906
1933
  _context7.next = 7;
1907
- return this._update(_objectSpread$5({
1934
+ return this._update(_objectSpread$6({
1908
1935
  message: updateMessage,
1909
1936
  data: channelData
1910
1937
  }, options));
@@ -2064,7 +2091,7 @@ var Channel = /*#__PURE__*/function () {
2064
2091
  case 0:
2065
2092
  options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
2066
2093
  _context11.next = 3;
2067
- return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
2094
+ return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
2068
2095
 
2069
2096
  case 3:
2070
2097
  return _context11.abrupt("return", _context11.sent);
@@ -2140,7 +2167,7 @@ var Channel = /*#__PURE__*/function () {
2140
2167
  case 0:
2141
2168
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2142
2169
  _context13.next = 3;
2143
- return this._update(_objectSpread$5({
2170
+ return this._update(_objectSpread$6({
2144
2171
  accept_invite: true
2145
2172
  }, options));
2146
2173
 
@@ -2181,7 +2208,7 @@ var Channel = /*#__PURE__*/function () {
2181
2208
  case 0:
2182
2209
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2183
2210
  _context14.next = 3;
2184
- return this._update(_objectSpread$5({
2211
+ return this._update(_objectSpread$6({
2185
2212
  reject_invite: true
2186
2213
  }, options));
2187
2214
 
@@ -2223,7 +2250,7 @@ var Channel = /*#__PURE__*/function () {
2223
2250
  case 0:
2224
2251
  options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
2225
2252
  _context15.next = 3;
2226
- return this._update(_objectSpread$5({
2253
+ return this._update(_objectSpread$6({
2227
2254
  add_members: members,
2228
2255
  message: message
2229
2256
  }, options));
@@ -2266,7 +2293,7 @@ var Channel = /*#__PURE__*/function () {
2266
2293
  case 0:
2267
2294
  options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
2268
2295
  _context16.next = 3;
2269
- return this._update(_objectSpread$5({
2296
+ return this._update(_objectSpread$6({
2270
2297
  add_moderators: members,
2271
2298
  message: message
2272
2299
  }, options));
@@ -2309,7 +2336,7 @@ var Channel = /*#__PURE__*/function () {
2309
2336
  case 0:
2310
2337
  options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
2311
2338
  _context17.next = 3;
2312
- return this._update(_objectSpread$5({
2339
+ return this._update(_objectSpread$6({
2313
2340
  assign_roles: roles,
2314
2341
  message: message
2315
2342
  }, options));
@@ -2352,7 +2379,7 @@ var Channel = /*#__PURE__*/function () {
2352
2379
  case 0:
2353
2380
  options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
2354
2381
  _context18.next = 3;
2355
- return this._update(_objectSpread$5({
2382
+ return this._update(_objectSpread$6({
2356
2383
  invites: members,
2357
2384
  message: message
2358
2385
  }, options));
@@ -2395,7 +2422,7 @@ var Channel = /*#__PURE__*/function () {
2395
2422
  case 0:
2396
2423
  options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
2397
2424
  _context19.next = 3;
2398
- return this._update(_objectSpread$5({
2425
+ return this._update(_objectSpread$6({
2399
2426
  remove_members: members,
2400
2427
  message: message
2401
2428
  }, options));
@@ -2438,7 +2465,7 @@ var Channel = /*#__PURE__*/function () {
2438
2465
  case 0:
2439
2466
  options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
2440
2467
  _context20.next = 3;
2441
- return this._update(_objectSpread$5({
2468
+ return this._update(_objectSpread$6({
2442
2469
  demote_moderators: members,
2443
2470
  message: message
2444
2471
  }, options));
@@ -2523,7 +2550,7 @@ var Channel = /*#__PURE__*/function () {
2523
2550
  case 0:
2524
2551
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2525
2552
  _context22.next = 3;
2526
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$5({
2553
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
2527
2554
  channel_cid: this.cid
2528
2555
  }, opts));
2529
2556
 
@@ -2565,7 +2592,7 @@ var Channel = /*#__PURE__*/function () {
2565
2592
  case 0:
2566
2593
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2567
2594
  _context23.next = 3;
2568
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$5({
2595
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
2569
2596
  channel_cid: this.cid
2570
2597
  }, opts));
2571
2598
 
@@ -2624,7 +2651,7 @@ var Channel = /*#__PURE__*/function () {
2624
2651
  }, {
2625
2652
  key: "keystroke",
2626
2653
  value: function () {
2627
- var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id) {
2654
+ var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id, options) {
2628
2655
  var _this$getConfig;
2629
2656
 
2630
2657
  var now, diff;
@@ -2652,10 +2679,10 @@ var Channel = /*#__PURE__*/function () {
2652
2679
 
2653
2680
  this.lastTypingEvent = new Date();
2654
2681
  _context24.next = 10;
2655
- return this.sendEvent({
2682
+ return this.sendEvent(_objectSpread$6({
2656
2683
  type: 'typing.start',
2657
2684
  parent_id: parent_id
2658
- });
2685
+ }, options || {}));
2659
2686
 
2660
2687
  case 10:
2661
2688
  case "end":
@@ -2665,7 +2692,7 @@ var Channel = /*#__PURE__*/function () {
2665
2692
  }, _callee24, this);
2666
2693
  }));
2667
2694
 
2668
- function keystroke(_x25) {
2695
+ function keystroke(_x25, _x26) {
2669
2696
  return _keystroke.apply(this, arguments);
2670
2697
  }
2671
2698
 
@@ -2680,7 +2707,7 @@ var Channel = /*#__PURE__*/function () {
2680
2707
  }, {
2681
2708
  key: "stopTyping",
2682
2709
  value: function () {
2683
- var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id) {
2710
+ var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id, options) {
2684
2711
  var _this$getConfig2;
2685
2712
 
2686
2713
  return _regeneratorRuntime.wrap(function _callee25$(_context25) {
@@ -2698,10 +2725,10 @@ var Channel = /*#__PURE__*/function () {
2698
2725
  this.lastTypingEvent = null;
2699
2726
  this.isTyping = false;
2700
2727
  _context25.next = 6;
2701
- return this.sendEvent({
2728
+ return this.sendEvent(_objectSpread$6({
2702
2729
  type: 'typing.stop',
2703
2730
  parent_id: parent_id
2704
- });
2731
+ }, options || {}));
2705
2732
 
2706
2733
  case 6:
2707
2734
  case "end":
@@ -2711,7 +2738,7 @@ var Channel = /*#__PURE__*/function () {
2711
2738
  }, _callee25, this);
2712
2739
  }));
2713
2740
 
2714
- function stopTyping(_x26) {
2741
+ function stopTyping(_x27, _x28) {
2715
2742
  return _stopTyping.apply(this, arguments);
2716
2743
  }
2717
2744
 
@@ -2774,7 +2801,7 @@ var Channel = /*#__PURE__*/function () {
2774
2801
 
2775
2802
  case 4:
2776
2803
  _context26.next = 6;
2777
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$5({}, data));
2804
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
2778
2805
 
2779
2806
  case 6:
2780
2807
  return _context26.abrupt("return", _context26.sent);
@@ -2821,7 +2848,7 @@ var Channel = /*#__PURE__*/function () {
2821
2848
 
2822
2849
  case 3:
2823
2850
  _context27.next = 5;
2824
- return this.getClient().post(this._channelURL() + '/unread', _objectSpread$5({}, data));
2851
+ return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
2825
2852
 
2826
2853
  case 5:
2827
2854
  return _context27.abrupt("return", _context27.sent);
@@ -2834,7 +2861,7 @@ var Channel = /*#__PURE__*/function () {
2834
2861
  }, _callee27, this);
2835
2862
  }));
2836
2863
 
2837
- function markUnread(_x27) {
2864
+ function markUnread(_x29) {
2838
2865
  return _markUnread.apply(this, arguments);
2839
2866
  }
2840
2867
 
@@ -2889,7 +2916,7 @@ var Channel = /*#__PURE__*/function () {
2889
2916
  defaultOptions.watch = false;
2890
2917
  }
2891
2918
 
2892
- combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
2919
+ combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
2893
2920
  _context28.next = 7;
2894
2921
  return this.query(combined, 'latest');
2895
2922
 
@@ -2913,7 +2940,7 @@ var Channel = /*#__PURE__*/function () {
2913
2940
  }, _callee28, this);
2914
2941
  }));
2915
2942
 
2916
- function watch(_x28) {
2943
+ function watch(_x30) {
2917
2944
  return _watch.apply(this, arguments);
2918
2945
  }
2919
2946
 
@@ -2980,7 +3007,7 @@ var Channel = /*#__PURE__*/function () {
2980
3007
  switch (_context30.prev = _context30.next) {
2981
3008
  case 0:
2982
3009
  _context30.next = 2;
2983
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$5({}, options));
3010
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
2984
3011
 
2985
3012
  case 2:
2986
3013
  data = _context30.sent;
@@ -3000,7 +3027,7 @@ var Channel = /*#__PURE__*/function () {
3000
3027
  }, _callee30, this);
3001
3028
  }));
3002
3029
 
3003
- function getReplies(_x29, _x30) {
3030
+ function getReplies(_x31, _x32) {
3004
3031
  return _getReplies.apply(this, arguments);
3005
3032
  }
3006
3033
 
@@ -3028,7 +3055,7 @@ var Channel = /*#__PURE__*/function () {
3028
3055
  sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
3029
3056
  _context31.next = 3;
3030
3057
  return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
3031
- payload: _objectSpread$5(_objectSpread$5({}, options), {}, {
3058
+ payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
3032
3059
  sort: normalizeQuerySort(sort)
3033
3060
  })
3034
3061
  });
@@ -3044,7 +3071,7 @@ var Channel = /*#__PURE__*/function () {
3044
3071
  }, _callee31, this);
3045
3072
  }));
3046
3073
 
3047
- function getPinnedMessages(_x31) {
3074
+ function getPinnedMessages(_x33) {
3048
3075
  return _getPinnedMessages.apply(this, arguments);
3049
3076
  }
3050
3077
 
@@ -3062,7 +3089,7 @@ var Channel = /*#__PURE__*/function () {
3062
3089
  }, {
3063
3090
  key: "getReactions",
3064
3091
  value: function getReactions(message_id, options) {
3065
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$5({}, options));
3092
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
3066
3093
  }
3067
3094
  /**
3068
3095
  * getMessagesById - Retrieves a list of messages by ID
@@ -3209,7 +3236,7 @@ var Channel = /*#__PURE__*/function () {
3209
3236
  }
3210
3237
 
3211
3238
  _context32.next = 7;
3212
- return this.getClient().post(queryURL + '/query', _objectSpread$5({
3239
+ return this.getClient().post(queryURL + '/query', _objectSpread$6({
3213
3240
  data: this._data,
3214
3241
  state: true
3215
3242
  }, options));
@@ -3273,7 +3300,7 @@ var Channel = /*#__PURE__*/function () {
3273
3300
  }, _callee32, this);
3274
3301
  }));
3275
3302
 
3276
- function query(_x32) {
3303
+ function query(_x34) {
3277
3304
  return _query.apply(this, arguments);
3278
3305
  }
3279
3306
 
@@ -3298,7 +3325,7 @@ var Channel = /*#__PURE__*/function () {
3298
3325
  this._checkInitialized();
3299
3326
 
3300
3327
  _context33.next = 3;
3301
- return this.getClient().banUser(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3328
+ return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3302
3329
  type: this.type,
3303
3330
  id: this.id
3304
3331
  }));
@@ -3314,7 +3341,7 @@ var Channel = /*#__PURE__*/function () {
3314
3341
  }, _callee33, this);
3315
3342
  }));
3316
3343
 
3317
- function banUser(_x33, _x34) {
3344
+ function banUser(_x35, _x36) {
3318
3345
  return _banUser.apply(this, arguments);
3319
3346
  }
3320
3347
 
@@ -3445,7 +3472,7 @@ var Channel = /*#__PURE__*/function () {
3445
3472
  }, _callee36, this);
3446
3473
  }));
3447
3474
 
3448
- function unbanUser(_x35) {
3475
+ function unbanUser(_x37) {
3449
3476
  return _unbanUser.apply(this, arguments);
3450
3477
  }
3451
3478
 
@@ -3470,7 +3497,7 @@ var Channel = /*#__PURE__*/function () {
3470
3497
  this._checkInitialized();
3471
3498
 
3472
3499
  _context37.next = 3;
3473
- return this.getClient().shadowBan(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3500
+ return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3474
3501
  type: this.type,
3475
3502
  id: this.id
3476
3503
  }));
@@ -3486,7 +3513,7 @@ var Channel = /*#__PURE__*/function () {
3486
3513
  }, _callee37, this);
3487
3514
  }));
3488
3515
 
3489
- function shadowBan(_x36, _x37) {
3516
+ function shadowBan(_x38, _x39) {
3490
3517
  return _shadowBan.apply(this, arguments);
3491
3518
  }
3492
3519
 
@@ -3526,7 +3553,7 @@ var Channel = /*#__PURE__*/function () {
3526
3553
  }, _callee38, this);
3527
3554
  }));
3528
3555
 
3529
- function removeShadowBan(_x38) {
3556
+ function removeShadowBan(_x40) {
3530
3557
  return _removeShadowBan.apply(this, arguments);
3531
3558
  }
3532
3559
 
@@ -3561,7 +3588,7 @@ var Channel = /*#__PURE__*/function () {
3561
3588
  }, _callee39, this);
3562
3589
  }));
3563
3590
 
3564
- function createCall(_x39) {
3591
+ function createCall(_x41) {
3565
3592
  return _createCall.apply(this, arguments);
3566
3593
  }
3567
3594
 
@@ -3637,7 +3664,7 @@ var Channel = /*#__PURE__*/function () {
3637
3664
  }, {
3638
3665
  key: "_handleChannelEvent",
3639
3666
  value: function _handleChannelEvent(event) {
3640
- var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9, _event$user10, _channelState$members, _event$user11, _channelState$members2;
3667
+ var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9, _event$user11, _channelState$members, _event$user12, _channelState$members2;
3641
3668
 
3642
3669
  var channel = this;
3643
3670
 
@@ -3668,7 +3695,6 @@ var Channel = /*#__PURE__*/function () {
3668
3695
  var _event$user4, _this$getClient$user;
3669
3696
 
3670
3697
  channelState.read[event.user.id] = {
3671
- // because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
3672
3698
  last_read: new Date(event.created_at),
3673
3699
  last_read_message_id: event.last_read_message_id,
3674
3700
  user: event.user,
@@ -3725,7 +3751,13 @@ var Channel = /*#__PURE__*/function () {
3725
3751
 
3726
3752
  if (event.message.pinned) {
3727
3753
  channelState.addPinnedMessage(event.message);
3728
- }
3754
+ } // do not increase the unread count - the back-end does not increase the count neither in the following cases:
3755
+ // 1. the message is mine
3756
+ // 2. the message is a thread reply from any user
3757
+
3758
+
3759
+ var preventUnreadCountUpdate = ownMessage || isThreadMessage;
3760
+ if (preventUnreadCountUpdate) break;
3729
3761
 
3730
3762
  if ((_event$user8 = event.user) !== null && _event$user8 !== void 0 && _event$user8.id) {
3731
3763
  for (var userId in channelState.read) {
@@ -3741,9 +3773,7 @@ var Channel = /*#__PURE__*/function () {
3741
3773
  }
3742
3774
  }
3743
3775
 
3744
- if (ownMessage) {
3745
- channelState.unreadCount = 0;
3746
- } else if (this._countMessageAsUnread(event.message)) {
3776
+ if (this._countMessageAsUnread(event.message)) {
3747
3777
  channelState.unreadCount = channelState.unreadCount + 1;
3748
3778
  }
3749
3779
  }
@@ -3816,6 +3846,25 @@ var Channel = /*#__PURE__*/function () {
3816
3846
 
3817
3847
  break;
3818
3848
 
3849
+ case 'notification.mark_unread':
3850
+ {
3851
+ var _event$user10, _this$getClient$user3, _event$unread_message;
3852
+
3853
+ var _ownMessage = ((_event$user10 = event.user) === null || _event$user10 === void 0 ? void 0 : _event$user10.id) === ((_this$getClient$user3 = this.getClient().user) === null || _this$getClient$user3 === void 0 ? void 0 : _this$getClient$user3.id);
3854
+
3855
+ if (!(_ownMessage && event.user)) break;
3856
+ var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
3857
+ channelState.read[event.user.id] = {
3858
+ first_unread_message_id: event.first_unread_message_id,
3859
+ last_read: new Date(event.last_read_at),
3860
+ last_read_message_id: event.last_read_message_id,
3861
+ user: event.user,
3862
+ unread_messages: unreadCount
3863
+ };
3864
+ channelState.unreadCount = unreadCount;
3865
+ break;
3866
+ }
3867
+
3819
3868
  case 'channel.updated':
3820
3869
  if (event.channel) {
3821
3870
  var _event$channel2, _channel$data, _event$channel$hidden, _event$channel3, _channel$data2, _event$channel$own_ca, _event$channel4, _channel$data3;
@@ -3834,7 +3883,7 @@ var Channel = /*#__PURE__*/function () {
3834
3883
  });
3835
3884
  }
3836
3885
 
3837
- channel.data = _objectSpread$5(_objectSpread$5({}, event.channel), {}, {
3886
+ channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
3838
3887
  hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
3839
3888
  own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
3840
3889
  });
@@ -3865,7 +3914,7 @@ var Channel = /*#__PURE__*/function () {
3865
3914
  break;
3866
3915
 
3867
3916
  case 'channel.hidden':
3868
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3917
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3869
3918
  hidden: true
3870
3919
  });
3871
3920
 
@@ -3876,26 +3925,26 @@ var Channel = /*#__PURE__*/function () {
3876
3925
  break;
3877
3926
 
3878
3927
  case 'channel.visible':
3879
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3928
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3880
3929
  hidden: false
3881
3930
  });
3882
3931
  break;
3883
3932
 
3884
3933
  case 'user.banned':
3885
- if (!((_event$user10 = event.user) !== null && _event$user10 !== void 0 && _event$user10.id)) break;
3886
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3934
+ if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3935
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3887
3936
  shadow_banned: !!event.shadow,
3888
3937
  banned: !event.shadow,
3889
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3938
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3890
3939
  });
3891
3940
  break;
3892
3941
 
3893
3942
  case 'user.unbanned':
3894
- if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3895
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3943
+ if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
3944
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3896
3945
  shadow_banned: false,
3897
3946
  banned: false,
3898
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3947
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3899
3948
  });
3900
3949
  break;
3901
3950
  } // any event can send over the online count
@@ -3925,7 +3974,7 @@ var Channel = /*#__PURE__*/function () {
3925
3974
 
3926
3975
 
3927
3976
  if (state.members) {
3928
- var _iterator = _createForOfIteratorHelper$2(state.members),
3977
+ var _iterator = _createForOfIteratorHelper$3(state.members),
3929
3978
  _step;
3930
3979
 
3931
3980
  try {
@@ -3969,7 +4018,7 @@ var Channel = /*#__PURE__*/function () {
3969
4018
 
3970
4019
 
3971
4020
  if (state.watchers) {
3972
- var _iterator2 = _createForOfIteratorHelper$2(state.watchers),
4021
+ var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
3973
4022
  _step2;
3974
4023
 
3975
4024
  try {
@@ -4005,7 +4054,7 @@ var Channel = /*#__PURE__*/function () {
4005
4054
 
4006
4055
 
4007
4056
  if (state.read) {
4008
- var _iterator3 = _createForOfIteratorHelper$2(state.read),
4057
+ var _iterator3 = _createForOfIteratorHelper$3(state.read),
4009
4058
  _step3;
4010
4059
 
4011
4060
  try {
@@ -4074,11 +4123,11 @@ var Channel = /*#__PURE__*/function () {
4074
4123
  return Channel;
4075
4124
  }();
4076
4125
 
4077
- function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4126
+ function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { 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 = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4078
4127
 
4079
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
4128
+ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
4080
4129
 
4081
- function _arrayLikeToArray$1(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; }
4130
+ 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; }
4082
4131
 
4083
4132
  /**
4084
4133
  * ClientState - A container class for the client state.
@@ -4101,7 +4150,7 @@ var ClientState = /*#__PURE__*/function () {
4101
4150
  _createClass(ClientState, [{
4102
4151
  key: "updateUsers",
4103
4152
  value: function updateUsers(users) {
4104
- var _iterator = _createForOfIteratorHelper$1(users),
4153
+ var _iterator = _createForOfIteratorHelper$2(users),
4105
4154
  _step;
4106
4155
 
4107
4156
  try {
@@ -4149,9 +4198,9 @@ var ClientState = /*#__PURE__*/function () {
4149
4198
  return ClientState;
4150
4199
  }();
4151
4200
 
4152
- 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; }
4201
+ 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; }
4153
4202
 
4154
- 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; }
4203
+ 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; }
4155
4204
  var InsightMetrics = function InsightMetrics() {
4156
4205
  _classCallCheck(this, InsightMetrics);
4157
4206
 
@@ -4230,7 +4279,7 @@ var postInsights = /*#__PURE__*/function () {
4230
4279
  };
4231
4280
  }();
4232
4281
  function buildWsFatalInsight(connection, event) {
4233
- return _objectSpread$4(_objectSpread$4({}, event), buildWsBaseInsight(connection));
4282
+ return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
4234
4283
  }
4235
4284
 
4236
4285
  function buildWsBaseInsight(connection) {
@@ -4263,9 +4312,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
4263
4312
  return buildWsBaseInsight(connection);
4264
4313
  }
4265
4314
 
4266
- 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; }
4315
+ 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; }
4267
4316
 
4268
- 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; }
4317
+ 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; }
4269
4318
 
4270
4319
  // Type guards to check WebSocket error type
4271
4320
  var isCloseEvent = function isCloseEvent(res) {
@@ -4629,7 +4678,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4629
4678
  value: function _log(msg) {
4630
4679
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4631
4680
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
4632
- this.client.logger(level, 'connection:' + msg, _objectSpread$3({
4681
+ this.client.logger(level, 'connection:' + msg, _objectSpread$4({
4633
4682
  tags: ['connection']
4634
4683
  }, extra));
4635
4684
  }
@@ -5220,9 +5269,9 @@ var StableWSConnection = /*#__PURE__*/function () {
5220
5269
  return StableWSConnection;
5221
5270
  }();
5222
5271
 
5223
- 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; }
5272
+ 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; }
5224
5273
 
5225
- 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; }
5274
+ 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; }
5226
5275
 
5227
5276
  /**
5228
5277
  * Creates the JWT token that can be used for a UserSession
@@ -5243,7 +5292,7 @@ function JWTUserToken(apiSecret, userId) {
5243
5292
  throw new TypeError('userId should be a string');
5244
5293
  }
5245
5294
 
5246
- var payload = _objectSpread$2({
5295
+ var payload = _objectSpread$3({
5247
5296
  user_id: userId
5248
5297
  }, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
5249
5298
 
@@ -5653,9 +5702,9 @@ function isErrorResponse(res) {
5653
5702
  return !res.status || res.status < 200 || 300 <= res.status;
5654
5703
  }
5655
5704
 
5656
- 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; }
5705
+ 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; }
5657
5706
 
5658
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5707
+ 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; }
5659
5708
  var ConnectionState;
5660
5709
 
5661
5710
  (function (ConnectionState) {
@@ -5718,7 +5767,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5718
5767
  _context.next = 4;
5719
5768
  return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
5720
5769
  undefined, {
5721
- config: _objectSpread$1(_objectSpread$1({}, config), {}, {
5770
+ config: _objectSpread$2(_objectSpread$2({}, config), {}, {
5722
5771
  cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
5723
5772
  }),
5724
5773
  params: params
@@ -5996,7 +6045,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5996
6045
  value: function _log(msg) {
5997
6046
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5998
6047
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
5999
- this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$1({
6048
+ this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
6000
6049
  tags: ['connection_fallback', 'connection']
6001
6050
  }, extra));
6002
6051
  }
@@ -6043,6 +6092,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
6043
6092
  /**
6044
6093
  * Response Types
6045
6094
  */
6095
+ // TODO: Figure out a way to strongly type set and unset.
6046
6096
  // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6047
6097
 
6048
6098
  /**
@@ -6114,6 +6164,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6114
6164
  return ErrorFromResponse;
6115
6165
  }( /*#__PURE__*/_wrapNativeSuper(Error));
6116
6166
 
6167
+ 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; }
6168
+
6169
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6170
+
6171
+ function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6172
+
6173
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
6174
+
6175
+ function _arrayLikeToArray$1(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; }
6176
+ var Thread = /*#__PURE__*/function () {
6177
+ function Thread(client, t) {
6178
+ _classCallCheck(this, Thread);
6179
+
6180
+ _defineProperty(this, "id", void 0);
6181
+
6182
+ _defineProperty(this, "latestReplies", []);
6183
+
6184
+ _defineProperty(this, "participants", []);
6185
+
6186
+ _defineProperty(this, "message", void 0);
6187
+
6188
+ _defineProperty(this, "channel", void 0);
6189
+
6190
+ _defineProperty(this, "_channel", void 0);
6191
+
6192
+ _defineProperty(this, "replyCount", 0);
6193
+
6194
+ _defineProperty(this, "_client", void 0);
6195
+
6196
+ _defineProperty(this, "read", {});
6197
+
6198
+ this.id = t.parent_message.id;
6199
+ this.message = formatMessage(t.parent_message);
6200
+ this.latestReplies = t.latest_replies.map(formatMessage);
6201
+ this.participants = t.thread_participants;
6202
+ this.replyCount = t.reply_count;
6203
+ this.channel = t.channel;
6204
+ this._channel = client.channel(t.channel.type, t.channel.id);
6205
+ this._client = client;
6206
+
6207
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6208
+ _step;
6209
+
6210
+ try {
6211
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6212
+ var r = _step.value;
6213
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6214
+ last_read: new Date(r.last_read)
6215
+ });
6216
+ }
6217
+ } catch (err) {
6218
+ _iterator.e(err);
6219
+ } finally {
6220
+ _iterator.f();
6221
+ }
6222
+ }
6223
+
6224
+ _createClass(Thread, [{
6225
+ key: "getClient",
6226
+ value: function getClient() {
6227
+ return this._client;
6228
+ }
6229
+ }, {
6230
+ key: "addReply",
6231
+ value: function addReply(message) {
6232
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6233
+ }
6234
+ }, {
6235
+ key: "updateReply",
6236
+ value: function updateReply(message) {
6237
+ this.latestReplies = this.latestReplies.map(function (m) {
6238
+ if (m.id === message.id) {
6239
+ return formatMessage(message);
6240
+ }
6241
+
6242
+ return m;
6243
+ });
6244
+ }
6245
+ }, {
6246
+ key: "updateMessageOrReplyIfExists",
6247
+ value: function updateMessageOrReplyIfExists(message) {
6248
+ if (!message.parent_id && message.id !== this.message.id) {
6249
+ return;
6250
+ }
6251
+
6252
+ if (message.parent_id && message.parent_id !== this.message.id) {
6253
+ return;
6254
+ }
6255
+
6256
+ if (message.parent_id && message.parent_id === this.message.id) {
6257
+ this.updateReply(message);
6258
+ }
6259
+
6260
+ if (!message.parent_id && message.id === this.message.id) {
6261
+ this.message = formatMessage(message);
6262
+ }
6263
+ }
6264
+ }, {
6265
+ key: "addReaction",
6266
+ value: function addReaction(reaction, message, enforce_unique) {
6267
+ var _this = this;
6268
+
6269
+ if (!message) return;
6270
+ this.latestReplies = this.latestReplies.map(function (m) {
6271
+ if (m.id === message.id) {
6272
+ return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
6273
+ }
6274
+
6275
+ return m;
6276
+ });
6277
+ }
6278
+ }, {
6279
+ key: "removeReaction",
6280
+ value: function removeReaction(reaction, message) {
6281
+ var _this2 = this;
6282
+
6283
+ if (!message) return;
6284
+ this.latestReplies = this.latestReplies.map(function (m) {
6285
+ if (m.id === message.id) {
6286
+ return formatMessage(_this2._channel.state.removeReaction(reaction, message));
6287
+ }
6288
+
6289
+ return m;
6290
+ });
6291
+ }
6292
+ }]);
6293
+
6294
+ return Thread;
6295
+ }();
6296
+
6117
6297
  var _excluded = ["created_at", "updated_at", "last_active", "online"],
6118
6298
  _excluded2 = ["params", "headers"];
6119
6299
 
@@ -8458,6 +8638,14 @@ var StreamChat = /*#__PURE__*/function () {
8458
8638
 
8459
8639
  return getDevices;
8460
8640
  }()
8641
+ /**
8642
+ * getUnreadCount - Returns unread counts for a single user
8643
+ *
8644
+ * @param {string} [userID] User ID.
8645
+ *
8646
+ * @return {<GetUnreadCountAPIResponse>}
8647
+ */
8648
+
8461
8649
  }, {
8462
8650
  key: "getUnreadCount",
8463
8651
  value: function () {
@@ -8479,14 +8667,52 @@ var StreamChat = /*#__PURE__*/function () {
8479
8667
  return _context24.stop();
8480
8668
  }
8481
8669
  }
8482
- }, _callee24, this);
8670
+ }, _callee24, this);
8671
+ }));
8672
+
8673
+ function getUnreadCount(_x25) {
8674
+ return _getUnreadCount.apply(this, arguments);
8675
+ }
8676
+
8677
+ return getUnreadCount;
8678
+ }()
8679
+ /**
8680
+ * getUnreadCountBatch - Returns unread counts for multiple users at once. Only works server side.
8681
+ *
8682
+ * @param {string[]} [userIDs] List of user IDs to fetch unread counts for.
8683
+ *
8684
+ * @return {<GetUnreadCountBatchAPIResponse>}
8685
+ */
8686
+
8687
+ }, {
8688
+ key: "getUnreadCountBatch",
8689
+ value: function () {
8690
+ var _getUnreadCountBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(userIDs) {
8691
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
8692
+ while (1) {
8693
+ switch (_context25.prev = _context25.next) {
8694
+ case 0:
8695
+ _context25.next = 2;
8696
+ return this.post(this.baseURL + '/unread_batch', {
8697
+ user_ids: userIDs
8698
+ });
8699
+
8700
+ case 2:
8701
+ return _context25.abrupt("return", _context25.sent);
8702
+
8703
+ case 3:
8704
+ case "end":
8705
+ return _context25.stop();
8706
+ }
8707
+ }
8708
+ }, _callee25, this);
8483
8709
  }));
8484
8710
 
8485
- function getUnreadCount(_x25) {
8486
- return _getUnreadCount.apply(this, arguments);
8711
+ function getUnreadCountBatch(_x26) {
8712
+ return _getUnreadCountBatch.apply(this, arguments);
8487
8713
  }
8488
8714
 
8489
- return getUnreadCount;
8715
+ return getUnreadCountBatch;
8490
8716
  }()
8491
8717
  /**
8492
8718
  * removeDevice - Removes the device with the given id. Clientside users can only delete their own devices
@@ -8499,12 +8725,12 @@ var StreamChat = /*#__PURE__*/function () {
8499
8725
  }, {
8500
8726
  key: "removeDevice",
8501
8727
  value: function () {
8502
- var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(id, userID) {
8503
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
8728
+ var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(id, userID) {
8729
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
8504
8730
  while (1) {
8505
- switch (_context25.prev = _context25.next) {
8731
+ switch (_context26.prev = _context26.next) {
8506
8732
  case 0:
8507
- _context25.next = 2;
8733
+ _context26.next = 2;
8508
8734
  return this.delete(this.baseURL + '/devices', _objectSpread({
8509
8735
  id: id
8510
8736
  }, userID ? {
@@ -8512,17 +8738,17 @@ var StreamChat = /*#__PURE__*/function () {
8512
8738
  } : {}));
8513
8739
 
8514
8740
  case 2:
8515
- return _context25.abrupt("return", _context25.sent);
8741
+ return _context26.abrupt("return", _context26.sent);
8516
8742
 
8517
8743
  case 3:
8518
8744
  case "end":
8519
- return _context25.stop();
8745
+ return _context26.stop();
8520
8746
  }
8521
8747
  }
8522
- }, _callee25, this);
8748
+ }, _callee26, this);
8523
8749
  }));
8524
8750
 
8525
- function removeDevice(_x26, _x27) {
8751
+ function removeDevice(_x27, _x28) {
8526
8752
  return _removeDevice.apply(this, arguments);
8527
8753
  }
8528
8754
 
@@ -8539,15 +8765,15 @@ var StreamChat = /*#__PURE__*/function () {
8539
8765
  }, {
8540
8766
  key: "getRateLimits",
8541
8767
  value: function () {
8542
- var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(params) {
8768
+ var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(params) {
8543
8769
  var _ref7, serverSide, web, android, ios, endpoints;
8544
8770
 
8545
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
8771
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
8546
8772
  while (1) {
8547
- switch (_context26.prev = _context26.next) {
8773
+ switch (_context27.prev = _context27.next) {
8548
8774
  case 0:
8549
8775
  _ref7 = params || {}, serverSide = _ref7.serverSide, web = _ref7.web, android = _ref7.android, ios = _ref7.ios, endpoints = _ref7.endpoints;
8550
- return _context26.abrupt("return", this.get(this.baseURL + '/rate_limits', {
8776
+ return _context27.abrupt("return", this.get(this.baseURL + '/rate_limits', {
8551
8777
  server_side: serverSide,
8552
8778
  web: web,
8553
8779
  android: android,
@@ -8557,13 +8783,13 @@ var StreamChat = /*#__PURE__*/function () {
8557
8783
 
8558
8784
  case 2:
8559
8785
  case "end":
8560
- return _context26.stop();
8786
+ return _context27.stop();
8561
8787
  }
8562
8788
  }
8563
- }, _callee26, this);
8789
+ }, _callee27, this);
8564
8790
  }));
8565
8791
 
8566
- function getRateLimits(_x28) {
8792
+ function getRateLimits(_x29) {
8567
8793
  return _getRateLimits.apply(this, arguments);
8568
8794
  }
8569
8795
 
@@ -8654,26 +8880,26 @@ var StreamChat = /*#__PURE__*/function () {
8654
8880
  * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
8655
8881
  */
8656
8882
  function () {
8657
- var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(partialUserObject) {
8658
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
8883
+ var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(partialUserObject) {
8884
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
8659
8885
  while (1) {
8660
- switch (_context27.prev = _context27.next) {
8886
+ switch (_context28.prev = _context28.next) {
8661
8887
  case 0:
8662
- _context27.next = 2;
8888
+ _context28.next = 2;
8663
8889
  return this.partialUpdateUsers([partialUserObject]);
8664
8890
 
8665
8891
  case 2:
8666
- return _context27.abrupt("return", _context27.sent);
8892
+ return _context28.abrupt("return", _context28.sent);
8667
8893
 
8668
8894
  case 3:
8669
8895
  case "end":
8670
- return _context27.stop();
8896
+ return _context28.stop();
8671
8897
  }
8672
8898
  }
8673
- }, _callee27, this);
8899
+ }, _callee28, this);
8674
8900
  }));
8675
8901
 
8676
- function partialUpdateUser(_x29) {
8902
+ function partialUpdateUser(_x30) {
8677
8903
  return _partialUpdateUser.apply(this, arguments);
8678
8904
  }
8679
8905
 
@@ -8690,29 +8916,29 @@ var StreamChat = /*#__PURE__*/function () {
8690
8916
  }, {
8691
8917
  key: "upsertUsers",
8692
8918
  value: function () {
8693
- var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(users) {
8919
+ var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(users) {
8694
8920
  var userMap, _iterator4, _step4, userObject;
8695
8921
 
8696
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
8922
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
8697
8923
  while (1) {
8698
- switch (_context28.prev = _context28.next) {
8924
+ switch (_context29.prev = _context29.next) {
8699
8925
  case 0:
8700
8926
  userMap = {};
8701
8927
  _iterator4 = _createForOfIteratorHelper(users);
8702
- _context28.prev = 2;
8928
+ _context29.prev = 2;
8703
8929
 
8704
8930
  _iterator4.s();
8705
8931
 
8706
8932
  case 4:
8707
8933
  if ((_step4 = _iterator4.n()).done) {
8708
- _context28.next = 11;
8934
+ _context29.next = 11;
8709
8935
  break;
8710
8936
  }
8711
8937
 
8712
8938
  userObject = _step4.value;
8713
8939
 
8714
8940
  if (userObject.id) {
8715
- _context28.next = 8;
8941
+ _context29.next = 8;
8716
8942
  break;
8717
8943
  }
8718
8944
 
@@ -8722,44 +8948,44 @@ var StreamChat = /*#__PURE__*/function () {
8722
8948
  userMap[userObject.id] = userObject;
8723
8949
 
8724
8950
  case 9:
8725
- _context28.next = 4;
8951
+ _context29.next = 4;
8726
8952
  break;
8727
8953
 
8728
8954
  case 11:
8729
- _context28.next = 16;
8955
+ _context29.next = 16;
8730
8956
  break;
8731
8957
 
8732
8958
  case 13:
8733
- _context28.prev = 13;
8734
- _context28.t0 = _context28["catch"](2);
8959
+ _context29.prev = 13;
8960
+ _context29.t0 = _context29["catch"](2);
8735
8961
 
8736
- _iterator4.e(_context28.t0);
8962
+ _iterator4.e(_context29.t0);
8737
8963
 
8738
8964
  case 16:
8739
- _context28.prev = 16;
8965
+ _context29.prev = 16;
8740
8966
 
8741
8967
  _iterator4.f();
8742
8968
 
8743
- return _context28.finish(16);
8969
+ return _context29.finish(16);
8744
8970
 
8745
8971
  case 19:
8746
- _context28.next = 21;
8972
+ _context29.next = 21;
8747
8973
  return this.post(this.baseURL + '/users', {
8748
8974
  users: userMap
8749
8975
  });
8750
8976
 
8751
8977
  case 21:
8752
- return _context28.abrupt("return", _context28.sent);
8978
+ return _context29.abrupt("return", _context29.sent);
8753
8979
 
8754
8980
  case 22:
8755
8981
  case "end":
8756
- return _context28.stop();
8982
+ return _context29.stop();
8757
8983
  }
8758
8984
  }
8759
- }, _callee28, this, [[2, 13, 16, 19]]);
8985
+ }, _callee29, this, [[2, 13, 16, 19]]);
8760
8986
  }));
8761
8987
 
8762
- function upsertUsers(_x30) {
8988
+ function upsertUsers(_x31) {
8763
8989
  return _upsertUsers.apply(this, arguments);
8764
8990
  }
8765
8991
 
@@ -8807,72 +9033,72 @@ var StreamChat = /*#__PURE__*/function () {
8807
9033
  * @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
8808
9034
  */
8809
9035
  function () {
8810
- var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(users) {
9036
+ var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(users) {
8811
9037
  var _iterator5, _step5, userObject;
8812
9038
 
8813
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
9039
+ return _regeneratorRuntime.wrap(function _callee30$(_context30) {
8814
9040
  while (1) {
8815
- switch (_context29.prev = _context29.next) {
9041
+ switch (_context30.prev = _context30.next) {
8816
9042
  case 0:
8817
9043
  _iterator5 = _createForOfIteratorHelper(users);
8818
- _context29.prev = 1;
9044
+ _context30.prev = 1;
8819
9045
 
8820
9046
  _iterator5.s();
8821
9047
 
8822
9048
  case 3:
8823
9049
  if ((_step5 = _iterator5.n()).done) {
8824
- _context29.next = 9;
9050
+ _context30.next = 9;
8825
9051
  break;
8826
9052
  }
8827
9053
 
8828
9054
  userObject = _step5.value;
8829
9055
 
8830
9056
  if (userObject.id) {
8831
- _context29.next = 7;
9057
+ _context30.next = 7;
8832
9058
  break;
8833
9059
  }
8834
9060
 
8835
9061
  throw Error('User ID is required when updating a user');
8836
9062
 
8837
9063
  case 7:
8838
- _context29.next = 3;
9064
+ _context30.next = 3;
8839
9065
  break;
8840
9066
 
8841
9067
  case 9:
8842
- _context29.next = 14;
9068
+ _context30.next = 14;
8843
9069
  break;
8844
9070
 
8845
9071
  case 11:
8846
- _context29.prev = 11;
8847
- _context29.t0 = _context29["catch"](1);
9072
+ _context30.prev = 11;
9073
+ _context30.t0 = _context30["catch"](1);
8848
9074
 
8849
- _iterator5.e(_context29.t0);
9075
+ _iterator5.e(_context30.t0);
8850
9076
 
8851
9077
  case 14:
8852
- _context29.prev = 14;
9078
+ _context30.prev = 14;
8853
9079
 
8854
9080
  _iterator5.f();
8855
9081
 
8856
- return _context29.finish(14);
9082
+ return _context30.finish(14);
8857
9083
 
8858
9084
  case 17:
8859
- _context29.next = 19;
9085
+ _context30.next = 19;
8860
9086
  return this.patch(this.baseURL + '/users', {
8861
9087
  users: users
8862
9088
  });
8863
9089
 
8864
9090
  case 19:
8865
- return _context29.abrupt("return", _context29.sent);
9091
+ return _context30.abrupt("return", _context30.sent);
8866
9092
 
8867
9093
  case 20:
8868
9094
  case "end":
8869
- return _context29.stop();
9095
+ return _context30.stop();
8870
9096
  }
8871
9097
  }
8872
- }, _callee29, this, [[1, 11, 14, 17]]);
9098
+ }, _callee30, this, [[1, 11, 14, 17]]);
8873
9099
  }));
8874
9100
 
8875
- function partialUpdateUsers(_x31) {
9101
+ function partialUpdateUsers(_x32) {
8876
9102
  return _partialUpdateUsers.apply(this, arguments);
8877
9103
  }
8878
9104
 
@@ -8881,26 +9107,26 @@ var StreamChat = /*#__PURE__*/function () {
8881
9107
  }, {
8882
9108
  key: "deleteUser",
8883
9109
  value: function () {
8884
- var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(userID, params) {
8885
- return _regeneratorRuntime.wrap(function _callee30$(_context30) {
9110
+ var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(userID, params) {
9111
+ return _regeneratorRuntime.wrap(function _callee31$(_context31) {
8886
9112
  while (1) {
8887
- switch (_context30.prev = _context30.next) {
9113
+ switch (_context31.prev = _context31.next) {
8888
9114
  case 0:
8889
- _context30.next = 2;
9115
+ _context31.next = 2;
8890
9116
  return this.delete(this.baseURL + "/users/".concat(userID), params);
8891
9117
 
8892
9118
  case 2:
8893
- return _context30.abrupt("return", _context30.sent);
9119
+ return _context31.abrupt("return", _context31.sent);
8894
9120
 
8895
9121
  case 3:
8896
9122
  case "end":
8897
- return _context30.stop();
9123
+ return _context31.stop();
8898
9124
  }
8899
9125
  }
8900
- }, _callee30, this);
9126
+ }, _callee31, this);
8901
9127
  }));
8902
9128
 
8903
- function deleteUser(_x32, _x33) {
9129
+ function deleteUser(_x33, _x34) {
8904
9130
  return _deleteUser.apply(this, arguments);
8905
9131
  }
8906
9132
 
@@ -8917,28 +9143,28 @@ var StreamChat = /*#__PURE__*/function () {
8917
9143
  }, {
8918
9144
  key: "restoreUsers",
8919
9145
  value: function () {
8920
- var _restoreUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(user_ids) {
8921
- return _regeneratorRuntime.wrap(function _callee31$(_context31) {
9146
+ var _restoreUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(user_ids) {
9147
+ return _regeneratorRuntime.wrap(function _callee32$(_context32) {
8922
9148
  while (1) {
8923
- switch (_context31.prev = _context31.next) {
9149
+ switch (_context32.prev = _context32.next) {
8924
9150
  case 0:
8925
- _context31.next = 2;
9151
+ _context32.next = 2;
8926
9152
  return this.post(this.baseURL + "/users/restore", {
8927
9153
  user_ids: user_ids
8928
9154
  });
8929
9155
 
8930
9156
  case 2:
8931
- return _context31.abrupt("return", _context31.sent);
9157
+ return _context32.abrupt("return", _context32.sent);
8932
9158
 
8933
9159
  case 3:
8934
9160
  case "end":
8935
- return _context31.stop();
9161
+ return _context32.stop();
8936
9162
  }
8937
9163
  }
8938
- }, _callee31, this);
9164
+ }, _callee32, this);
8939
9165
  }));
8940
9166
 
8941
- function restoreUsers(_x34) {
9167
+ function restoreUsers(_x35) {
8942
9168
  return _restoreUsers.apply(this, arguments);
8943
9169
  }
8944
9170
 
@@ -8956,26 +9182,26 @@ var StreamChat = /*#__PURE__*/function () {
8956
9182
  }, {
8957
9183
  key: "reactivateUser",
8958
9184
  value: function () {
8959
- var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(userID, options) {
8960
- return _regeneratorRuntime.wrap(function _callee32$(_context32) {
9185
+ var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(userID, options) {
9186
+ return _regeneratorRuntime.wrap(function _callee33$(_context33) {
8961
9187
  while (1) {
8962
- switch (_context32.prev = _context32.next) {
9188
+ switch (_context33.prev = _context33.next) {
8963
9189
  case 0:
8964
- _context32.next = 2;
9190
+ _context33.next = 2;
8965
9191
  return this.post(this.baseURL + "/users/".concat(userID, "/reactivate"), _objectSpread({}, options));
8966
9192
 
8967
9193
  case 2:
8968
- return _context32.abrupt("return", _context32.sent);
9194
+ return _context33.abrupt("return", _context33.sent);
8969
9195
 
8970
9196
  case 3:
8971
9197
  case "end":
8972
- return _context32.stop();
9198
+ return _context33.stop();
8973
9199
  }
8974
9200
  }
8975
- }, _callee32, this);
9201
+ }, _callee33, this);
8976
9202
  }));
8977
9203
 
8978
- function reactivateUser(_x35, _x36) {
9204
+ function reactivateUser(_x36, _x37) {
8979
9205
  return _reactivateUser.apply(this, arguments);
8980
9206
  }
8981
9207
 
@@ -8993,28 +9219,28 @@ var StreamChat = /*#__PURE__*/function () {
8993
9219
  }, {
8994
9220
  key: "reactivateUsers",
8995
9221
  value: function () {
8996
- var _reactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(user_ids, options) {
8997
- return _regeneratorRuntime.wrap(function _callee33$(_context33) {
9222
+ var _reactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(user_ids, options) {
9223
+ return _regeneratorRuntime.wrap(function _callee34$(_context34) {
8998
9224
  while (1) {
8999
- switch (_context33.prev = _context33.next) {
9225
+ switch (_context34.prev = _context34.next) {
9000
9226
  case 0:
9001
- _context33.next = 2;
9227
+ _context34.next = 2;
9002
9228
  return this.post(this.baseURL + "/users/reactivate", _objectSpread({
9003
9229
  user_ids: user_ids
9004
9230
  }, options));
9005
9231
 
9006
9232
  case 2:
9007
- return _context33.abrupt("return", _context33.sent);
9233
+ return _context34.abrupt("return", _context34.sent);
9008
9234
 
9009
9235
  case 3:
9010
9236
  case "end":
9011
- return _context33.stop();
9237
+ return _context34.stop();
9012
9238
  }
9013
9239
  }
9014
- }, _callee33, this);
9240
+ }, _callee34, this);
9015
9241
  }));
9016
9242
 
9017
- function reactivateUsers(_x37, _x38) {
9243
+ function reactivateUsers(_x38, _x39) {
9018
9244
  return _reactivateUsers.apply(this, arguments);
9019
9245
  }
9020
9246
 
@@ -9032,26 +9258,26 @@ var StreamChat = /*#__PURE__*/function () {
9032
9258
  }, {
9033
9259
  key: "deactivateUser",
9034
9260
  value: function () {
9035
- var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(userID, options) {
9036
- return _regeneratorRuntime.wrap(function _callee34$(_context34) {
9261
+ var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(userID, options) {
9262
+ return _regeneratorRuntime.wrap(function _callee35$(_context35) {
9037
9263
  while (1) {
9038
- switch (_context34.prev = _context34.next) {
9264
+ switch (_context35.prev = _context35.next) {
9039
9265
  case 0:
9040
- _context34.next = 2;
9266
+ _context35.next = 2;
9041
9267
  return this.post(this.baseURL + "/users/".concat(userID, "/deactivate"), _objectSpread({}, options));
9042
9268
 
9043
9269
  case 2:
9044
- return _context34.abrupt("return", _context34.sent);
9270
+ return _context35.abrupt("return", _context35.sent);
9045
9271
 
9046
9272
  case 3:
9047
9273
  case "end":
9048
- return _context34.stop();
9274
+ return _context35.stop();
9049
9275
  }
9050
9276
  }
9051
- }, _callee34, this);
9277
+ }, _callee35, this);
9052
9278
  }));
9053
9279
 
9054
- function deactivateUser(_x39, _x40) {
9280
+ function deactivateUser(_x40, _x41) {
9055
9281
  return _deactivateUser.apply(this, arguments);
9056
9282
  }
9057
9283
 
@@ -9069,28 +9295,28 @@ var StreamChat = /*#__PURE__*/function () {
9069
9295
  }, {
9070
9296
  key: "deactivateUsers",
9071
9297
  value: function () {
9072
- var _deactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(user_ids, options) {
9073
- return _regeneratorRuntime.wrap(function _callee35$(_context35) {
9298
+ var _deactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(user_ids, options) {
9299
+ return _regeneratorRuntime.wrap(function _callee36$(_context36) {
9074
9300
  while (1) {
9075
- switch (_context35.prev = _context35.next) {
9301
+ switch (_context36.prev = _context36.next) {
9076
9302
  case 0:
9077
- _context35.next = 2;
9303
+ _context36.next = 2;
9078
9304
  return this.post(this.baseURL + "/users/deactivate", _objectSpread({
9079
9305
  user_ids: user_ids
9080
9306
  }, options));
9081
9307
 
9082
9308
  case 2:
9083
- return _context35.abrupt("return", _context35.sent);
9309
+ return _context36.abrupt("return", _context36.sent);
9084
9310
 
9085
9311
  case 3:
9086
9312
  case "end":
9087
- return _context35.stop();
9313
+ return _context36.stop();
9088
9314
  }
9089
9315
  }
9090
- }, _callee35, this);
9316
+ }, _callee36, this);
9091
9317
  }));
9092
9318
 
9093
- function deactivateUsers(_x41, _x42) {
9319
+ function deactivateUsers(_x42, _x43) {
9094
9320
  return _deactivateUsers.apply(this, arguments);
9095
9321
  }
9096
9322
 
@@ -9099,26 +9325,26 @@ var StreamChat = /*#__PURE__*/function () {
9099
9325
  }, {
9100
9326
  key: "exportUser",
9101
9327
  value: function () {
9102
- var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(userID, options) {
9103
- return _regeneratorRuntime.wrap(function _callee36$(_context36) {
9328
+ var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(userID, options) {
9329
+ return _regeneratorRuntime.wrap(function _callee37$(_context37) {
9104
9330
  while (1) {
9105
- switch (_context36.prev = _context36.next) {
9331
+ switch (_context37.prev = _context37.next) {
9106
9332
  case 0:
9107
- _context36.next = 2;
9333
+ _context37.next = 2;
9108
9334
  return this.get(this.baseURL + "/users/".concat(userID, "/export"), _objectSpread({}, options));
9109
9335
 
9110
9336
  case 2:
9111
- return _context36.abrupt("return", _context36.sent);
9337
+ return _context37.abrupt("return", _context37.sent);
9112
9338
 
9113
9339
  case 3:
9114
9340
  case "end":
9115
- return _context36.stop();
9341
+ return _context37.stop();
9116
9342
  }
9117
9343
  }
9118
- }, _callee36, this);
9344
+ }, _callee37, this);
9119
9345
  }));
9120
9346
 
9121
- function exportUser(_x43, _x44) {
9347
+ function exportUser(_x44, _x45) {
9122
9348
  return _exportUser.apply(this, arguments);
9123
9349
  }
9124
9350
 
@@ -9134,28 +9360,28 @@ var StreamChat = /*#__PURE__*/function () {
9134
9360
  }, {
9135
9361
  key: "banUser",
9136
9362
  value: function () {
9137
- var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(targetUserID, options) {
9138
- return _regeneratorRuntime.wrap(function _callee37$(_context37) {
9363
+ var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetUserID, options) {
9364
+ return _regeneratorRuntime.wrap(function _callee38$(_context38) {
9139
9365
  while (1) {
9140
- switch (_context37.prev = _context37.next) {
9366
+ switch (_context38.prev = _context38.next) {
9141
9367
  case 0:
9142
- _context37.next = 2;
9368
+ _context38.next = 2;
9143
9369
  return this.post(this.baseURL + '/moderation/ban', _objectSpread({
9144
9370
  target_user_id: targetUserID
9145
9371
  }, options));
9146
9372
 
9147
9373
  case 2:
9148
- return _context37.abrupt("return", _context37.sent);
9374
+ return _context38.abrupt("return", _context38.sent);
9149
9375
 
9150
9376
  case 3:
9151
9377
  case "end":
9152
- return _context37.stop();
9378
+ return _context38.stop();
9153
9379
  }
9154
9380
  }
9155
- }, _callee37, this);
9381
+ }, _callee38, this);
9156
9382
  }));
9157
9383
 
9158
- function banUser(_x45, _x46) {
9384
+ function banUser(_x46, _x47) {
9159
9385
  return _banUser.apply(this, arguments);
9160
9386
  }
9161
9387
 
@@ -9171,28 +9397,28 @@ var StreamChat = /*#__PURE__*/function () {
9171
9397
  }, {
9172
9398
  key: "unbanUser",
9173
9399
  value: function () {
9174
- var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetUserID, options) {
9175
- return _regeneratorRuntime.wrap(function _callee38$(_context38) {
9400
+ var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetUserID, options) {
9401
+ return _regeneratorRuntime.wrap(function _callee39$(_context39) {
9176
9402
  while (1) {
9177
- switch (_context38.prev = _context38.next) {
9403
+ switch (_context39.prev = _context39.next) {
9178
9404
  case 0:
9179
- _context38.next = 2;
9405
+ _context39.next = 2;
9180
9406
  return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
9181
9407
  target_user_id: targetUserID
9182
9408
  }, options));
9183
9409
 
9184
9410
  case 2:
9185
- return _context38.abrupt("return", _context38.sent);
9411
+ return _context39.abrupt("return", _context39.sent);
9186
9412
 
9187
9413
  case 3:
9188
9414
  case "end":
9189
- return _context38.stop();
9415
+ return _context39.stop();
9190
9416
  }
9191
9417
  }
9192
- }, _callee38, this);
9418
+ }, _callee39, this);
9193
9419
  }));
9194
9420
 
9195
- function unbanUser(_x47, _x48) {
9421
+ function unbanUser(_x48, _x49) {
9196
9422
  return _unbanUser.apply(this, arguments);
9197
9423
  }
9198
9424
 
@@ -9208,28 +9434,28 @@ var StreamChat = /*#__PURE__*/function () {
9208
9434
  }, {
9209
9435
  key: "shadowBan",
9210
9436
  value: function () {
9211
- var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetUserID, options) {
9212
- return _regeneratorRuntime.wrap(function _callee39$(_context39) {
9437
+ var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetUserID, options) {
9438
+ return _regeneratorRuntime.wrap(function _callee40$(_context40) {
9213
9439
  while (1) {
9214
- switch (_context39.prev = _context39.next) {
9440
+ switch (_context40.prev = _context40.next) {
9215
9441
  case 0:
9216
- _context39.next = 2;
9442
+ _context40.next = 2;
9217
9443
  return this.banUser(targetUserID, _objectSpread({
9218
9444
  shadow: true
9219
9445
  }, options));
9220
9446
 
9221
9447
  case 2:
9222
- return _context39.abrupt("return", _context39.sent);
9448
+ return _context40.abrupt("return", _context40.sent);
9223
9449
 
9224
9450
  case 3:
9225
9451
  case "end":
9226
- return _context39.stop();
9452
+ return _context40.stop();
9227
9453
  }
9228
9454
  }
9229
- }, _callee39, this);
9455
+ }, _callee40, this);
9230
9456
  }));
9231
9457
 
9232
- function shadowBan(_x49, _x50) {
9458
+ function shadowBan(_x50, _x51) {
9233
9459
  return _shadowBan.apply(this, arguments);
9234
9460
  }
9235
9461
 
@@ -9245,28 +9471,28 @@ var StreamChat = /*#__PURE__*/function () {
9245
9471
  }, {
9246
9472
  key: "removeShadowBan",
9247
9473
  value: function () {
9248
- var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetUserID, options) {
9249
- return _regeneratorRuntime.wrap(function _callee40$(_context40) {
9474
+ var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetUserID, options) {
9475
+ return _regeneratorRuntime.wrap(function _callee41$(_context41) {
9250
9476
  while (1) {
9251
- switch (_context40.prev = _context40.next) {
9477
+ switch (_context41.prev = _context41.next) {
9252
9478
  case 0:
9253
- _context40.next = 2;
9479
+ _context41.next = 2;
9254
9480
  return this.unbanUser(targetUserID, _objectSpread({
9255
9481
  shadow: true
9256
9482
  }, options));
9257
9483
 
9258
9484
  case 2:
9259
- return _context40.abrupt("return", _context40.sent);
9485
+ return _context41.abrupt("return", _context41.sent);
9260
9486
 
9261
9487
  case 3:
9262
9488
  case "end":
9263
- return _context40.stop();
9489
+ return _context41.stop();
9264
9490
  }
9265
9491
  }
9266
- }, _callee40, this);
9492
+ }, _callee41, this);
9267
9493
  }));
9268
9494
 
9269
- function removeShadowBan(_x51, _x52) {
9495
+ function removeShadowBan(_x52, _x53) {
9270
9496
  return _removeShadowBan.apply(this, arguments);
9271
9497
  }
9272
9498
 
@@ -9283,15 +9509,15 @@ var StreamChat = /*#__PURE__*/function () {
9283
9509
  }, {
9284
9510
  key: "muteUser",
9285
9511
  value: function () {
9286
- var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetID, userID) {
9512
+ var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(targetID, userID) {
9287
9513
  var options,
9288
- _args41 = arguments;
9289
- return _regeneratorRuntime.wrap(function _callee41$(_context41) {
9514
+ _args42 = arguments;
9515
+ return _regeneratorRuntime.wrap(function _callee42$(_context42) {
9290
9516
  while (1) {
9291
- switch (_context41.prev = _context41.next) {
9517
+ switch (_context42.prev = _context42.next) {
9292
9518
  case 0:
9293
- options = _args41.length > 2 && _args41[2] !== undefined ? _args41[2] : {};
9294
- _context41.next = 3;
9519
+ options = _args42.length > 2 && _args42[2] !== undefined ? _args42[2] : {};
9520
+ _context42.next = 3;
9295
9521
  return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
9296
9522
  target_id: targetID
9297
9523
  }, userID ? {
@@ -9299,17 +9525,17 @@ var StreamChat = /*#__PURE__*/function () {
9299
9525
  } : {}), options));
9300
9526
 
9301
9527
  case 3:
9302
- return _context41.abrupt("return", _context41.sent);
9528
+ return _context42.abrupt("return", _context42.sent);
9303
9529
 
9304
9530
  case 4:
9305
9531
  case "end":
9306
- return _context41.stop();
9532
+ return _context42.stop();
9307
9533
  }
9308
9534
  }
9309
- }, _callee41, this);
9535
+ }, _callee42, this);
9310
9536
  }));
9311
9537
 
9312
- function muteUser(_x53, _x54) {
9538
+ function muteUser(_x54, _x55) {
9313
9539
  return _muteUser.apply(this, arguments);
9314
9540
  }
9315
9541
 
@@ -9325,12 +9551,12 @@ var StreamChat = /*#__PURE__*/function () {
9325
9551
  }, {
9326
9552
  key: "unmuteUser",
9327
9553
  value: function () {
9328
- var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(targetID, currentUserID) {
9329
- return _regeneratorRuntime.wrap(function _callee42$(_context42) {
9554
+ var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(targetID, currentUserID) {
9555
+ return _regeneratorRuntime.wrap(function _callee43$(_context43) {
9330
9556
  while (1) {
9331
- switch (_context42.prev = _context42.next) {
9557
+ switch (_context43.prev = _context43.next) {
9332
9558
  case 0:
9333
- _context42.next = 2;
9559
+ _context43.next = 2;
9334
9560
  return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
9335
9561
  target_id: targetID
9336
9562
  }, currentUserID ? {
@@ -9338,17 +9564,17 @@ var StreamChat = /*#__PURE__*/function () {
9338
9564
  } : {}));
9339
9565
 
9340
9566
  case 2:
9341
- return _context42.abrupt("return", _context42.sent);
9567
+ return _context43.abrupt("return", _context43.sent);
9342
9568
 
9343
9569
  case 3:
9344
9570
  case "end":
9345
- return _context42.stop();
9571
+ return _context43.stop();
9346
9572
  }
9347
9573
  }
9348
- }, _callee42, this);
9574
+ }, _callee43, this);
9349
9575
  }));
9350
9576
 
9351
- function unmuteUser(_x55, _x56) {
9577
+ function unmuteUser(_x56, _x57) {
9352
9578
  return _unmuteUser.apply(this, arguments);
9353
9579
  }
9354
9580
 
@@ -9383,31 +9609,31 @@ var StreamChat = /*#__PURE__*/function () {
9383
9609
  }, {
9384
9610
  key: "flagMessage",
9385
9611
  value: function () {
9386
- var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(targetMessageID) {
9612
+ var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(targetMessageID) {
9387
9613
  var options,
9388
- _args43 = arguments;
9389
- return _regeneratorRuntime.wrap(function _callee43$(_context43) {
9614
+ _args44 = arguments;
9615
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
9390
9616
  while (1) {
9391
- switch (_context43.prev = _context43.next) {
9617
+ switch (_context44.prev = _context44.next) {
9392
9618
  case 0:
9393
- options = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {};
9394
- _context43.next = 3;
9619
+ options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
9620
+ _context44.next = 3;
9395
9621
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
9396
9622
  target_message_id: targetMessageID
9397
9623
  }, options));
9398
9624
 
9399
9625
  case 3:
9400
- return _context43.abrupt("return", _context43.sent);
9626
+ return _context44.abrupt("return", _context44.sent);
9401
9627
 
9402
9628
  case 4:
9403
9629
  case "end":
9404
- return _context43.stop();
9630
+ return _context44.stop();
9405
9631
  }
9406
9632
  }
9407
- }, _callee43, this);
9633
+ }, _callee44, this);
9408
9634
  }));
9409
9635
 
9410
- function flagMessage(_x57) {
9636
+ function flagMessage(_x58) {
9411
9637
  return _flagMessage.apply(this, arguments);
9412
9638
  }
9413
9639
 
@@ -9423,31 +9649,31 @@ var StreamChat = /*#__PURE__*/function () {
9423
9649
  }, {
9424
9650
  key: "flagUser",
9425
9651
  value: function () {
9426
- var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(targetID) {
9652
+ var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(targetID) {
9427
9653
  var options,
9428
- _args44 = arguments;
9429
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
9654
+ _args45 = arguments;
9655
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
9430
9656
  while (1) {
9431
- switch (_context44.prev = _context44.next) {
9657
+ switch (_context45.prev = _context45.next) {
9432
9658
  case 0:
9433
- options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
9434
- _context44.next = 3;
9659
+ options = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {};
9660
+ _context45.next = 3;
9435
9661
  return this.post(this.baseURL + '/moderation/flag', _objectSpread({
9436
9662
  target_user_id: targetID
9437
9663
  }, options));
9438
9664
 
9439
9665
  case 3:
9440
- return _context44.abrupt("return", _context44.sent);
9666
+ return _context45.abrupt("return", _context45.sent);
9441
9667
 
9442
9668
  case 4:
9443
9669
  case "end":
9444
- return _context44.stop();
9670
+ return _context45.stop();
9445
9671
  }
9446
9672
  }
9447
- }, _callee44, this);
9673
+ }, _callee45, this);
9448
9674
  }));
9449
9675
 
9450
- function flagUser(_x58) {
9676
+ function flagUser(_x59) {
9451
9677
  return _flagUser.apply(this, arguments);
9452
9678
  }
9453
9679
 
@@ -9463,31 +9689,31 @@ var StreamChat = /*#__PURE__*/function () {
9463
9689
  }, {
9464
9690
  key: "unflagMessage",
9465
9691
  value: function () {
9466
- var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(targetMessageID) {
9692
+ var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(targetMessageID) {
9467
9693
  var options,
9468
- _args45 = arguments;
9469
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
9694
+ _args46 = arguments;
9695
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
9470
9696
  while (1) {
9471
- switch (_context45.prev = _context45.next) {
9697
+ switch (_context46.prev = _context46.next) {
9472
9698
  case 0:
9473
- options = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {};
9474
- _context45.next = 3;
9699
+ options = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
9700
+ _context46.next = 3;
9475
9701
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
9476
9702
  target_message_id: targetMessageID
9477
9703
  }, options));
9478
9704
 
9479
9705
  case 3:
9480
- return _context45.abrupt("return", _context45.sent);
9706
+ return _context46.abrupt("return", _context46.sent);
9481
9707
 
9482
9708
  case 4:
9483
9709
  case "end":
9484
- return _context45.stop();
9710
+ return _context46.stop();
9485
9711
  }
9486
9712
  }
9487
- }, _callee45, this);
9713
+ }, _callee46, this);
9488
9714
  }));
9489
9715
 
9490
- function unflagMessage(_x59) {
9716
+ function unflagMessage(_x60) {
9491
9717
  return _unflagMessage.apply(this, arguments);
9492
9718
  }
9493
9719
 
@@ -9503,31 +9729,31 @@ var StreamChat = /*#__PURE__*/function () {
9503
9729
  }, {
9504
9730
  key: "unflagUser",
9505
9731
  value: function () {
9506
- var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(targetID) {
9732
+ var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(targetID) {
9507
9733
  var options,
9508
- _args46 = arguments;
9509
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
9734
+ _args47 = arguments;
9735
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
9510
9736
  while (1) {
9511
- switch (_context46.prev = _context46.next) {
9737
+ switch (_context47.prev = _context47.next) {
9512
9738
  case 0:
9513
- options = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
9514
- _context46.next = 3;
9739
+ options = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {};
9740
+ _context47.next = 3;
9515
9741
  return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
9516
9742
  target_user_id: targetID
9517
9743
  }, options));
9518
9744
 
9519
9745
  case 3:
9520
- return _context46.abrupt("return", _context46.sent);
9746
+ return _context47.abrupt("return", _context47.sent);
9521
9747
 
9522
9748
  case 4:
9523
9749
  case "end":
9524
- return _context46.stop();
9750
+ return _context47.stop();
9525
9751
  }
9526
9752
  }
9527
- }, _callee46, this);
9753
+ }, _callee47, this);
9528
9754
  }));
9529
9755
 
9530
- function unflagUser(_x60) {
9756
+ function unflagUser(_x61) {
9531
9757
  return _unflagUser.apply(this, arguments);
9532
9758
  }
9533
9759
 
@@ -9544,29 +9770,29 @@ var StreamChat = /*#__PURE__*/function () {
9544
9770
  }, {
9545
9771
  key: "getCallToken",
9546
9772
  value: function () {
9547
- var _getCallToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(callID) {
9773
+ var _getCallToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(callID) {
9548
9774
  var options,
9549
- _args47 = arguments;
9550
- return _regeneratorRuntime.wrap(function _callee47$(_context47) {
9775
+ _args48 = arguments;
9776
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
9551
9777
  while (1) {
9552
- switch (_context47.prev = _context47.next) {
9778
+ switch (_context48.prev = _context48.next) {
9553
9779
  case 0:
9554
- options = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {};
9555
- _context47.next = 3;
9780
+ options = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {};
9781
+ _context48.next = 3;
9556
9782
  return this.post(this.baseURL + "/calls/".concat(callID), _objectSpread({}, options));
9557
9783
 
9558
9784
  case 3:
9559
- return _context47.abrupt("return", _context47.sent);
9785
+ return _context48.abrupt("return", _context48.sent);
9560
9786
 
9561
9787
  case 4:
9562
9788
  case "end":
9563
- return _context47.stop();
9789
+ return _context48.stop();
9564
9790
  }
9565
9791
  }
9566
- }, _callee47, this);
9792
+ }, _callee48, this);
9567
9793
  }));
9568
9794
 
9569
- function getCallToken(_x61) {
9795
+ function getCallToken(_x62) {
9570
9796
  return _getCallToken.apply(this, arguments);
9571
9797
  }
9572
9798
 
@@ -9589,30 +9815,30 @@ var StreamChat = /*#__PURE__*/function () {
9589
9815
  }, {
9590
9816
  key: "_queryFlags",
9591
9817
  value: function () {
9592
- var _queryFlags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48() {
9818
+ var _queryFlags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49() {
9593
9819
  var filterConditions,
9594
9820
  options,
9595
- _args48 = arguments;
9596
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
9821
+ _args49 = arguments;
9822
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
9597
9823
  while (1) {
9598
- switch (_context48.prev = _context48.next) {
9824
+ switch (_context49.prev = _context49.next) {
9599
9825
  case 0:
9600
- filterConditions = _args48.length > 0 && _args48[0] !== undefined ? _args48[0] : {};
9601
- options = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {};
9602
- _context48.next = 4;
9826
+ filterConditions = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : {};
9827
+ options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
9828
+ _context49.next = 4;
9603
9829
  return this.post(this.baseURL + '/moderation/flags', _objectSpread({
9604
9830
  filter_conditions: filterConditions
9605
9831
  }, options));
9606
9832
 
9607
9833
  case 4:
9608
- return _context48.abrupt("return", _context48.sent);
9834
+ return _context49.abrupt("return", _context49.sent);
9609
9835
 
9610
9836
  case 5:
9611
9837
  case "end":
9612
- return _context48.stop();
9838
+ return _context49.stop();
9613
9839
  }
9614
9840
  }
9615
- }, _callee48, this);
9841
+ }, _callee49, this);
9616
9842
  }));
9617
9843
 
9618
9844
  function _queryFlags() {
@@ -9638,30 +9864,30 @@ var StreamChat = /*#__PURE__*/function () {
9638
9864
  }, {
9639
9865
  key: "_queryFlagReports",
9640
9866
  value: function () {
9641
- var _queryFlagReports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49() {
9867
+ var _queryFlagReports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50() {
9642
9868
  var filterConditions,
9643
9869
  options,
9644
- _args49 = arguments;
9645
- return _regeneratorRuntime.wrap(function _callee49$(_context49) {
9870
+ _args50 = arguments;
9871
+ return _regeneratorRuntime.wrap(function _callee50$(_context50) {
9646
9872
  while (1) {
9647
- switch (_context49.prev = _context49.next) {
9873
+ switch (_context50.prev = _context50.next) {
9648
9874
  case 0:
9649
- filterConditions = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : {};
9650
- options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
9651
- _context49.next = 4;
9875
+ filterConditions = _args50.length > 0 && _args50[0] !== undefined ? _args50[0] : {};
9876
+ options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
9877
+ _context50.next = 4;
9652
9878
  return this.post(this.baseURL + '/moderation/reports', _objectSpread({
9653
9879
  filter_conditions: filterConditions
9654
9880
  }, options));
9655
9881
 
9656
9882
  case 4:
9657
- return _context49.abrupt("return", _context49.sent);
9883
+ return _context50.abrupt("return", _context50.sent);
9658
9884
 
9659
9885
  case 5:
9660
9886
  case "end":
9661
- return _context49.stop();
9887
+ return _context50.stop();
9662
9888
  }
9663
9889
  }
9664
- }, _callee49, this);
9890
+ }, _callee50, this);
9665
9891
  }));
9666
9892
 
9667
9893
  function _queryFlagReports() {
@@ -9688,31 +9914,31 @@ var StreamChat = /*#__PURE__*/function () {
9688
9914
  }, {
9689
9915
  key: "_reviewFlagReport",
9690
9916
  value: function () {
9691
- var _reviewFlagReport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(id, reviewResult) {
9917
+ var _reviewFlagReport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(id, reviewResult) {
9692
9918
  var options,
9693
- _args50 = arguments;
9694
- return _regeneratorRuntime.wrap(function _callee50$(_context50) {
9919
+ _args51 = arguments;
9920
+ return _regeneratorRuntime.wrap(function _callee51$(_context51) {
9695
9921
  while (1) {
9696
- switch (_context50.prev = _context50.next) {
9922
+ switch (_context51.prev = _context51.next) {
9697
9923
  case 0:
9698
- options = _args50.length > 2 && _args50[2] !== undefined ? _args50[2] : {};
9699
- _context50.next = 3;
9924
+ options = _args51.length > 2 && _args51[2] !== undefined ? _args51[2] : {};
9925
+ _context51.next = 3;
9700
9926
  return this.patch(this.baseURL + "/moderation/reports/".concat(id), _objectSpread({
9701
9927
  review_result: reviewResult
9702
9928
  }, options));
9703
9929
 
9704
9930
  case 3:
9705
- return _context50.abrupt("return", _context50.sent);
9931
+ return _context51.abrupt("return", _context51.sent);
9706
9932
 
9707
9933
  case 4:
9708
9934
  case "end":
9709
- return _context50.stop();
9935
+ return _context51.stop();
9710
9936
  }
9711
9937
  }
9712
- }, _callee50, this);
9938
+ }, _callee51, this);
9713
9939
  }));
9714
9940
 
9715
- function _reviewFlagReport(_x62, _x63) {
9941
+ function _reviewFlagReport(_x63, _x64) {
9716
9942
  return _reviewFlagReport2.apply(this, arguments);
9717
9943
  }
9718
9944
 
@@ -9730,31 +9956,31 @@ var StreamChat = /*#__PURE__*/function () {
9730
9956
  }, {
9731
9957
  key: "unblockMessage",
9732
9958
  value: function () {
9733
- var _unblockMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(targetMessageID) {
9959
+ var _unblockMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(targetMessageID) {
9734
9960
  var options,
9735
- _args51 = arguments;
9736
- return _regeneratorRuntime.wrap(function _callee51$(_context51) {
9961
+ _args52 = arguments;
9962
+ return _regeneratorRuntime.wrap(function _callee52$(_context52) {
9737
9963
  while (1) {
9738
- switch (_context51.prev = _context51.next) {
9964
+ switch (_context52.prev = _context52.next) {
9739
9965
  case 0:
9740
- options = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {};
9741
- _context51.next = 3;
9966
+ options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
9967
+ _context52.next = 3;
9742
9968
  return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
9743
9969
  target_message_id: targetMessageID
9744
9970
  }, options));
9745
9971
 
9746
9972
  case 3:
9747
- return _context51.abrupt("return", _context51.sent);
9973
+ return _context52.abrupt("return", _context52.sent);
9748
9974
 
9749
9975
  case 4:
9750
9976
  case "end":
9751
- return _context51.stop();
9977
+ return _context52.stop();
9752
9978
  }
9753
9979
  }
9754
- }, _callee51, this);
9980
+ }, _callee52, this);
9755
9981
  }));
9756
9982
 
9757
- function unblockMessage(_x64) {
9983
+ function unblockMessage(_x65) {
9758
9984
  return _unblockMessage.apply(this, arguments);
9759
9985
  }
9760
9986
 
@@ -9773,23 +9999,23 @@ var StreamChat = /*#__PURE__*/function () {
9773
9999
  * @return {Promise<APIResponse>}
9774
10000
  */
9775
10001
  function () {
9776
- var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52() {
10002
+ var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53() {
9777
10003
  var data,
9778
- _args52 = arguments;
9779
- return _regeneratorRuntime.wrap(function _callee52$(_context52) {
10004
+ _args53 = arguments;
10005
+ return _regeneratorRuntime.wrap(function _callee53$(_context53) {
9780
10006
  while (1) {
9781
- switch (_context52.prev = _context52.next) {
10007
+ switch (_context53.prev = _context53.next) {
9782
10008
  case 0:
9783
- data = _args52.length > 0 && _args52[0] !== undefined ? _args52[0] : {};
9784
- _context52.next = 3;
10009
+ data = _args53.length > 0 && _args53[0] !== undefined ? _args53[0] : {};
10010
+ _context53.next = 3;
9785
10011
  return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
9786
10012
 
9787
10013
  case 3:
9788
10014
  case "end":
9789
- return _context52.stop();
10015
+ return _context53.stop();
9790
10016
  }
9791
10017
  }
9792
- }, _callee52, this);
10018
+ }, _callee53, this);
9793
10019
  }));
9794
10020
 
9795
10021
  function markChannelsRead() {
@@ -9864,28 +10090,28 @@ var StreamChat = /*#__PURE__*/function () {
9864
10090
  }, {
9865
10091
  key: "translateMessage",
9866
10092
  value: function () {
9867
- var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(messageId, language) {
9868
- return _regeneratorRuntime.wrap(function _callee53$(_context53) {
10093
+ var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(messageId, language) {
10094
+ return _regeneratorRuntime.wrap(function _callee54$(_context54) {
9869
10095
  while (1) {
9870
- switch (_context53.prev = _context53.next) {
10096
+ switch (_context54.prev = _context54.next) {
9871
10097
  case 0:
9872
- _context53.next = 2;
10098
+ _context54.next = 2;
9873
10099
  return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
9874
10100
  language: language
9875
10101
  });
9876
10102
 
9877
10103
  case 2:
9878
- return _context53.abrupt("return", _context53.sent);
10104
+ return _context54.abrupt("return", _context54.sent);
9879
10105
 
9880
10106
  case 3:
9881
10107
  case "end":
9882
- return _context53.stop();
10108
+ return _context54.stop();
9883
10109
  }
9884
10110
  }
9885
- }, _callee53, this);
10111
+ }, _callee54, this);
9886
10112
  }));
9887
10113
 
9888
- function translateMessage(_x65, _x66) {
10114
+ function translateMessage(_x66, _x67) {
9889
10115
  return _translateMessage.apply(this, arguments);
9890
10116
  }
9891
10117
 
@@ -9987,14 +10213,14 @@ var StreamChat = /*#__PURE__*/function () {
9987
10213
  }, {
9988
10214
  key: "updateMessage",
9989
10215
  value: function () {
9990
- var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(message, userId, options) {
10216
+ var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(message, userId, options) {
9991
10217
  var clonedMessage, reservedMessageFields;
9992
- return _regeneratorRuntime.wrap(function _callee54$(_context54) {
10218
+ return _regeneratorRuntime.wrap(function _callee55$(_context55) {
9993
10219
  while (1) {
9994
- switch (_context54.prev = _context54.next) {
10220
+ switch (_context55.prev = _context55.next) {
9995
10221
  case 0:
9996
10222
  if (message.id) {
9997
- _context54.next = 2;
10223
+ _context55.next = 2;
9998
10224
  break;
9999
10225
  }
10000
10226
 
@@ -10031,158 +10257,345 @@ var StreamChat = /*#__PURE__*/function () {
10031
10257
  });
10032
10258
  }
10033
10259
 
10034
- _context54.next = 10;
10260
+ _context55.next = 10;
10035
10261
  return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
10036
10262
  message: clonedMessage
10037
10263
  }, options));
10038
10264
 
10039
10265
  case 10:
10040
- return _context54.abrupt("return", _context54.sent);
10266
+ return _context55.abrupt("return", _context55.sent);
10041
10267
 
10042
10268
  case 11:
10043
10269
  case "end":
10044
- return _context54.stop();
10270
+ return _context55.stop();
10045
10271
  }
10046
10272
  }
10047
- }, _callee54, this);
10273
+ }, _callee55, this);
10274
+ }));
10275
+
10276
+ function updateMessage(_x68, _x69, _x70) {
10277
+ return _updateMessage.apply(this, arguments);
10278
+ }
10279
+
10280
+ return updateMessage;
10281
+ }()
10282
+ /**
10283
+ * partialUpdateMessage - Update the given message id while retaining additional properties
10284
+ *
10285
+ * @param {string} id the message id
10286
+ *
10287
+ * @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
10288
+ * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
10289
+ * @param {string | { id: string }} [userId]
10290
+ *
10291
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
10292
+ *
10293
+ * @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
10294
+ */
10295
+
10296
+ }, {
10297
+ key: "partialUpdateMessage",
10298
+ value: function () {
10299
+ var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(id, partialMessageObject, userId, options) {
10300
+ var user;
10301
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
10302
+ while (1) {
10303
+ switch (_context56.prev = _context56.next) {
10304
+ case 0:
10305
+ if (id) {
10306
+ _context56.next = 2;
10307
+ break;
10308
+ }
10309
+
10310
+ throw Error('Please specify the message id when calling partialUpdateMessage');
10311
+
10312
+ case 2:
10313
+ user = userId;
10314
+
10315
+ if (userId != null && isString(userId)) {
10316
+ user = {
10317
+ id: userId
10318
+ };
10319
+ }
10320
+
10321
+ _context56.next = 6;
10322
+ return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
10323
+ user: user
10324
+ }));
10325
+
10326
+ case 6:
10327
+ return _context56.abrupt("return", _context56.sent);
10328
+
10329
+ case 7:
10330
+ case "end":
10331
+ return _context56.stop();
10332
+ }
10333
+ }
10334
+ }, _callee56, this);
10335
+ }));
10336
+
10337
+ function partialUpdateMessage(_x71, _x72, _x73, _x74) {
10338
+ return _partialUpdateMessage.apply(this, arguments);
10339
+ }
10340
+
10341
+ return partialUpdateMessage;
10342
+ }()
10343
+ }, {
10344
+ key: "deleteMessage",
10345
+ value: function () {
10346
+ var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(messageID, hardDelete) {
10347
+ var params;
10348
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
10349
+ while (1) {
10350
+ switch (_context57.prev = _context57.next) {
10351
+ case 0:
10352
+ params = {};
10353
+
10354
+ if (hardDelete) {
10355
+ params = {
10356
+ hard: true
10357
+ };
10358
+ }
10359
+
10360
+ _context57.next = 4;
10361
+ return this.delete(this.baseURL + "/messages/".concat(messageID), params);
10362
+
10363
+ case 4:
10364
+ return _context57.abrupt("return", _context57.sent);
10365
+
10366
+ case 5:
10367
+ case "end":
10368
+ return _context57.stop();
10369
+ }
10370
+ }
10371
+ }, _callee57, this);
10372
+ }));
10373
+
10374
+ function deleteMessage(_x75, _x76) {
10375
+ return _deleteMessage.apply(this, arguments);
10376
+ }
10377
+
10378
+ return deleteMessage;
10379
+ }()
10380
+ }, {
10381
+ key: "getMessage",
10382
+ value: function () {
10383
+ var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(messageID) {
10384
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
10385
+ while (1) {
10386
+ switch (_context58.prev = _context58.next) {
10387
+ case 0:
10388
+ _context58.next = 2;
10389
+ return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
10390
+
10391
+ case 2:
10392
+ return _context58.abrupt("return", _context58.sent);
10393
+
10394
+ case 3:
10395
+ case "end":
10396
+ return _context58.stop();
10397
+ }
10398
+ }
10399
+ }, _callee58, this);
10400
+ }));
10401
+
10402
+ function getMessage(_x77) {
10403
+ return _getMessage.apply(this, arguments);
10404
+ }
10405
+
10406
+ return getMessage;
10407
+ }()
10408
+ /**
10409
+ * queryThreads - returns the list of threads of current user.
10410
+ *
10411
+ * @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
10412
+ * @param {number} options.limit Limits the number of threads to be returned.
10413
+ * @param {boolean} options.watch Subscribes the user to the channels of the threads.
10414
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10415
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10416
+ *
10417
+ * @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
10418
+ */
10419
+
10420
+ }, {
10421
+ key: "queryThreads",
10422
+ value: function () {
10423
+ var _queryThreads = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(options) {
10424
+ var _this5 = this;
10425
+
10426
+ var opts, res;
10427
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
10428
+ while (1) {
10429
+ switch (_context59.prev = _context59.next) {
10430
+ case 0:
10431
+ opts = _objectSpread({
10432
+ limit: 10,
10433
+ participant_limit: 10,
10434
+ reply_limit: 3,
10435
+ watch: true
10436
+ }, options);
10437
+ _context59.next = 3;
10438
+ return this.post(this.baseURL + "/threads", opts);
10439
+
10440
+ case 3:
10441
+ res = _context59.sent;
10442
+ return _context59.abrupt("return", {
10443
+ threads: res.threads.map(function (thread) {
10444
+ return new Thread(_this5, thread);
10445
+ }),
10446
+ next: res.next
10447
+ });
10448
+
10449
+ case 5:
10450
+ case "end":
10451
+ return _context59.stop();
10452
+ }
10453
+ }
10454
+ }, _callee59, this);
10048
10455
  }));
10049
10456
 
10050
- function updateMessage(_x67, _x68, _x69) {
10051
- return _updateMessage.apply(this, arguments);
10457
+ function queryThreads(_x78) {
10458
+ return _queryThreads.apply(this, arguments);
10052
10459
  }
10053
10460
 
10054
- return updateMessage;
10461
+ return queryThreads;
10055
10462
  }()
10056
10463
  /**
10057
- * partialUpdateMessage - Update the given message id while retaining additional properties
10058
- *
10059
- * @param {string} id the message id
10060
- *
10061
- * @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
10062
- * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
10063
- * @param {string | { id: string }} [userId]
10464
+ * getThread - returns the thread of a message by its id.
10064
10465
  *
10065
- * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
10466
+ * @param {string} messageId The message id
10467
+ * @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
10468
+ * @param {boolean} options.watch Subscribes the user to the channel of the thread.
10469
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10470
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10066
10471
  *
10067
- * @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
10472
+ * @returns {Thread<StreamChatGenerics>} Returns the thread.
10068
10473
  */
10069
10474
 
10070
10475
  }, {
10071
- key: "partialUpdateMessage",
10476
+ key: "getThread",
10072
10477
  value: function () {
10073
- var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(id, partialMessageObject, userId, options) {
10074
- var user;
10075
- return _regeneratorRuntime.wrap(function _callee55$(_context55) {
10478
+ var _getThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(messageId) {
10479
+ var options,
10480
+ opts,
10481
+ res,
10482
+ _args60 = arguments;
10483
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
10076
10484
  while (1) {
10077
- switch (_context55.prev = _context55.next) {
10485
+ switch (_context60.prev = _context60.next) {
10078
10486
  case 0:
10079
- if (id) {
10080
- _context55.next = 2;
10487
+ options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
10488
+
10489
+ if (messageId) {
10490
+ _context60.next = 3;
10081
10491
  break;
10082
10492
  }
10083
10493
 
10084
- throw Error('Please specify the message id when calling partialUpdateMessage');
10085
-
10086
- case 2:
10087
- user = userId;
10088
-
10089
- if (userId != null && isString(userId)) {
10090
- user = {
10091
- id: userId
10092
- };
10093
- }
10494
+ throw Error('Please specify the message id when calling partialUpdateThread');
10094
10495
 
10095
- _context55.next = 6;
10096
- return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
10097
- user: user
10098
- }));
10496
+ case 3:
10497
+ opts = _objectSpread({
10498
+ participant_limit: 100,
10499
+ reply_limit: 3,
10500
+ watch: true
10501
+ }, options);
10502
+ _context60.next = 6;
10503
+ return this.get(this.baseURL + "/threads/".concat(messageId), opts);
10099
10504
 
10100
10505
  case 6:
10101
- return _context55.abrupt("return", _context55.sent);
10506
+ res = _context60.sent;
10507
+ return _context60.abrupt("return", new Thread(this, res.thread));
10102
10508
 
10103
- case 7:
10509
+ case 8:
10104
10510
  case "end":
10105
- return _context55.stop();
10511
+ return _context60.stop();
10106
10512
  }
10107
10513
  }
10108
- }, _callee55, this);
10514
+ }, _callee60, this);
10109
10515
  }));
10110
10516
 
10111
- function partialUpdateMessage(_x70, _x71, _x72, _x73) {
10112
- return _partialUpdateMessage.apply(this, arguments);
10517
+ function getThread(_x79) {
10518
+ return _getThread.apply(this, arguments);
10113
10519
  }
10114
10520
 
10115
- return partialUpdateMessage;
10521
+ return getThread;
10116
10522
  }()
10523
+ /**
10524
+ * partialUpdateThread - updates the given thread
10525
+ *
10526
+ * @param {string} messageId The id of the thread message which needs to be updated.
10527
+ * @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
10528
+ *
10529
+ * @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
10530
+ */
10531
+
10117
10532
  }, {
10118
- key: "deleteMessage",
10533
+ key: "partialUpdateThread",
10119
10534
  value: function () {
10120
- var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(messageID, hardDelete) {
10121
- var params;
10122
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
10535
+ var _partialUpdateThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(messageId, partialThreadObject) {
10536
+ var reservedThreadFields, _key5;
10537
+
10538
+ return _regeneratorRuntime.wrap(function _callee61$(_context61) {
10123
10539
  while (1) {
10124
- switch (_context56.prev = _context56.next) {
10540
+ switch (_context61.prev = _context61.next) {
10125
10541
  case 0:
10126
- params = {};
10127
-
10128
- if (hardDelete) {
10129
- params = {
10130
- hard: true
10131
- };
10542
+ if (messageId) {
10543
+ _context61.next = 2;
10544
+ break;
10132
10545
  }
10133
10546
 
10134
- _context56.next = 4;
10135
- return this.delete(this.baseURL + "/messages/".concat(messageID), params);
10547
+ throw Error('Please specify the message id when calling partialUpdateThread');
10548
+
10549
+ case 2:
10550
+ // check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
10551
+ // Throw error if any of the reserved field is found.
10552
+ reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
10553
+ _context61.t0 = _regeneratorRuntime.keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
10136
10554
 
10137
10555
  case 4:
10138
- return _context56.abrupt("return", _context56.sent);
10556
+ if ((_context61.t1 = _context61.t0()).done) {
10557
+ _context61.next = 10;
10558
+ break;
10559
+ }
10139
10560
 
10140
- case 5:
10141
- case "end":
10142
- return _context56.stop();
10143
- }
10144
- }
10145
- }, _callee56, this);
10146
- }));
10561
+ _key5 = _context61.t1.value;
10147
10562
 
10148
- function deleteMessage(_x74, _x75) {
10149
- return _deleteMessage.apply(this, arguments);
10150
- }
10563
+ if (!reservedThreadFields.includes(_key5)) {
10564
+ _context61.next = 8;
10565
+ break;
10566
+ }
10151
10567
 
10152
- return deleteMessage;
10153
- }()
10154
- }, {
10155
- key: "getMessage",
10156
- value: function () {
10157
- var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(messageID) {
10158
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
10159
- while (1) {
10160
- switch (_context57.prev = _context57.next) {
10161
- case 0:
10162
- _context57.next = 2;
10163
- return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
10568
+ throw Error("You cannot set ".concat(_key5, " field on Thread object. ").concat(_key5, " is reserved for server-side use. Please omit ").concat(_key5, " from your set object."));
10164
10569
 
10165
- case 2:
10166
- return _context57.abrupt("return", _context57.sent);
10570
+ case 8:
10571
+ _context61.next = 4;
10572
+ break;
10167
10573
 
10168
- case 3:
10574
+ case 10:
10575
+ _context61.next = 12;
10576
+ return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
10577
+
10578
+ case 12:
10579
+ return _context61.abrupt("return", _context61.sent);
10580
+
10581
+ case 13:
10169
10582
  case "end":
10170
- return _context57.stop();
10583
+ return _context61.stop();
10171
10584
  }
10172
10585
  }
10173
- }, _callee57, this);
10586
+ }, _callee61, this);
10174
10587
  }));
10175
10588
 
10176
- function getMessage(_x76) {
10177
- return _getMessage.apply(this, arguments);
10589
+ function partialUpdateThread(_x80, _x81) {
10590
+ return _partialUpdateThread.apply(this, arguments);
10178
10591
  }
10179
10592
 
10180
- return getMessage;
10593
+ return partialUpdateThread;
10181
10594
  }()
10182
10595
  }, {
10183
10596
  key: "getUserAgent",
10184
10597
  value: function getUserAgent() {
10185
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.14.5");
10598
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
10186
10599
  }
10187
10600
  }, {
10188
10601
  key: "setUserAgent",
@@ -10401,28 +10814,28 @@ var StreamChat = /*#__PURE__*/function () {
10401
10814
  }, {
10402
10815
  key: "sendUserCustomEvent",
10403
10816
  value: function () {
10404
- var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(targetUserID, event) {
10405
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
10817
+ var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(targetUserID, event) {
10818
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
10406
10819
  while (1) {
10407
- switch (_context58.prev = _context58.next) {
10820
+ switch (_context62.prev = _context62.next) {
10408
10821
  case 0:
10409
- _context58.next = 2;
10822
+ _context62.next = 2;
10410
10823
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
10411
10824
  event: event
10412
10825
  });
10413
10826
 
10414
10827
  case 2:
10415
- return _context58.abrupt("return", _context58.sent);
10828
+ return _context62.abrupt("return", _context62.sent);
10416
10829
 
10417
10830
  case 3:
10418
10831
  case "end":
10419
- return _context58.stop();
10832
+ return _context62.stop();
10420
10833
  }
10421
10834
  }
10422
- }, _callee58, this);
10835
+ }, _callee62, this);
10423
10836
  }));
10424
10837
 
10425
- function sendUserCustomEvent(_x77, _x78) {
10838
+ function sendUserCustomEvent(_x82, _x83) {
10426
10839
  return _sendUserCustomEvent.apply(this, arguments);
10427
10840
  }
10428
10841
 
@@ -10480,50 +10893,259 @@ var StreamChat = /*#__PURE__*/function () {
10480
10893
  return this.get("".concat(this.baseURL, "/export_channels/").concat(id));
10481
10894
  }
10482
10895
  /**
10483
- * createSegment - Creates a Campaign Segment
10896
+ * createSegment - Creates a segment
10897
+ *
10898
+ * @private
10899
+ * @param {SegmentType} type Segment type
10900
+ * @param {string} id Segment ID (valid UUID)
10901
+ * @param {string} name Segment name (valid UUID)
10902
+ * @param {SegmentData} params Segment data
10903
+ *
10904
+ * @return {Segment} The created Segment
10905
+ */
10906
+
10907
+ }, {
10908
+ key: "createSegment",
10909
+ value: function () {
10910
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(type, id, name, data) {
10911
+ var body, _yield$this$post, segment;
10912
+
10913
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
10914
+ while (1) {
10915
+ switch (_context63.prev = _context63.next) {
10916
+ case 0:
10917
+ body = {
10918
+ id: id,
10919
+ type: type,
10920
+ name: name,
10921
+ data: data
10922
+ };
10923
+ _context63.next = 3;
10924
+ return this.post(this.baseURL + "/segments", body);
10925
+
10926
+ case 3:
10927
+ _yield$this$post = _context63.sent;
10928
+ segment = _yield$this$post.segment;
10929
+ return _context63.abrupt("return", segment);
10930
+
10931
+ case 6:
10932
+ case "end":
10933
+ return _context63.stop();
10934
+ }
10935
+ }
10936
+ }, _callee63, this);
10937
+ }));
10938
+
10939
+ function createSegment(_x84, _x85, _x86, _x87) {
10940
+ return _createSegment.apply(this, arguments);
10941
+ }
10942
+
10943
+ return createSegment;
10944
+ }()
10945
+ /**
10946
+ * createUserSegment - Creates a user segment
10947
+ *
10948
+ * @param {string} id Segment ID (valid UUID)
10949
+ * @param {string} name Segment name
10950
+ * @param {SegmentData} data Segment data
10951
+ *
10952
+ * @return {Segment} The created Segment
10953
+ */
10954
+
10955
+ }, {
10956
+ key: "createUserSegment",
10957
+ value: function () {
10958
+ var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id, name, data) {
10959
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
10960
+ while (1) {
10961
+ switch (_context64.prev = _context64.next) {
10962
+ case 0:
10963
+ _context64.next = 2;
10964
+ return this.createSegment('user', id, name, data);
10965
+
10966
+ case 2:
10967
+ return _context64.abrupt("return", _context64.sent);
10968
+
10969
+ case 3:
10970
+ case "end":
10971
+ return _context64.stop();
10972
+ }
10973
+ }
10974
+ }, _callee64, this);
10975
+ }));
10976
+
10977
+ function createUserSegment(_x88, _x89, _x90) {
10978
+ return _createUserSegment.apply(this, arguments);
10979
+ }
10980
+
10981
+ return createUserSegment;
10982
+ }()
10983
+ /**
10984
+ * createChannelSegment - Creates a channel segment
10985
+ *
10986
+ * @param {string} id Segment ID (valid UUID)
10987
+ * @param {string} name Segment name
10988
+ * @param {SegmentData} data Segment data
10989
+ *
10990
+ * @return {Segment} The created Segment
10991
+ */
10992
+
10993
+ }, {
10994
+ key: "createChannelSegment",
10995
+ value: function () {
10996
+ var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, name, data) {
10997
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
10998
+ while (1) {
10999
+ switch (_context65.prev = _context65.next) {
11000
+ case 0:
11001
+ _context65.next = 2;
11002
+ return this.createSegment('channel', id, name, data);
11003
+
11004
+ case 2:
11005
+ return _context65.abrupt("return", _context65.sent);
11006
+
11007
+ case 3:
11008
+ case "end":
11009
+ return _context65.stop();
11010
+ }
11011
+ }
11012
+ }, _callee65, this);
11013
+ }));
11014
+
11015
+ function createChannelSegment(_x91, _x92, _x93) {
11016
+ return _createChannelSegment.apply(this, arguments);
11017
+ }
11018
+
11019
+ return createChannelSegment;
11020
+ }()
11021
+ /**
11022
+ * updateSegment - Update a segment
11023
+ *
11024
+ * @param {string} id Segment ID
11025
+ * @param {Partial<UpdateSegmentData>} data Data to update
11026
+ *
11027
+ * @return {Segment} Updated Segment
11028
+ */
11029
+
11030
+ }, {
11031
+ key: "updateSegment",
11032
+ value: function () {
11033
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
11034
+ var _yield$this$put, segment;
11035
+
11036
+ return _regeneratorRuntime.wrap(function _callee66$(_context66) {
11037
+ while (1) {
11038
+ switch (_context66.prev = _context66.next) {
11039
+ case 0:
11040
+ _context66.next = 2;
11041
+ return this.put(this.baseURL + "/segments/".concat(id), data);
11042
+
11043
+ case 2:
11044
+ _yield$this$put = _context66.sent;
11045
+ segment = _yield$this$put.segment;
11046
+ return _context66.abrupt("return", segment);
11047
+
11048
+ case 5:
11049
+ case "end":
11050
+ return _context66.stop();
11051
+ }
11052
+ }
11053
+ }, _callee66, this);
11054
+ }));
11055
+
11056
+ function updateSegment(_x94, _x95) {
11057
+ return _updateSegment.apply(this, arguments);
11058
+ }
11059
+
11060
+ return updateSegment;
11061
+ }()
11062
+ /**
11063
+ * addSegmentTargets - Add targets to a segment
11064
+ *
11065
+ * @param {string} id Segment ID
11066
+ * @param {string[]} targets Targets to add to the segment
11067
+ *
11068
+ * @return {APIResponse} API response
11069
+ */
11070
+
11071
+ }, {
11072
+ key: "addSegmentTargets",
11073
+ value: function () {
11074
+ var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, targets) {
11075
+ var body;
11076
+ return _regeneratorRuntime.wrap(function _callee67$(_context67) {
11077
+ while (1) {
11078
+ switch (_context67.prev = _context67.next) {
11079
+ case 0:
11080
+ body = {
11081
+ targets: targets
11082
+ };
11083
+ _context67.next = 3;
11084
+ return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
11085
+
11086
+ case 3:
11087
+ return _context67.abrupt("return", _context67.sent);
11088
+
11089
+ case 4:
11090
+ case "end":
11091
+ return _context67.stop();
11092
+ }
11093
+ }
11094
+ }, _callee67, this);
11095
+ }));
11096
+
11097
+ function addSegmentTargets(_x96, _x97) {
11098
+ return _addSegmentTargets.apply(this, arguments);
11099
+ }
11100
+
11101
+ return addSegmentTargets;
11102
+ }()
11103
+ /**
11104
+ * deleteSegmentTargets - Delete targets from a segment
10484
11105
  *
10485
- * @param {SegmentData} params Segment data
11106
+ * @param {string} id Segment ID
11107
+ * @param {string[]} targets Targets to add to the segment
10486
11108
  *
10487
- * @return {Segment} The Created Segment
11109
+ * @return {APIResponse} API response
10488
11110
  */
10489
11111
 
10490
11112
  }, {
10491
- key: "createSegment",
11113
+ key: "deleteSegmentTargets",
10492
11114
  value: function () {
10493
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(params) {
10494
- var _yield$this$post, segment;
10495
-
10496
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
11115
+ var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
11116
+ var body;
11117
+ return _regeneratorRuntime.wrap(function _callee68$(_context68) {
10497
11118
  while (1) {
10498
- switch (_context59.prev = _context59.next) {
11119
+ switch (_context68.prev = _context68.next) {
10499
11120
  case 0:
10500
- _context59.next = 2;
10501
- return this.post(this.baseURL + "/segments", {
10502
- segment: params
10503
- });
11121
+ body = {
11122
+ targets: targets
11123
+ };
11124
+ _context68.next = 3;
11125
+ return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
10504
11126
 
10505
- case 2:
10506
- _yield$this$post = _context59.sent;
10507
- segment = _yield$this$post.segment;
10508
- return _context59.abrupt("return", segment);
11127
+ case 3:
11128
+ return _context68.abrupt("return", _context68.sent);
10509
11129
 
10510
- case 5:
11130
+ case 4:
10511
11131
  case "end":
10512
- return _context59.stop();
11132
+ return _context68.stop();
10513
11133
  }
10514
11134
  }
10515
- }, _callee59, this);
11135
+ }, _callee68, this);
10516
11136
  }));
10517
11137
 
10518
- function createSegment(_x79) {
10519
- return _createSegment.apply(this, arguments);
11138
+ function deleteSegmentTargets(_x98, _x99) {
11139
+ return _deleteSegmentTargets.apply(this, arguments);
10520
11140
  }
10521
11141
 
10522
- return createSegment;
11142
+ return deleteSegmentTargets;
10523
11143
  }()
10524
11144
  /**
10525
- * querySegments - Query Campaign Segments
11145
+ * querySegments - Query Segments
10526
11146
  *
11147
+ * @param {filter} filter MongoDB style filter conditions
11148
+ * @param {QuerySegmentsOptions} options Options for sorting/paginating the results
10527
11149
  *
10528
11150
  * @return {Segment[]} Segments
10529
11151
  */
@@ -10531,112 +11153,110 @@ var StreamChat = /*#__PURE__*/function () {
10531
11153
  }, {
10532
11154
  key: "querySegments",
10533
11155
  value: function () {
10534
- var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(filters) {
11156
+ var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(filter) {
10535
11157
  var options,
10536
- _args60 = arguments;
10537
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
11158
+ _args69 = arguments;
11159
+ return _regeneratorRuntime.wrap(function _callee69$(_context69) {
10538
11160
  while (1) {
10539
- switch (_context60.prev = _context60.next) {
11161
+ switch (_context69.prev = _context69.next) {
10540
11162
  case 0:
10541
- options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
10542
- _context60.next = 3;
11163
+ options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11164
+ _context69.next = 3;
10543
11165
  return this.get(this.baseURL + "/segments", {
10544
11166
  payload: _objectSpread({
10545
- filter_conditions: filters
11167
+ filter: filter
10546
11168
  }, options)
10547
11169
  });
10548
11170
 
10549
11171
  case 3:
10550
- return _context60.abrupt("return", _context60.sent);
11172
+ return _context69.abrupt("return", _context69.sent);
10551
11173
 
10552
11174
  case 4:
10553
11175
  case "end":
10554
- return _context60.stop();
11176
+ return _context69.stop();
10555
11177
  }
10556
11178
  }
10557
- }, _callee60, this);
11179
+ }, _callee69, this);
10558
11180
  }));
10559
11181
 
10560
- function querySegments(_x80) {
11182
+ function querySegments(_x100) {
10561
11183
  return _querySegments.apply(this, arguments);
10562
11184
  }
10563
11185
 
10564
11186
  return querySegments;
10565
11187
  }()
10566
11188
  /**
10567
- * updateSegment - Update a Campaign Segment
11189
+ * deleteSegment - Delete a Campaign Segment
10568
11190
  *
10569
11191
  * @param {string} id Segment ID
10570
- * @param {Partial<SegmentData>} params Segment data
10571
11192
  *
10572
- * @return {Segment} Updated Segment
11193
+ * @return {Promise<APIResponse>} The Server Response
10573
11194
  */
10574
11195
 
10575
11196
  }, {
10576
- key: "updateSegment",
11197
+ key: "deleteSegment",
10577
11198
  value: function () {
10578
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id, params) {
10579
- var _yield$this$put, segment;
10580
-
10581
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
11199
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id) {
11200
+ return _regeneratorRuntime.wrap(function _callee70$(_context70) {
10582
11201
  while (1) {
10583
- switch (_context61.prev = _context61.next) {
11202
+ switch (_context70.prev = _context70.next) {
10584
11203
  case 0:
10585
- _context61.next = 2;
10586
- return this.put(this.baseURL + "/segments/".concat(id), {
10587
- segment: params
10588
- });
11204
+ _context70.next = 2;
11205
+ return this.delete(this.baseURL + "/segments/".concat(id));
10589
11206
 
10590
11207
  case 2:
10591
- _yield$this$put = _context61.sent;
10592
- segment = _yield$this$put.segment;
10593
- return _context61.abrupt("return", segment);
11208
+ return _context70.abrupt("return", _context70.sent);
10594
11209
 
10595
- case 5:
11210
+ case 3:
10596
11211
  case "end":
10597
- return _context61.stop();
11212
+ return _context70.stop();
10598
11213
  }
10599
11214
  }
10600
- }, _callee61, this);
11215
+ }, _callee70, this);
10601
11216
  }));
10602
11217
 
10603
- function updateSegment(_x81, _x82) {
10604
- return _updateSegment.apply(this, arguments);
11218
+ function deleteSegment(_x101) {
11219
+ return _deleteSegment.apply(this, arguments);
10605
11220
  }
10606
11221
 
10607
- return updateSegment;
11222
+ return deleteSegment;
10608
11223
  }()
10609
11224
  /**
10610
- * deleteSegment - Delete a Campaign Segment
11225
+ * segmentTargetExists - Check if a target exists in a segment
10611
11226
  *
10612
- * @param {string} id Segment ID
11227
+ * @param {string} segmentId Segment ID
11228
+ * @param {string} targetId Target ID
10613
11229
  *
10614
11230
  * @return {Promise<APIResponse>} The Server Response
10615
11231
  */
10616
11232
 
10617
11233
  }, {
10618
- key: "deleteSegment",
11234
+ key: "segmentTargetExists",
10619
11235
  value: function () {
10620
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id) {
10621
- return _regeneratorRuntime.wrap(function _callee62$(_context62) {
11236
+ var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(segmentId, targetId) {
11237
+ return _regeneratorRuntime.wrap(function _callee71$(_context71) {
10622
11238
  while (1) {
10623
- switch (_context62.prev = _context62.next) {
11239
+ switch (_context71.prev = _context71.next) {
10624
11240
  case 0:
10625
- return _context62.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
11241
+ _context71.next = 2;
11242
+ return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
10626
11243
 
10627
- case 1:
11244
+ case 2:
11245
+ return _context71.abrupt("return", _context71.sent);
11246
+
11247
+ case 3:
10628
11248
  case "end":
10629
- return _context62.stop();
11249
+ return _context71.stop();
10630
11250
  }
10631
11251
  }
10632
- }, _callee62, this);
11252
+ }, _callee71, this);
10633
11253
  }));
10634
11254
 
10635
- function deleteSegment(_x83) {
10636
- return _deleteSegment.apply(this, arguments);
11255
+ function segmentTargetExists(_x102, _x103) {
11256
+ return _segmentTargetExists.apply(this, arguments);
10637
11257
  }
10638
11258
 
10639
- return deleteSegment;
11259
+ return segmentTargetExists;
10640
11260
  }()
10641
11261
  /**
10642
11262
  * createCampaign - Creates a Campaign
@@ -10649,32 +11269,32 @@ var StreamChat = /*#__PURE__*/function () {
10649
11269
  }, {
10650
11270
  key: "createCampaign",
10651
11271
  value: function () {
10652
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(params) {
11272
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(params) {
10653
11273
  var _yield$this$post2, campaign;
10654
11274
 
10655
- return _regeneratorRuntime.wrap(function _callee63$(_context63) {
11275
+ return _regeneratorRuntime.wrap(function _callee72$(_context72) {
10656
11276
  while (1) {
10657
- switch (_context63.prev = _context63.next) {
11277
+ switch (_context72.prev = _context72.next) {
10658
11278
  case 0:
10659
- _context63.next = 2;
11279
+ _context72.next = 2;
10660
11280
  return this.post(this.baseURL + "/campaigns", {
10661
11281
  campaign: params
10662
11282
  });
10663
11283
 
10664
11284
  case 2:
10665
- _yield$this$post2 = _context63.sent;
11285
+ _yield$this$post2 = _context72.sent;
10666
11286
  campaign = _yield$this$post2.campaign;
10667
- return _context63.abrupt("return", campaign);
11287
+ return _context72.abrupt("return", campaign);
10668
11288
 
10669
11289
  case 5:
10670
11290
  case "end":
10671
- return _context63.stop();
11291
+ return _context72.stop();
10672
11292
  }
10673
11293
  }
10674
- }, _callee63, this);
11294
+ }, _callee72, this);
10675
11295
  }));
10676
11296
 
10677
- function createCampaign(_x84) {
11297
+ function createCampaign(_x104) {
10678
11298
  return _createCampaign.apply(this, arguments);
10679
11299
  }
10680
11300
 
@@ -10690,15 +11310,15 @@ var StreamChat = /*#__PURE__*/function () {
10690
11310
  }, {
10691
11311
  key: "queryCampaigns",
10692
11312
  value: function () {
10693
- var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(filters) {
11313
+ var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(filters) {
10694
11314
  var options,
10695
- _args64 = arguments;
10696
- return _regeneratorRuntime.wrap(function _callee64$(_context64) {
11315
+ _args73 = arguments;
11316
+ return _regeneratorRuntime.wrap(function _callee73$(_context73) {
10697
11317
  while (1) {
10698
- switch (_context64.prev = _context64.next) {
11318
+ switch (_context73.prev = _context73.next) {
10699
11319
  case 0:
10700
- options = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {};
10701
- _context64.next = 3;
11320
+ options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11321
+ _context73.next = 3;
10702
11322
  return this.get(this.baseURL + "/campaigns", {
10703
11323
  payload: _objectSpread({
10704
11324
  filter_conditions: filters
@@ -10706,17 +11326,17 @@ var StreamChat = /*#__PURE__*/function () {
10706
11326
  });
10707
11327
 
10708
11328
  case 3:
10709
- return _context64.abrupt("return", _context64.sent);
11329
+ return _context73.abrupt("return", _context73.sent);
10710
11330
 
10711
11331
  case 4:
10712
11332
  case "end":
10713
- return _context64.stop();
11333
+ return _context73.stop();
10714
11334
  }
10715
11335
  }
10716
- }, _callee64, this);
11336
+ }, _callee73, this);
10717
11337
  }));
10718
11338
 
10719
- function queryCampaigns(_x85) {
11339
+ function queryCampaigns(_x105) {
10720
11340
  return _queryCampaigns.apply(this, arguments);
10721
11341
  }
10722
11342
 
@@ -10734,32 +11354,32 @@ var StreamChat = /*#__PURE__*/function () {
10734
11354
  }, {
10735
11355
  key: "updateCampaign",
10736
11356
  value: function () {
10737
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, params) {
11357
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id, params) {
10738
11358
  var _yield$this$put2, campaign;
10739
11359
 
10740
- return _regeneratorRuntime.wrap(function _callee65$(_context65) {
11360
+ return _regeneratorRuntime.wrap(function _callee74$(_context74) {
10741
11361
  while (1) {
10742
- switch (_context65.prev = _context65.next) {
11362
+ switch (_context74.prev = _context74.next) {
10743
11363
  case 0:
10744
- _context65.next = 2;
11364
+ _context74.next = 2;
10745
11365
  return this.put(this.baseURL + "/campaigns/".concat(id), {
10746
11366
  campaign: params
10747
11367
  });
10748
11368
 
10749
11369
  case 2:
10750
- _yield$this$put2 = _context65.sent;
11370
+ _yield$this$put2 = _context74.sent;
10751
11371
  campaign = _yield$this$put2.campaign;
10752
- return _context65.abrupt("return", campaign);
11372
+ return _context74.abrupt("return", campaign);
10753
11373
 
10754
11374
  case 5:
10755
11375
  case "end":
10756
- return _context65.stop();
11376
+ return _context74.stop();
10757
11377
  }
10758
11378
  }
10759
- }, _callee65, this);
11379
+ }, _callee74, this);
10760
11380
  }));
10761
11381
 
10762
- function updateCampaign(_x86, _x87) {
11382
+ function updateCampaign(_x106, _x107) {
10763
11383
  return _updateCampaign.apply(this, arguments);
10764
11384
  }
10765
11385
 
@@ -10776,25 +11396,25 @@ var StreamChat = /*#__PURE__*/function () {
10776
11396
  }, {
10777
11397
  key: "deleteCampaign",
10778
11398
  value: function () {
10779
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id) {
11399
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
10780
11400
  var params,
10781
- _args66 = arguments;
10782
- return _regeneratorRuntime.wrap(function _callee66$(_context66) {
11401
+ _args75 = arguments;
11402
+ return _regeneratorRuntime.wrap(function _callee75$(_context75) {
10783
11403
  while (1) {
10784
- switch (_context66.prev = _context66.next) {
11404
+ switch (_context75.prev = _context75.next) {
10785
11405
  case 0:
10786
- params = _args66.length > 1 && _args66[1] !== undefined ? _args66[1] : {};
10787
- return _context66.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11406
+ params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11407
+ return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
10788
11408
 
10789
11409
  case 2:
10790
11410
  case "end":
10791
- return _context66.stop();
11411
+ return _context75.stop();
10792
11412
  }
10793
11413
  }
10794
- }, _callee66, this);
11414
+ }, _callee75, this);
10795
11415
  }));
10796
11416
 
10797
- function deleteCampaign(_x88) {
11417
+ function deleteCampaign(_x108) {
10798
11418
  return _deleteCampaign.apply(this, arguments);
10799
11419
  }
10800
11420
 
@@ -10812,33 +11432,33 @@ var StreamChat = /*#__PURE__*/function () {
10812
11432
  }, {
10813
11433
  key: "scheduleCampaign",
10814
11434
  value: function () {
10815
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, params) {
11435
+ var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, params) {
10816
11436
  var scheduledFor, _yield$this$patch, campaign;
10817
11437
 
10818
- return _regeneratorRuntime.wrap(function _callee67$(_context67) {
11438
+ return _regeneratorRuntime.wrap(function _callee76$(_context76) {
10819
11439
  while (1) {
10820
- switch (_context67.prev = _context67.next) {
11440
+ switch (_context76.prev = _context76.next) {
10821
11441
  case 0:
10822
11442
  scheduledFor = params.scheduledFor;
10823
- _context67.next = 3;
11443
+ _context76.next = 3;
10824
11444
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
10825
11445
  scheduled_for: scheduledFor
10826
11446
  });
10827
11447
 
10828
11448
  case 3:
10829
- _yield$this$patch = _context67.sent;
11449
+ _yield$this$patch = _context76.sent;
10830
11450
  campaign = _yield$this$patch.campaign;
10831
- return _context67.abrupt("return", campaign);
11451
+ return _context76.abrupt("return", campaign);
10832
11452
 
10833
11453
  case 6:
10834
11454
  case "end":
10835
- return _context67.stop();
11455
+ return _context76.stop();
10836
11456
  }
10837
11457
  }
10838
- }, _callee67, this);
11458
+ }, _callee76, this);
10839
11459
  }));
10840
11460
 
10841
- function scheduleCampaign(_x89, _x90) {
11461
+ function scheduleCampaign(_x109, _x110) {
10842
11462
  return _scheduleCampaign.apply(this, arguments);
10843
11463
  }
10844
11464
 
@@ -10855,30 +11475,30 @@ var StreamChat = /*#__PURE__*/function () {
10855
11475
  }, {
10856
11476
  key: "stopCampaign",
10857
11477
  value: function () {
10858
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id) {
11478
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(id) {
10859
11479
  var _yield$this$patch2, campaign;
10860
11480
 
10861
- return _regeneratorRuntime.wrap(function _callee68$(_context68) {
11481
+ return _regeneratorRuntime.wrap(function _callee77$(_context77) {
10862
11482
  while (1) {
10863
- switch (_context68.prev = _context68.next) {
11483
+ switch (_context77.prev = _context77.next) {
10864
11484
  case 0:
10865
- _context68.next = 2;
11485
+ _context77.next = 2;
10866
11486
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
10867
11487
 
10868
11488
  case 2:
10869
- _yield$this$patch2 = _context68.sent;
11489
+ _yield$this$patch2 = _context77.sent;
10870
11490
  campaign = _yield$this$patch2.campaign;
10871
- return _context68.abrupt("return", campaign);
11491
+ return _context77.abrupt("return", campaign);
10872
11492
 
10873
11493
  case 5:
10874
11494
  case "end":
10875
- return _context68.stop();
11495
+ return _context77.stop();
10876
11496
  }
10877
11497
  }
10878
- }, _callee68, this);
11498
+ }, _callee77, this);
10879
11499
  }));
10880
11500
 
10881
- function stopCampaign(_x91) {
11501
+ function stopCampaign(_x111) {
10882
11502
  return _stopCampaign.apply(this, arguments);
10883
11503
  }
10884
11504
 
@@ -10895,30 +11515,30 @@ var StreamChat = /*#__PURE__*/function () {
10895
11515
  }, {
10896
11516
  key: "resumeCampaign",
10897
11517
  value: function () {
10898
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(id) {
11518
+ var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
10899
11519
  var _yield$this$patch3, campaign;
10900
11520
 
10901
- return _regeneratorRuntime.wrap(function _callee69$(_context69) {
11521
+ return _regeneratorRuntime.wrap(function _callee78$(_context78) {
10902
11522
  while (1) {
10903
- switch (_context69.prev = _context69.next) {
11523
+ switch (_context78.prev = _context78.next) {
10904
11524
  case 0:
10905
- _context69.next = 2;
11525
+ _context78.next = 2;
10906
11526
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
10907
11527
 
10908
11528
  case 2:
10909
- _yield$this$patch3 = _context69.sent;
11529
+ _yield$this$patch3 = _context78.sent;
10910
11530
  campaign = _yield$this$patch3.campaign;
10911
- return _context69.abrupt("return", campaign);
11531
+ return _context78.abrupt("return", campaign);
10912
11532
 
10913
11533
  case 5:
10914
11534
  case "end":
10915
- return _context69.stop();
11535
+ return _context78.stop();
10916
11536
  }
10917
11537
  }
10918
- }, _callee69, this);
11538
+ }, _callee78, this);
10919
11539
  }));
10920
11540
 
10921
- function resumeCampaign(_x92) {
11541
+ function resumeCampaign(_x112) {
10922
11542
  return _resumeCampaign.apply(this, arguments);
10923
11543
  }
10924
11544
 
@@ -10936,77 +11556,35 @@ var StreamChat = /*#__PURE__*/function () {
10936
11556
  }, {
10937
11557
  key: "testCampaign",
10938
11558
  value: function () {
10939
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id, params) {
11559
+ var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id, params) {
10940
11560
  var users;
10941
- return _regeneratorRuntime.wrap(function _callee70$(_context70) {
11561
+ return _regeneratorRuntime.wrap(function _callee79$(_context79) {
10942
11562
  while (1) {
10943
- switch (_context70.prev = _context70.next) {
11563
+ switch (_context79.prev = _context79.next) {
10944
11564
  case 0:
10945
11565
  users = params.users;
10946
- _context70.next = 3;
11566
+ _context79.next = 3;
10947
11567
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
10948
11568
  users: users
10949
11569
  });
10950
11570
 
10951
11571
  case 3:
10952
- return _context70.abrupt("return", _context70.sent);
11572
+ return _context79.abrupt("return", _context79.sent);
10953
11573
 
10954
11574
  case 4:
10955
11575
  case "end":
10956
- return _context70.stop();
11576
+ return _context79.stop();
10957
11577
  }
10958
11578
  }
10959
- }, _callee70, this);
11579
+ }, _callee79, this);
10960
11580
  }));
10961
11581
 
10962
- function testCampaign(_x93, _x94) {
11582
+ function testCampaign(_x113, _x114) {
10963
11583
  return _testCampaign.apply(this, arguments);
10964
11584
  }
10965
11585
 
10966
11586
  return testCampaign;
10967
11587
  }()
10968
- /**
10969
- * queryRecipients - Query Campaign Recipient Results
10970
- *
10971
- *
10972
- * @return {Recipient[]} Recipients
10973
- */
10974
-
10975
- }, {
10976
- key: "queryRecipients",
10977
- value: function () {
10978
- var _queryRecipients = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(filters) {
10979
- var options,
10980
- _args71 = arguments;
10981
- return _regeneratorRuntime.wrap(function _callee71$(_context71) {
10982
- while (1) {
10983
- switch (_context71.prev = _context71.next) {
10984
- case 0:
10985
- options = _args71.length > 1 && _args71[1] !== undefined ? _args71[1] : {};
10986
- _context71.next = 3;
10987
- return this.get(this.baseURL + "/recipients", {
10988
- payload: _objectSpread({
10989
- filter_conditions: filters
10990
- }, options)
10991
- });
10992
-
10993
- case 3:
10994
- return _context71.abrupt("return", _context71.sent);
10995
-
10996
- case 4:
10997
- case "end":
10998
- return _context71.stop();
10999
- }
11000
- }
11001
- }, _callee71, this);
11002
- }));
11003
-
11004
- function queryRecipients(_x95) {
11005
- return _queryRecipients.apply(this, arguments);
11006
- }
11007
-
11008
- return queryRecipients;
11009
- }()
11010
11588
  /**
11011
11589
  * enrichURL - Get OpenGraph data of the given link
11012
11590
  *
@@ -11017,24 +11595,24 @@ var StreamChat = /*#__PURE__*/function () {
11017
11595
  }, {
11018
11596
  key: "enrichURL",
11019
11597
  value: function () {
11020
- var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(url) {
11021
- return _regeneratorRuntime.wrap(function _callee72$(_context72) {
11598
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(url) {
11599
+ return _regeneratorRuntime.wrap(function _callee80$(_context80) {
11022
11600
  while (1) {
11023
- switch (_context72.prev = _context72.next) {
11601
+ switch (_context80.prev = _context80.next) {
11024
11602
  case 0:
11025
- return _context72.abrupt("return", this.get(this.baseURL + "/og", {
11603
+ return _context80.abrupt("return", this.get(this.baseURL + "/og", {
11026
11604
  url: url
11027
11605
  }));
11028
11606
 
11029
11607
  case 1:
11030
11608
  case "end":
11031
- return _context72.stop();
11609
+ return _context80.stop();
11032
11610
  }
11033
11611
  }
11034
- }, _callee72, this);
11612
+ }, _callee80, this);
11035
11613
  }));
11036
11614
 
11037
- function enrichURL(_x96) {
11615
+ function enrichURL(_x115) {
11038
11616
  return _enrichURL.apply(this, arguments);
11039
11617
  }
11040
11618
 
@@ -11051,22 +11629,22 @@ var StreamChat = /*#__PURE__*/function () {
11051
11629
  }, {
11052
11630
  key: "getTask",
11053
11631
  value: function () {
11054
- var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(id) {
11055
- return _regeneratorRuntime.wrap(function _callee73$(_context73) {
11632
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
11633
+ return _regeneratorRuntime.wrap(function _callee81$(_context81) {
11056
11634
  while (1) {
11057
- switch (_context73.prev = _context73.next) {
11635
+ switch (_context81.prev = _context81.next) {
11058
11636
  case 0:
11059
- return _context73.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11637
+ return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11060
11638
 
11061
11639
  case 1:
11062
11640
  case "end":
11063
- return _context73.stop();
11641
+ return _context81.stop();
11064
11642
  }
11065
11643
  }
11066
- }, _callee73, this);
11644
+ }, _callee81, this);
11067
11645
  }));
11068
11646
 
11069
- function getTask(_x97) {
11647
+ function getTask(_x116) {
11070
11648
  return _getTask.apply(this, arguments);
11071
11649
  }
11072
11650
 
@@ -11084,31 +11662,31 @@ var StreamChat = /*#__PURE__*/function () {
11084
11662
  }, {
11085
11663
  key: "deleteChannels",
11086
11664
  value: function () {
11087
- var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(cids) {
11665
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(cids) {
11088
11666
  var options,
11089
- _args74 = arguments;
11090
- return _regeneratorRuntime.wrap(function _callee74$(_context74) {
11667
+ _args82 = arguments;
11668
+ return _regeneratorRuntime.wrap(function _callee82$(_context82) {
11091
11669
  while (1) {
11092
- switch (_context74.prev = _context74.next) {
11670
+ switch (_context82.prev = _context82.next) {
11093
11671
  case 0:
11094
- options = _args74.length > 1 && _args74[1] !== undefined ? _args74[1] : {};
11095
- _context74.next = 3;
11672
+ options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11673
+ _context82.next = 3;
11096
11674
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11097
11675
  cids: cids
11098
11676
  }, options));
11099
11677
 
11100
11678
  case 3:
11101
- return _context74.abrupt("return", _context74.sent);
11679
+ return _context82.abrupt("return", _context82.sent);
11102
11680
 
11103
11681
  case 4:
11104
11682
  case "end":
11105
- return _context74.stop();
11683
+ return _context82.stop();
11106
11684
  }
11107
11685
  }
11108
- }, _callee74, this);
11686
+ }, _callee82, this);
11109
11687
  }));
11110
11688
 
11111
- function deleteChannels(_x98) {
11689
+ function deleteChannels(_x117) {
11112
11690
  return _deleteChannels.apply(this, arguments);
11113
11691
  }
11114
11692
 
@@ -11126,17 +11704,17 @@ var StreamChat = /*#__PURE__*/function () {
11126
11704
  }, {
11127
11705
  key: "deleteUsers",
11128
11706
  value: function () {
11129
- var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(user_ids) {
11707
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(user_ids) {
11130
11708
  var options,
11131
- _args75 = arguments;
11132
- return _regeneratorRuntime.wrap(function _callee75$(_context75) {
11709
+ _args83 = arguments;
11710
+ return _regeneratorRuntime.wrap(function _callee83$(_context83) {
11133
11711
  while (1) {
11134
- switch (_context75.prev = _context75.next) {
11712
+ switch (_context83.prev = _context83.next) {
11135
11713
  case 0:
11136
- options = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11714
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
11137
11715
 
11138
11716
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11139
- _context75.next = 3;
11717
+ _context83.next = 3;
11140
11718
  break;
11141
11719
  }
11142
11720
 
@@ -11144,7 +11722,7 @@ var StreamChat = /*#__PURE__*/function () {
11144
11722
 
11145
11723
  case 3:
11146
11724
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11147
- _context75.next = 5;
11725
+ _context83.next = 5;
11148
11726
  break;
11149
11727
  }
11150
11728
 
@@ -11152,30 +11730,30 @@ var StreamChat = /*#__PURE__*/function () {
11152
11730
 
11153
11731
  case 5:
11154
11732
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11155
- _context75.next = 7;
11733
+ _context83.next = 7;
11156
11734
  break;
11157
11735
  }
11158
11736
 
11159
11737
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11160
11738
 
11161
11739
  case 7:
11162
- _context75.next = 9;
11740
+ _context83.next = 9;
11163
11741
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11164
11742
  user_ids: user_ids
11165
11743
  }, options));
11166
11744
 
11167
11745
  case 9:
11168
- return _context75.abrupt("return", _context75.sent);
11746
+ return _context83.abrupt("return", _context83.sent);
11169
11747
 
11170
11748
  case 10:
11171
11749
  case "end":
11172
- return _context75.stop();
11750
+ return _context83.stop();
11173
11751
  }
11174
11752
  }
11175
- }, _callee75, this);
11753
+ }, _callee83, this);
11176
11754
  }));
11177
11755
 
11178
- function deleteUsers(_x99) {
11756
+ function deleteUsers(_x118) {
11179
11757
  return _deleteUsers.apply(this, arguments);
11180
11758
  }
11181
11759
 
@@ -11196,28 +11774,28 @@ var StreamChat = /*#__PURE__*/function () {
11196
11774
  }, {
11197
11775
  key: "_createImportURL",
11198
11776
  value: function () {
11199
- var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(filename) {
11200
- return _regeneratorRuntime.wrap(function _callee76$(_context76) {
11777
+ var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(filename) {
11778
+ return _regeneratorRuntime.wrap(function _callee84$(_context84) {
11201
11779
  while (1) {
11202
- switch (_context76.prev = _context76.next) {
11780
+ switch (_context84.prev = _context84.next) {
11203
11781
  case 0:
11204
- _context76.next = 2;
11782
+ _context84.next = 2;
11205
11783
  return this.post(this.baseURL + "/import_urls", {
11206
11784
  filename: filename
11207
11785
  });
11208
11786
 
11209
11787
  case 2:
11210
- return _context76.abrupt("return", _context76.sent);
11788
+ return _context84.abrupt("return", _context84.sent);
11211
11789
 
11212
11790
  case 3:
11213
11791
  case "end":
11214
- return _context76.stop();
11792
+ return _context84.stop();
11215
11793
  }
11216
11794
  }
11217
- }, _callee76, this);
11795
+ }, _callee84, this);
11218
11796
  }));
11219
11797
 
11220
- function _createImportURL(_x100) {
11798
+ function _createImportURL(_x119) {
11221
11799
  return _createImportURL2.apply(this, arguments);
11222
11800
  }
11223
11801
 
@@ -11239,33 +11817,33 @@ var StreamChat = /*#__PURE__*/function () {
11239
11817
  }, {
11240
11818
  key: "_createImport",
11241
11819
  value: function () {
11242
- var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(path) {
11820
+ var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(path) {
11243
11821
  var options,
11244
- _args77 = arguments;
11245
- return _regeneratorRuntime.wrap(function _callee77$(_context77) {
11822
+ _args85 = arguments;
11823
+ return _regeneratorRuntime.wrap(function _callee85$(_context85) {
11246
11824
  while (1) {
11247
- switch (_context77.prev = _context77.next) {
11825
+ switch (_context85.prev = _context85.next) {
11248
11826
  case 0:
11249
- options = _args77.length > 1 && _args77[1] !== undefined ? _args77[1] : {
11827
+ options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
11250
11828
  mode: 'upsert'
11251
11829
  };
11252
- _context77.next = 3;
11830
+ _context85.next = 3;
11253
11831
  return this.post(this.baseURL + "/imports", _objectSpread({
11254
11832
  path: path
11255
11833
  }, options));
11256
11834
 
11257
11835
  case 3:
11258
- return _context77.abrupt("return", _context77.sent);
11836
+ return _context85.abrupt("return", _context85.sent);
11259
11837
 
11260
11838
  case 4:
11261
11839
  case "end":
11262
- return _context77.stop();
11840
+ return _context85.stop();
11263
11841
  }
11264
11842
  }
11265
- }, _callee77, this);
11843
+ }, _callee85, this);
11266
11844
  }));
11267
11845
 
11268
- function _createImport(_x101) {
11846
+ function _createImport(_x120) {
11269
11847
  return _createImport2.apply(this, arguments);
11270
11848
  }
11271
11849
 
@@ -11287,26 +11865,26 @@ var StreamChat = /*#__PURE__*/function () {
11287
11865
  }, {
11288
11866
  key: "_getImport",
11289
11867
  value: function () {
11290
- var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
11291
- return _regeneratorRuntime.wrap(function _callee78$(_context78) {
11868
+ var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(id) {
11869
+ return _regeneratorRuntime.wrap(function _callee86$(_context86) {
11292
11870
  while (1) {
11293
- switch (_context78.prev = _context78.next) {
11871
+ switch (_context86.prev = _context86.next) {
11294
11872
  case 0:
11295
- _context78.next = 2;
11873
+ _context86.next = 2;
11296
11874
  return this.get(this.baseURL + "/imports/".concat(id));
11297
11875
 
11298
11876
  case 2:
11299
- return _context78.abrupt("return", _context78.sent);
11877
+ return _context86.abrupt("return", _context86.sent);
11300
11878
 
11301
11879
  case 3:
11302
11880
  case "end":
11303
- return _context78.stop();
11881
+ return _context86.stop();
11304
11882
  }
11305
11883
  }
11306
- }, _callee78, this);
11884
+ }, _callee86, this);
11307
11885
  }));
11308
11886
 
11309
- function _getImport(_x102) {
11887
+ function _getImport(_x121) {
11310
11888
  return _getImport2.apply(this, arguments);
11311
11889
  }
11312
11890
 
@@ -11328,26 +11906,26 @@ var StreamChat = /*#__PURE__*/function () {
11328
11906
  }, {
11329
11907
  key: "_listImports",
11330
11908
  value: function () {
11331
- var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(options) {
11332
- return _regeneratorRuntime.wrap(function _callee79$(_context79) {
11909
+ var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(options) {
11910
+ return _regeneratorRuntime.wrap(function _callee87$(_context87) {
11333
11911
  while (1) {
11334
- switch (_context79.prev = _context79.next) {
11912
+ switch (_context87.prev = _context87.next) {
11335
11913
  case 0:
11336
- _context79.next = 2;
11914
+ _context87.next = 2;
11337
11915
  return this.get(this.baseURL + "/imports", options);
11338
11916
 
11339
11917
  case 2:
11340
- return _context79.abrupt("return", _context79.sent);
11918
+ return _context87.abrupt("return", _context87.sent);
11341
11919
 
11342
11920
  case 3:
11343
11921
  case "end":
11344
- return _context79.stop();
11922
+ return _context87.stop();
11345
11923
  }
11346
11924
  }
11347
- }, _callee79, this);
11925
+ }, _callee87, this);
11348
11926
  }));
11349
11927
 
11350
- function _listImports(_x103) {
11928
+ function _listImports(_x122) {
11351
11929
  return _listImports2.apply(this, arguments);
11352
11930
  }
11353
11931
 
@@ -11366,28 +11944,28 @@ var StreamChat = /*#__PURE__*/function () {
11366
11944
  }, {
11367
11945
  key: "upsertPushProvider",
11368
11946
  value: function () {
11369
- var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(pushProvider) {
11370
- return _regeneratorRuntime.wrap(function _callee80$(_context80) {
11947
+ var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(pushProvider) {
11948
+ return _regeneratorRuntime.wrap(function _callee88$(_context88) {
11371
11949
  while (1) {
11372
- switch (_context80.prev = _context80.next) {
11950
+ switch (_context88.prev = _context88.next) {
11373
11951
  case 0:
11374
- _context80.next = 2;
11952
+ _context88.next = 2;
11375
11953
  return this.post(this.baseURL + "/push_providers", {
11376
11954
  push_provider: pushProvider
11377
11955
  });
11378
11956
 
11379
11957
  case 2:
11380
- return _context80.abrupt("return", _context80.sent);
11958
+ return _context88.abrupt("return", _context88.sent);
11381
11959
 
11382
11960
  case 3:
11383
11961
  case "end":
11384
- return _context80.stop();
11962
+ return _context88.stop();
11385
11963
  }
11386
11964
  }
11387
- }, _callee80, this);
11965
+ }, _callee88, this);
11388
11966
  }));
11389
11967
 
11390
- function upsertPushProvider(_x104) {
11968
+ function upsertPushProvider(_x123) {
11391
11969
  return _upsertPushProvider.apply(this, arguments);
11392
11970
  }
11393
11971
 
@@ -11406,28 +11984,28 @@ var StreamChat = /*#__PURE__*/function () {
11406
11984
  }, {
11407
11985
  key: "deletePushProvider",
11408
11986
  value: function () {
11409
- var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(_ref10) {
11987
+ var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(_ref10) {
11410
11988
  var type, name;
11411
- return _regeneratorRuntime.wrap(function _callee81$(_context81) {
11989
+ return _regeneratorRuntime.wrap(function _callee89$(_context89) {
11412
11990
  while (1) {
11413
- switch (_context81.prev = _context81.next) {
11991
+ switch (_context89.prev = _context89.next) {
11414
11992
  case 0:
11415
11993
  type = _ref10.type, name = _ref10.name;
11416
- _context81.next = 3;
11994
+ _context89.next = 3;
11417
11995
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11418
11996
 
11419
11997
  case 3:
11420
- return _context81.abrupt("return", _context81.sent);
11998
+ return _context89.abrupt("return", _context89.sent);
11421
11999
 
11422
12000
  case 4:
11423
12001
  case "end":
11424
- return _context81.stop();
12002
+ return _context89.stop();
11425
12003
  }
11426
12004
  }
11427
- }, _callee81, this);
12005
+ }, _callee89, this);
11428
12006
  }));
11429
12007
 
11430
- function deletePushProvider(_x105) {
12008
+ function deletePushProvider(_x124) {
11431
12009
  return _deletePushProvider.apply(this, arguments);
11432
12010
  }
11433
12011
 
@@ -11444,23 +12022,23 @@ var StreamChat = /*#__PURE__*/function () {
11444
12022
  }, {
11445
12023
  key: "listPushProviders",
11446
12024
  value: function () {
11447
- var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82() {
11448
- return _regeneratorRuntime.wrap(function _callee82$(_context82) {
12025
+ var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90() {
12026
+ return _regeneratorRuntime.wrap(function _callee90$(_context90) {
11449
12027
  while (1) {
11450
- switch (_context82.prev = _context82.next) {
12028
+ switch (_context90.prev = _context90.next) {
11451
12029
  case 0:
11452
- _context82.next = 2;
12030
+ _context90.next = 2;
11453
12031
  return this.get(this.baseURL + "/push_providers");
11454
12032
 
11455
12033
  case 2:
11456
- return _context82.abrupt("return", _context82.sent);
12034
+ return _context90.abrupt("return", _context90.sent);
11457
12035
 
11458
12036
  case 3:
11459
12037
  case "end":
11460
- return _context82.stop();
12038
+ return _context90.stop();
11461
12039
  }
11462
12040
  }
11463
- }, _callee82, this);
12041
+ }, _callee90, this);
11464
12042
  }));
11465
12043
 
11466
12044
  function listPushProviders() {
@@ -11488,26 +12066,26 @@ var StreamChat = /*#__PURE__*/function () {
11488
12066
  }, {
11489
12067
  key: "commitMessage",
11490
12068
  value: function () {
11491
- var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(id) {
11492
- return _regeneratorRuntime.wrap(function _callee83$(_context83) {
12069
+ var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91(id) {
12070
+ return _regeneratorRuntime.wrap(function _callee91$(_context91) {
11493
12071
  while (1) {
11494
- switch (_context83.prev = _context83.next) {
12072
+ switch (_context91.prev = _context91.next) {
11495
12073
  case 0:
11496
- _context83.next = 2;
12074
+ _context91.next = 2;
11497
12075
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
11498
12076
 
11499
12077
  case 2:
11500
- return _context83.abrupt("return", _context83.sent);
12078
+ return _context91.abrupt("return", _context91.sent);
11501
12079
 
11502
12080
  case 3:
11503
12081
  case "end":
11504
- return _context83.stop();
12082
+ return _context91.stop();
11505
12083
  }
11506
12084
  }
11507
- }, _callee83, this);
12085
+ }, _callee91, this);
11508
12086
  }));
11509
12087
 
11510
- function commitMessage(_x106) {
12088
+ function commitMessage(_x125) {
11511
12089
  return _commitMessage.apply(this, arguments);
11512
12090
  }
11513
12091
 
@@ -11559,9 +12137,11 @@ var EVENT_MAP = {
11559
12137
  'notification.invite_rejected': true,
11560
12138
  'notification.invited': true,
11561
12139
  'notification.mark_read': true,
12140
+ 'notification.mark_unread': true,
11562
12141
  'notification.message_new': true,
11563
12142
  'notification.mutes_updated': true,
11564
12143
  'notification.removed_from_channel': true,
12144
+ 'notification.thread_message_new': true,
11565
12145
  'reaction.deleted': true,
11566
12146
  'reaction.new': true,
11567
12147
  'reaction.updated': true,
@@ -11657,5 +12237,5 @@ var BuiltinPermissions = {
11657
12237
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
11658
12238
  };
11659
12239
 
11660
- export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
12240
+ export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
11661
12241
  //# sourceMappingURL=index.es.js.map