stream-chat 8.15.0 → 8.17.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.js CHANGED
@@ -122,9 +122,347 @@ var decodeBase64 = function decodeBase64(s) {
122
122
  return r;
123
123
  };
124
124
 
125
- 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; }
125
+ 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; }
126
126
 
127
- 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__default['default'](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; }
127
+ 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__default['default'](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; }
128
+
129
+ 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; } } }; }
130
+
131
+ 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); }
132
+
133
+ 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; }
134
+
135
+ /**
136
+ * logChatPromiseExecution - utility function for logging the execution of a promise..
137
+ * use this when you want to run the promise and handle errors by logging a warning
138
+ *
139
+ * @param {Promise<T>} promise The promise you want to run and log
140
+ * @param {string} name A descriptive name of what the promise does for log output
141
+ *
142
+ */
143
+ function logChatPromiseExecution(promise, name) {
144
+ promise.then().catch(function (error) {
145
+ console.warn("failed to do ".concat(name, ", ran into error: "), error);
146
+ });
147
+ }
148
+ var sleep = function sleep(m) {
149
+ return new Promise(function (r) {
150
+ return setTimeout(r, m);
151
+ });
152
+ };
153
+ function isFunction(value) {
154
+ return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
155
+ }
156
+ var chatCodes = {
157
+ TOKEN_EXPIRED: 40,
158
+ WS_CLOSED_SUCCESS: 1000
159
+ };
160
+
161
+ function isReadableStream(obj) {
162
+ return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
163
+ }
164
+
165
+ function isBuffer(obj) {
166
+ return obj != null && obj.constructor != null && // @ts-expect-error
167
+ typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
168
+ obj.constructor.isBuffer(obj);
169
+ }
170
+
171
+ function isFileWebAPI(uri) {
172
+ return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
173
+ }
174
+
175
+ function isOwnUser(user) {
176
+ return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
177
+ }
178
+
179
+ function isBlobWebAPI(uri) {
180
+ return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
181
+ }
182
+
183
+ function isOwnUserBaseProperty(property) {
184
+ var ownUserBaseProperties = {
185
+ channel_mutes: true,
186
+ devices: true,
187
+ mutes: true,
188
+ total_unread_count: true,
189
+ unread_channels: true,
190
+ unread_count: true,
191
+ invisible: true,
192
+ roles: true
193
+ };
194
+ return ownUserBaseProperties[property];
195
+ }
196
+ function addFileToFormData(uri, name, contentType) {
197
+ var data = new FormData__default['default']();
198
+
199
+ if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
200
+ if (name) data.append('file', uri, name);else data.append('file', uri);
201
+ } else {
202
+ data.append('file', {
203
+ uri: uri,
204
+ name: name || uri.split('/').reverse()[0],
205
+ contentType: contentType || undefined,
206
+ type: contentType || undefined
207
+ });
208
+ }
209
+
210
+ return data;
211
+ }
212
+ function normalizeQuerySort(sort) {
213
+ var sortFields = [];
214
+ var sortArr = Array.isArray(sort) ? sort : [sort];
215
+
216
+ var _iterator = _createForOfIteratorHelper$4(sortArr),
217
+ _step;
218
+
219
+ try {
220
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
221
+ var item = _step.value;
222
+ var entries = Object.entries(item);
223
+
224
+ if (entries.length > 1) {
225
+ console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
226
+ }
227
+
228
+ for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
229
+ var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
230
+ field = _entries$_i[0],
231
+ direction = _entries$_i[1];
232
+
233
+ sortFields.push({
234
+ field: field,
235
+ direction: direction
236
+ });
237
+ }
238
+ }
239
+ } catch (err) {
240
+ _iterator.e(err);
241
+ } finally {
242
+ _iterator.f();
243
+ }
244
+
245
+ return sortFields;
246
+ }
247
+ /**
248
+ * retryInterval - A retry interval which increases acc to number of failures
249
+ *
250
+ * @return {number} Duration to wait in milliseconds
251
+ */
252
+
253
+ function retryInterval(numberOfFailures) {
254
+ // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
255
+ var max = Math.min(500 + numberOfFailures * 2000, 25000);
256
+ var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
257
+ return Math.floor(Math.random() * (max - min) + min);
258
+ }
259
+ function randomId() {
260
+ return generateUUIDv4();
261
+ }
262
+
263
+ function hex(bytes) {
264
+ var s = '';
265
+
266
+ for (var i = 0; i < bytes.length; i++) {
267
+ s += bytes[i].toString(16).padStart(2, '0');
268
+ }
269
+
270
+ return s;
271
+ } // https://tools.ietf.org/html/rfc4122
272
+
273
+
274
+ function generateUUIDv4() {
275
+ var bytes = getRandomBytes(16);
276
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
277
+
278
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
279
+
280
+ 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));
281
+ }
282
+
283
+ function getRandomValuesWithMathRandom(bytes) {
284
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
285
+
286
+ for (var i = 0; i < bytes.length; i++) {
287
+ bytes[i] = Math.random() * max;
288
+ }
289
+ }
290
+
291
+ var getRandomValues = function () {
292
+ var _crypto;
293
+
294
+ if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
295
+ return crypto.getRandomValues.bind(crypto);
296
+ } else if (typeof msCrypto !== 'undefined') {
297
+ return msCrypto.getRandomValues.bind(msCrypto);
298
+ } else {
299
+ return getRandomValuesWithMathRandom;
300
+ }
301
+ }();
302
+
303
+ function getRandomBytes(length) {
304
+ var bytes = new Uint8Array(length);
305
+ getRandomValues(bytes);
306
+ return bytes;
307
+ }
308
+
309
+ function convertErrorToJson(err) {
310
+ var jsonObj = {};
311
+ if (!err) return jsonObj;
312
+
313
+ try {
314
+ Object.getOwnPropertyNames(err).forEach(function (key) {
315
+ jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
316
+ });
317
+ } catch (_) {
318
+ return {
319
+ error: 'failed to serialize the error'
320
+ };
321
+ }
322
+
323
+ return jsonObj;
324
+ }
325
+ /**
326
+ * isOnline safely return the navigator.online value for browser env
327
+ * if navigator is not in global object, it always return true
328
+ */
329
+
330
+ function isOnline() {
331
+ var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
332
+
333
+ if (!nav) {
334
+ console.warn('isOnline failed to access window.navigator and assume browser is online');
335
+ return true;
336
+ } // RN navigator has undefined for onLine
337
+
338
+
339
+ if (typeof nav.onLine !== 'boolean') {
340
+ return true;
341
+ }
342
+
343
+ return nav.onLine;
344
+ }
345
+ /**
346
+ * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
347
+ */
348
+
349
+ function addConnectionEventListeners(cb) {
350
+ if (typeof window !== 'undefined' && window.addEventListener) {
351
+ window.addEventListener('offline', cb);
352
+ window.addEventListener('online', cb);
353
+ }
354
+ }
355
+ function removeConnectionEventListeners(cb) {
356
+ if (typeof window !== 'undefined' && window.removeEventListener) {
357
+ window.removeEventListener('offline', cb);
358
+ window.removeEventListener('online', cb);
359
+ }
360
+ }
361
+ var axiosParamsSerializer = function axiosParamsSerializer(params) {
362
+ var newParams = [];
363
+
364
+ for (var k in params) {
365
+ // Stream backend doesn't treat "undefined" value same as value not being present.
366
+ // So, we need to skip the undefined values.
367
+ if (params[k] === undefined) continue;
368
+
369
+ if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
370
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
371
+ } else {
372
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
373
+ }
374
+ }
375
+
376
+ return newParams.join('&');
377
+ };
378
+ /**
379
+ * formatMessage - Takes the message object. Parses the dates, sets __html
380
+ * and sets the status to received if missing. Returns a message object
381
+ *
382
+ * @param {MessageResponse<StreamChatGenerics>} message a message object
383
+ *
384
+ */
385
+
386
+ function formatMessage(message) {
387
+ return _objectSpread$8(_objectSpread$8({}, message), {}, {
388
+ /**
389
+ * @deprecated please use `html`
390
+ */
391
+ __html: message.html,
392
+ // parse the date..
393
+ pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
394
+ created_at: message.created_at ? new Date(message.created_at) : new Date(),
395
+ updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
396
+ status: message.status || 'received'
397
+ });
398
+ }
399
+ function addToMessageList(messages, message) {
400
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
401
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
402
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
403
+ var addMessageToList = addIfDoesNotExist || timestampChanged;
404
+ var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
405
+ // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
406
+
407
+ if (timestampChanged) {
408
+ messageArr = messageArr.filter(function (msg) {
409
+ return !(msg.id && message.id === msg.id);
410
+ });
411
+ } // Get array length after filtering
412
+
413
+
414
+ var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
415
+
416
+ if (messageArrayLength === 0 && addMessageToList) {
417
+ return messageArr.concat(message);
418
+ } else if (messageArrayLength === 0) {
419
+ return _toConsumableArray__default['default'](messageArr);
420
+ }
421
+
422
+ var messageTime = message[sortBy].getTime();
423
+ 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
424
+
425
+ if (messageIsNewest && addMessageToList) {
426
+ return messageArr.concat(message);
427
+ } else if (messageIsNewest) {
428
+ return _toConsumableArray__default['default'](messageArr);
429
+ } // find the closest index to push the new message
430
+
431
+
432
+ var left = 0;
433
+ var middle = 0;
434
+ var right = messageArrayLength - 1;
435
+
436
+ while (left <= right) {
437
+ middle = Math.floor((right + left) / 2);
438
+ if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
439
+ } // message already exists and not filtered due to timestampChanged, update and return
440
+
441
+
442
+ if (!timestampChanged && message.id) {
443
+ if (messageArr[left] && message.id === messageArr[left].id) {
444
+ messageArr[left] = message;
445
+ return _toConsumableArray__default['default'](messageArr);
446
+ }
447
+
448
+ if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
449
+ messageArr[left - 1] = message;
450
+ return _toConsumableArray__default['default'](messageArr);
451
+ }
452
+ } // Do not add updated or deleted messages to the list if they do not already exist
453
+ // or have a timestamp change.
454
+
455
+
456
+ if (addMessageToList) {
457
+ messageArr.splice(left, 0, message);
458
+ }
459
+
460
+ return _toConsumableArray__default['default'](messageArr);
461
+ }
462
+
463
+ 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; }
464
+
465
+ 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__default['default'](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; }
128
466
 
129
467
  /**
130
468
  * ChannelState - A container class for the channel state.
@@ -201,7 +539,7 @@ var ChannelState = /*#__PURE__*/function () {
201
539
  var m = messages[i];
202
540
 
203
541
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
204
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
542
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
205
543
  user: user
206
544
  });
207
545
  }
@@ -256,7 +594,7 @@ var ChannelState = /*#__PURE__*/function () {
256
594
  user: m.user
257
595
  };
258
596
  } else {
259
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
597
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
260
598
  type: 'deleted',
261
599
  deleted_at: user.deleted_at
262
600
  });
@@ -363,7 +701,7 @@ var ChannelState = /*#__PURE__*/function () {
363
701
  }, {
364
702
  key: "formatMessage",
365
703
  value: function formatMessage(message) {
366
- return _objectSpread$6(_objectSpread$6({}, message), {}, {
704
+ return _objectSpread$7(_objectSpread$7({}, message), {}, {
367
705
  /**
368
706
  * @deprecated please use `html`
369
707
  */
@@ -581,7 +919,7 @@ var ChannelState = /*#__PURE__*/function () {
581
919
  var parseMessage = function parseMessage(m) {
582
920
  var _m$pinned_at, _m$updated_at;
583
921
 
584
- return _objectSpread$6(_objectSpread$6({}, m), {}, {
922
+ return _objectSpread$7(_objectSpread$7({}, m), {}, {
585
923
  created_at: m.created_at.toISOString(),
586
924
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
587
925
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
@@ -592,8 +930,8 @@ var ChannelState = /*#__PURE__*/function () {
592
930
  var updatedMessages = set.messages.filter(function (msg) {
593
931
  return msg.quoted_message_id === message.id;
594
932
  }).map(parseMessage).map(function (msg) {
595
- return _objectSpread$6(_objectSpread$6({}, msg), {}, {
596
- quoted_message: _objectSpread$6(_objectSpread$6({}, message), {}, {
933
+ return _objectSpread$7(_objectSpread$7({}, msg), {}, {
934
+ quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
597
935
  attachments: []
598
936
  })
599
937
  });
@@ -670,70 +1008,13 @@ var ChannelState = /*#__PURE__*/function () {
670
1008
  * @param message
671
1009
  * @param {boolean} timestampChanged Whether updating a message with changed created_at value.
672
1010
  * @param {string} sortBy field name to use to sort the messages by
673
- * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
674
- */
675
- function _addToMessageList(messages, message) {
676
- var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
677
- var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
678
- var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
679
- var addMessageToList = addIfDoesNotExist || timestampChanged;
680
- var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
681
- // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
682
-
683
- if (timestampChanged) {
684
- messageArr = messageArr.filter(function (msg) {
685
- return !(msg.id && message.id === msg.id);
686
- });
687
- } // Get array length after filtering
688
-
689
-
690
- var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
691
-
692
- if (messageArrayLength === 0 && addMessageToList) {
693
- return messageArr.concat(message);
694
- } else if (messageArrayLength === 0) {
695
- return _toConsumableArray__default['default'](messageArr);
696
- }
697
-
698
- var messageTime = message[sortBy].getTime();
699
- 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
700
-
701
- if (messageIsNewest && addMessageToList) {
702
- return messageArr.concat(message);
703
- } else if (messageIsNewest) {
704
- return _toConsumableArray__default['default'](messageArr);
705
- } // find the closest index to push the new message
706
-
707
-
708
- var left = 0;
709
- var middle = 0;
710
- var right = messageArrayLength - 1;
711
-
712
- while (left <= right) {
713
- middle = Math.floor((right + left) / 2);
714
- if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
715
- } // message already exists and not filtered due to timestampChanged, update and return
716
-
717
-
718
- if (!timestampChanged && message.id) {
719
- if (messageArr[left] && message.id === messageArr[left].id) {
720
- messageArr[left] = message;
721
- return _toConsumableArray__default['default'](messageArr);
722
- }
723
-
724
- if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
725
- messageArr[left - 1] = message;
726
- return _toConsumableArray__default['default'](messageArr);
727
- }
728
- } // Do not add updated or deleted messages to the list if they do not already exist
729
- // or have a timestamp change.
730
-
731
-
732
- if (addMessageToList) {
733
- messageArr.splice(left, 0, message);
734
- }
735
-
736
- return _toConsumableArray__default['default'](messageArr);
1011
+ * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
1012
+ */
1013
+ function _addToMessageList(messages, message) {
1014
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1015
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
1016
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1017
+ return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
737
1018
  }
738
1019
  /**
739
1020
  * removeMessage - Description
@@ -1105,268 +1386,18 @@ var ChannelState = /*#__PURE__*/function () {
1105
1386
  }
1106
1387
  }]);
1107
1388
 
1108
- return ChannelState;
1109
- }();
1110
-
1111
- 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; } } }; }
1112
-
1113
- 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); }
1114
-
1115
- 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; }
1116
-
1117
- /**
1118
- * logChatPromiseExecution - utility function for logging the execution of a promise..
1119
- * use this when you want to run the promise and handle errors by logging a warning
1120
- *
1121
- * @param {Promise<T>} promise The promise you want to run and log
1122
- * @param {string} name A descriptive name of what the promise does for log output
1123
- *
1124
- */
1125
- function logChatPromiseExecution(promise, name) {
1126
- promise.then().catch(function (error) {
1127
- console.warn("failed to do ".concat(name, ", ran into error: "), error);
1128
- });
1129
- }
1130
- var sleep = function sleep(m) {
1131
- return new Promise(function (r) {
1132
- return setTimeout(r, m);
1133
- });
1134
- };
1135
- function isFunction(value) {
1136
- return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
1137
- }
1138
- var chatCodes = {
1139
- TOKEN_EXPIRED: 40,
1140
- WS_CLOSED_SUCCESS: 1000
1141
- };
1142
-
1143
- function isReadableStream(obj) {
1144
- return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
1145
- }
1146
-
1147
- function isBuffer(obj) {
1148
- return obj != null && obj.constructor != null && // @ts-expect-error
1149
- typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
1150
- obj.constructor.isBuffer(obj);
1151
- }
1152
-
1153
- function isFileWebAPI(uri) {
1154
- return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
1155
- }
1156
-
1157
- function isOwnUser(user) {
1158
- return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
1159
- }
1160
-
1161
- function isBlobWebAPI(uri) {
1162
- return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
1163
- }
1164
-
1165
- function isOwnUserBaseProperty(property) {
1166
- var ownUserBaseProperties = {
1167
- channel_mutes: true,
1168
- devices: true,
1169
- mutes: true,
1170
- total_unread_count: true,
1171
- unread_channels: true,
1172
- unread_count: true,
1173
- invisible: true,
1174
- roles: true
1175
- };
1176
- return ownUserBaseProperties[property];
1177
- }
1178
- function addFileToFormData(uri, name, contentType) {
1179
- var data = new FormData__default['default']();
1180
-
1181
- if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
1182
- if (name) data.append('file', uri, name);else data.append('file', uri);
1183
- } else {
1184
- data.append('file', {
1185
- uri: uri,
1186
- name: name || uri.split('/').reverse()[0],
1187
- contentType: contentType || undefined,
1188
- type: contentType || undefined
1189
- });
1190
- }
1191
-
1192
- return data;
1193
- }
1194
- function normalizeQuerySort(sort) {
1195
- var sortFields = [];
1196
- var sortArr = Array.isArray(sort) ? sort : [sort];
1197
-
1198
- var _iterator = _createForOfIteratorHelper$3(sortArr),
1199
- _step;
1200
-
1201
- try {
1202
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1203
- var item = _step.value;
1204
- var entries = Object.entries(item);
1205
-
1206
- if (entries.length > 1) {
1207
- console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
1208
- }
1209
-
1210
- for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
1211
- var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
1212
- field = _entries$_i[0],
1213
- direction = _entries$_i[1];
1214
-
1215
- sortFields.push({
1216
- field: field,
1217
- direction: direction
1218
- });
1219
- }
1220
- }
1221
- } catch (err) {
1222
- _iterator.e(err);
1223
- } finally {
1224
- _iterator.f();
1225
- }
1226
-
1227
- return sortFields;
1228
- }
1229
- /**
1230
- * retryInterval - A retry interval which increases acc to number of failures
1231
- *
1232
- * @return {number} Duration to wait in milliseconds
1233
- */
1234
-
1235
- function retryInterval(numberOfFailures) {
1236
- // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
1237
- var max = Math.min(500 + numberOfFailures * 2000, 25000);
1238
- var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
1239
- return Math.floor(Math.random() * (max - min) + min);
1240
- }
1241
- function randomId() {
1242
- return generateUUIDv4();
1243
- }
1244
-
1245
- function hex(bytes) {
1246
- var s = '';
1247
-
1248
- for (var i = 0; i < bytes.length; i++) {
1249
- s += bytes[i].toString(16).padStart(2, '0');
1250
- }
1251
-
1252
- return s;
1253
- } // https://tools.ietf.org/html/rfc4122
1254
-
1255
-
1256
- function generateUUIDv4() {
1257
- var bytes = getRandomBytes(16);
1258
- bytes[6] = bytes[6] & 0x0f | 0x40; // version
1259
-
1260
- bytes[8] = bytes[8] & 0xbf | 0x80; // variant
1261
-
1262
- 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));
1263
- }
1264
-
1265
- function getRandomValuesWithMathRandom(bytes) {
1266
- var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
1267
-
1268
- for (var i = 0; i < bytes.length; i++) {
1269
- bytes[i] = Math.random() * max;
1270
- }
1271
- }
1272
-
1273
- var getRandomValues = function () {
1274
- var _crypto;
1275
-
1276
- if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
1277
- return crypto.getRandomValues.bind(crypto);
1278
- } else if (typeof msCrypto !== 'undefined') {
1279
- return msCrypto.getRandomValues.bind(msCrypto);
1280
- } else {
1281
- return getRandomValuesWithMathRandom;
1282
- }
1283
- }();
1284
-
1285
- function getRandomBytes(length) {
1286
- var bytes = new Uint8Array(length);
1287
- getRandomValues(bytes);
1288
- return bytes;
1289
- }
1290
-
1291
- function convertErrorToJson(err) {
1292
- var jsonObj = {};
1293
- if (!err) return jsonObj;
1294
-
1295
- try {
1296
- Object.getOwnPropertyNames(err).forEach(function (key) {
1297
- jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
1298
- });
1299
- } catch (_) {
1300
- return {
1301
- error: 'failed to serialize the error'
1302
- };
1303
- }
1304
-
1305
- return jsonObj;
1306
- }
1307
- /**
1308
- * isOnline safely return the navigator.online value for browser env
1309
- * if navigator is not in global object, it always return true
1310
- */
1311
-
1312
- function isOnline() {
1313
- var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
1314
-
1315
- if (!nav) {
1316
- console.warn('isOnline failed to access window.navigator and assume browser is online');
1317
- return true;
1318
- } // RN navigator has undefined for onLine
1319
-
1320
-
1321
- if (typeof nav.onLine !== 'boolean') {
1322
- return true;
1323
- }
1324
-
1325
- return nav.onLine;
1326
- }
1327
- /**
1328
- * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
1329
- */
1330
-
1331
- function addConnectionEventListeners(cb) {
1332
- if (typeof window !== 'undefined' && window.addEventListener) {
1333
- window.addEventListener('offline', cb);
1334
- window.addEventListener('online', cb);
1335
- }
1336
- }
1337
- function removeConnectionEventListeners(cb) {
1338
- if (typeof window !== 'undefined' && window.removeEventListener) {
1339
- window.removeEventListener('offline', cb);
1340
- window.removeEventListener('online', cb);
1341
- }
1342
- }
1343
- var axiosParamsSerializer = function axiosParamsSerializer(params) {
1344
- var newParams = [];
1345
-
1346
- for (var k in params) {
1347
- // Stream backend doesn't treat "undefined" value same as value not being present.
1348
- // So, we need to skip the undefined values.
1349
- if (params[k] === undefined) continue;
1350
-
1351
- if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
1352
- newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1353
- } else {
1354
- newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
1355
- }
1356
- }
1357
-
1358
- return newParams.join('&');
1359
- };
1389
+ return ChannelState;
1390
+ }();
1360
1391
 
1361
- 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; } } }; }
1392
+ 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; } } }; }
1362
1393
 
1363
- 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); }
1394
+ 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); }
1364
1395
 
1365
- 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; }
1396
+ 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; }
1366
1397
 
1367
- 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; }
1398
+ 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; }
1368
1399
 
1369
- 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__default['default'](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; }
1400
+ 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__default['default'](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; }
1370
1401
 
1371
1402
  /**
1372
1403
  * Channel - The Channel class manages it's own state.
@@ -1439,7 +1470,7 @@ var Channel = /*#__PURE__*/function () {
1439
1470
  while (1) {
1440
1471
  switch (_context.prev = _context.next) {
1441
1472
  case 0:
1442
- defaultOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
1473
+ defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
1443
1474
  watch: false,
1444
1475
  state: false,
1445
1476
  presence: false
@@ -1511,7 +1542,7 @@ var Channel = /*#__PURE__*/function () {
1511
1542
 
1512
1543
  this.data = data; // this._data is used for the requests...
1513
1544
 
1514
- this._data = _objectSpread$5({}, data);
1545
+ this._data = _objectSpread$6({}, data);
1515
1546
  this.cid = "".concat(type, ":").concat(id);
1516
1547
  this.listeners = {}; // perhaps the state variable should be private
1517
1548
 
@@ -1573,7 +1604,7 @@ var Channel = /*#__PURE__*/function () {
1573
1604
  switch (_context2.prev = _context2.next) {
1574
1605
  case 0:
1575
1606
  _context2.next = 2;
1576
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1607
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
1577
1608
  message: message
1578
1609
  }, options));
1579
1610
 
@@ -1689,7 +1720,7 @@ var Channel = /*#__PURE__*/function () {
1689
1720
 
1690
1721
  case 3:
1691
1722
  // Return a list of channels
1692
- payload = _objectSpread$5(_objectSpread$5({
1723
+ payload = _objectSpread$6(_objectSpread$6({
1693
1724
  filter_conditions: {
1694
1725
  cid: this.cid
1695
1726
  }
@@ -1786,7 +1817,7 @@ var Channel = /*#__PURE__*/function () {
1786
1817
 
1787
1818
  _context5.next = 6;
1788
1819
  return this.getClient().get(this.getClient().baseURL + '/members', {
1789
- payload: _objectSpread$5({
1820
+ payload: _objectSpread$6({
1790
1821
  type: type,
1791
1822
  id: id,
1792
1823
  members: members,
@@ -1847,7 +1878,7 @@ var Channel = /*#__PURE__*/function () {
1847
1878
 
1848
1879
  case 4:
1849
1880
  _context6.next = 6;
1850
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$5({
1881
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
1851
1882
  reaction: reaction
1852
1883
  }, options));
1853
1884
 
@@ -1928,7 +1959,7 @@ var Channel = /*#__PURE__*/function () {
1928
1959
  delete channelData[key];
1929
1960
  });
1930
1961
  _context7.next = 7;
1931
- return this._update(_objectSpread$5({
1962
+ return this._update(_objectSpread$6({
1932
1963
  message: updateMessage,
1933
1964
  data: channelData
1934
1965
  }, options));
@@ -1962,7 +1993,9 @@ var Channel = /*#__PURE__*/function () {
1962
1993
  key: "updatePartial",
1963
1994
  value: function () {
1964
1995
  var _updatePartial = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8(update) {
1965
- var data;
1996
+ var _this$data2, _this$data3;
1997
+
1998
+ var data, areCapabilitiesChanged;
1966
1999
  return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
1967
2000
  while (1) {
1968
2001
  switch (_context8.prev = _context8.next) {
@@ -1972,10 +2005,20 @@ var Channel = /*#__PURE__*/function () {
1972
2005
 
1973
2006
  case 2:
1974
2007
  data = _context8.sent;
1975
- this.data = data.channel;
2008
+ areCapabilitiesChanged = _toConsumableArray__default['default'](data.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) ? (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.own_capabilities : []).sort().join();
2009
+ this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
2010
+
2011
+ if (areCapabilitiesChanged) {
2012
+ this.getClient().dispatchEvent({
2013
+ type: 'capabilities.changed',
2014
+ cid: this.cid,
2015
+ own_capabilities: data.channel.own_capabilities
2016
+ });
2017
+ }
2018
+
1976
2019
  return _context8.abrupt("return", data);
1977
2020
 
1978
- case 5:
2021
+ case 7:
1979
2022
  case "end":
1980
2023
  return _context8.stop();
1981
2024
  }
@@ -2088,7 +2131,7 @@ var Channel = /*#__PURE__*/function () {
2088
2131
  case 0:
2089
2132
  options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
2090
2133
  _context11.next = 3;
2091
- return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
2134
+ return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
2092
2135
 
2093
2136
  case 3:
2094
2137
  return _context11.abrupt("return", _context11.sent);
@@ -2164,7 +2207,7 @@ var Channel = /*#__PURE__*/function () {
2164
2207
  case 0:
2165
2208
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2166
2209
  _context13.next = 3;
2167
- return this._update(_objectSpread$5({
2210
+ return this._update(_objectSpread$6({
2168
2211
  accept_invite: true
2169
2212
  }, options));
2170
2213
 
@@ -2205,7 +2248,7 @@ var Channel = /*#__PURE__*/function () {
2205
2248
  case 0:
2206
2249
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2207
2250
  _context14.next = 3;
2208
- return this._update(_objectSpread$5({
2251
+ return this._update(_objectSpread$6({
2209
2252
  reject_invite: true
2210
2253
  }, options));
2211
2254
 
@@ -2247,7 +2290,7 @@ var Channel = /*#__PURE__*/function () {
2247
2290
  case 0:
2248
2291
  options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
2249
2292
  _context15.next = 3;
2250
- return this._update(_objectSpread$5({
2293
+ return this._update(_objectSpread$6({
2251
2294
  add_members: members,
2252
2295
  message: message
2253
2296
  }, options));
@@ -2290,7 +2333,7 @@ var Channel = /*#__PURE__*/function () {
2290
2333
  case 0:
2291
2334
  options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
2292
2335
  _context16.next = 3;
2293
- return this._update(_objectSpread$5({
2336
+ return this._update(_objectSpread$6({
2294
2337
  add_moderators: members,
2295
2338
  message: message
2296
2339
  }, options));
@@ -2333,7 +2376,7 @@ var Channel = /*#__PURE__*/function () {
2333
2376
  case 0:
2334
2377
  options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
2335
2378
  _context17.next = 3;
2336
- return this._update(_objectSpread$5({
2379
+ return this._update(_objectSpread$6({
2337
2380
  assign_roles: roles,
2338
2381
  message: message
2339
2382
  }, options));
@@ -2376,7 +2419,7 @@ var Channel = /*#__PURE__*/function () {
2376
2419
  case 0:
2377
2420
  options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
2378
2421
  _context18.next = 3;
2379
- return this._update(_objectSpread$5({
2422
+ return this._update(_objectSpread$6({
2380
2423
  invites: members,
2381
2424
  message: message
2382
2425
  }, options));
@@ -2419,7 +2462,7 @@ var Channel = /*#__PURE__*/function () {
2419
2462
  case 0:
2420
2463
  options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
2421
2464
  _context19.next = 3;
2422
- return this._update(_objectSpread$5({
2465
+ return this._update(_objectSpread$6({
2423
2466
  remove_members: members,
2424
2467
  message: message
2425
2468
  }, options));
@@ -2462,7 +2505,7 @@ var Channel = /*#__PURE__*/function () {
2462
2505
  case 0:
2463
2506
  options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
2464
2507
  _context20.next = 3;
2465
- return this._update(_objectSpread$5({
2508
+ return this._update(_objectSpread$6({
2466
2509
  demote_moderators: members,
2467
2510
  message: message
2468
2511
  }, options));
@@ -2547,7 +2590,7 @@ var Channel = /*#__PURE__*/function () {
2547
2590
  case 0:
2548
2591
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2549
2592
  _context22.next = 3;
2550
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$5({
2593
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
2551
2594
  channel_cid: this.cid
2552
2595
  }, opts));
2553
2596
 
@@ -2589,7 +2632,7 @@ var Channel = /*#__PURE__*/function () {
2589
2632
  case 0:
2590
2633
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2591
2634
  _context23.next = 3;
2592
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$5({
2635
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
2593
2636
  channel_cid: this.cid
2594
2637
  }, opts));
2595
2638
 
@@ -2648,7 +2691,7 @@ var Channel = /*#__PURE__*/function () {
2648
2691
  }, {
2649
2692
  key: "keystroke",
2650
2693
  value: function () {
2651
- var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id) {
2694
+ var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
2652
2695
  var _this$getConfig;
2653
2696
 
2654
2697
  var now, diff;
@@ -2676,10 +2719,10 @@ var Channel = /*#__PURE__*/function () {
2676
2719
 
2677
2720
  this.lastTypingEvent = new Date();
2678
2721
  _context24.next = 10;
2679
- return this.sendEvent({
2722
+ return this.sendEvent(_objectSpread$6({
2680
2723
  type: 'typing.start',
2681
2724
  parent_id: parent_id
2682
- });
2725
+ }, options || {}));
2683
2726
 
2684
2727
  case 10:
2685
2728
  case "end":
@@ -2689,7 +2732,7 @@ var Channel = /*#__PURE__*/function () {
2689
2732
  }, _callee24, this);
2690
2733
  }));
2691
2734
 
2692
- function keystroke(_x25) {
2735
+ function keystroke(_x25, _x26) {
2693
2736
  return _keystroke.apply(this, arguments);
2694
2737
  }
2695
2738
 
@@ -2704,7 +2747,7 @@ var Channel = /*#__PURE__*/function () {
2704
2747
  }, {
2705
2748
  key: "stopTyping",
2706
2749
  value: function () {
2707
- var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id) {
2750
+ var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
2708
2751
  var _this$getConfig2;
2709
2752
 
2710
2753
  return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
@@ -2722,10 +2765,10 @@ var Channel = /*#__PURE__*/function () {
2722
2765
  this.lastTypingEvent = null;
2723
2766
  this.isTyping = false;
2724
2767
  _context25.next = 6;
2725
- return this.sendEvent({
2768
+ return this.sendEvent(_objectSpread$6({
2726
2769
  type: 'typing.stop',
2727
2770
  parent_id: parent_id
2728
- });
2771
+ }, options || {}));
2729
2772
 
2730
2773
  case 6:
2731
2774
  case "end":
@@ -2735,7 +2778,7 @@ var Channel = /*#__PURE__*/function () {
2735
2778
  }, _callee25, this);
2736
2779
  }));
2737
2780
 
2738
- function stopTyping(_x26) {
2781
+ function stopTyping(_x27, _x28) {
2739
2782
  return _stopTyping.apply(this, arguments);
2740
2783
  }
2741
2784
 
@@ -2789,7 +2832,7 @@ var Channel = /*#__PURE__*/function () {
2789
2832
 
2790
2833
  this._checkInitialized();
2791
2834
 
2792
- if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
2835
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2793
2836
  _context26.next = 4;
2794
2837
  break;
2795
2838
  }
@@ -2798,7 +2841,7 @@ var Channel = /*#__PURE__*/function () {
2798
2841
 
2799
2842
  case 4:
2800
2843
  _context26.next = 6;
2801
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$5({}, data));
2844
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
2802
2845
 
2803
2846
  case 6:
2804
2847
  return _context26.abrupt("return", _context26.sent);
@@ -2836,7 +2879,7 @@ var Channel = /*#__PURE__*/function () {
2836
2879
  case 0:
2837
2880
  this._checkInitialized();
2838
2881
 
2839
- if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
2882
+ if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2840
2883
  _context27.next = 3;
2841
2884
  break;
2842
2885
  }
@@ -2845,7 +2888,7 @@ var Channel = /*#__PURE__*/function () {
2845
2888
 
2846
2889
  case 3:
2847
2890
  _context27.next = 5;
2848
- return this.getClient().post(this._channelURL() + '/unread', _objectSpread$5({}, data));
2891
+ return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
2849
2892
 
2850
2893
  case 5:
2851
2894
  return _context27.abrupt("return", _context27.sent);
@@ -2858,7 +2901,7 @@ var Channel = /*#__PURE__*/function () {
2858
2901
  }, _callee27, this);
2859
2902
  }));
2860
2903
 
2861
- function markUnread(_x27) {
2904
+ function markUnread(_x29) {
2862
2905
  return _markUnread.apply(this, arguments);
2863
2906
  }
2864
2907
 
@@ -2913,7 +2956,7 @@ var Channel = /*#__PURE__*/function () {
2913
2956
  defaultOptions.watch = false;
2914
2957
  }
2915
2958
 
2916
- combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
2959
+ combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
2917
2960
  _context28.next = 7;
2918
2961
  return this.query(combined, 'latest');
2919
2962
 
@@ -2937,7 +2980,7 @@ var Channel = /*#__PURE__*/function () {
2937
2980
  }, _callee28, this);
2938
2981
  }));
2939
2982
 
2940
- function watch(_x28) {
2983
+ function watch(_x30) {
2941
2984
  return _watch.apply(this, arguments);
2942
2985
  }
2943
2986
 
@@ -3004,7 +3047,7 @@ var Channel = /*#__PURE__*/function () {
3004
3047
  switch (_context30.prev = _context30.next) {
3005
3048
  case 0:
3006
3049
  _context30.next = 2;
3007
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$5({}, options));
3050
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
3008
3051
 
3009
3052
  case 2:
3010
3053
  data = _context30.sent;
@@ -3024,7 +3067,7 @@ var Channel = /*#__PURE__*/function () {
3024
3067
  }, _callee30, this);
3025
3068
  }));
3026
3069
 
3027
- function getReplies(_x29, _x30) {
3070
+ function getReplies(_x31, _x32) {
3028
3071
  return _getReplies.apply(this, arguments);
3029
3072
  }
3030
3073
 
@@ -3052,7 +3095,7 @@ var Channel = /*#__PURE__*/function () {
3052
3095
  sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
3053
3096
  _context31.next = 3;
3054
3097
  return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
3055
- payload: _objectSpread$5(_objectSpread$5({}, options), {}, {
3098
+ payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
3056
3099
  sort: normalizeQuerySort(sort)
3057
3100
  })
3058
3101
  });
@@ -3068,7 +3111,7 @@ var Channel = /*#__PURE__*/function () {
3068
3111
  }, _callee31, this);
3069
3112
  }));
3070
3113
 
3071
- function getPinnedMessages(_x31) {
3114
+ function getPinnedMessages(_x33) {
3072
3115
  return _getPinnedMessages.apply(this, arguments);
3073
3116
  }
3074
3117
 
@@ -3086,7 +3129,7 @@ var Channel = /*#__PURE__*/function () {
3086
3129
  }, {
3087
3130
  key: "getReactions",
3088
3131
  value: function getReactions(message_id, options) {
3089
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$5({}, options));
3132
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
3090
3133
  }
3091
3134
  /**
3092
3135
  * getMessagesById - Retrieves a list of messages by ID
@@ -3121,7 +3164,7 @@ var Channel = /*#__PURE__*/function () {
3121
3164
  }, {
3122
3165
  key: "_countMessageAsUnread",
3123
3166
  value: function _countMessageAsUnread(message) {
3124
- var _message$user, _message$user2, _this$data2, _this$data3;
3167
+ var _message$user, _message$user2, _this$data4, _this$data5;
3125
3168
 
3126
3169
  if (message.shadowed) return false;
3127
3170
  if (message.silent) return false;
@@ -3130,7 +3173,7 @@ var Channel = /*#__PURE__*/function () {
3130
3173
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3131
3174
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3132
3175
 
3133
- if (Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) && !((_this$data3 = this.data) !== null && _this$data3 !== void 0 && _this$data3.own_capabilities.includes('read-events'))) return false;
3176
+ if (Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) && !((_this$data5 = this.data) !== null && _this$data5 !== void 0 && _this$data5.own_capabilities.includes('read-events'))) return false;
3134
3177
  if (this.muteStatus().muted) return false;
3135
3178
  return true;
3136
3179
  }
@@ -3205,7 +3248,7 @@ var Channel = /*#__PURE__*/function () {
3205
3248
  */
3206
3249
  function () {
3207
3250
  var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee32(options) {
3208
- var _this$data4, _this$data5;
3251
+ var _this$data6, _this$data7;
3209
3252
 
3210
3253
  var messageSetToAddToIfDoesNotExist,
3211
3254
  queryURL,
@@ -3233,7 +3276,7 @@ var Channel = /*#__PURE__*/function () {
3233
3276
  }
3234
3277
 
3235
3278
  _context32.next = 7;
3236
- return this.getClient().post(queryURL + '/query', _objectSpread$5({
3279
+ return this.getClient().post(queryURL + '/query', _objectSpread$6({
3237
3280
  data: this._data,
3238
3281
  state: true
3239
3282
  }, options));
@@ -3268,7 +3311,7 @@ var Channel = /*#__PURE__*/function () {
3268
3311
 
3269
3312
 
3270
3313
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3271
- areCapabilitiesChanged = _toConsumableArray__default['default'](state.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) ? (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.own_capabilities : []).sort().join();
3314
+ areCapabilitiesChanged = _toConsumableArray__default['default'](state.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.own_capabilities) ? (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.own_capabilities : []).sort().join();
3272
3315
  this.data = state.channel;
3273
3316
  this.offlineMode = false;
3274
3317
 
@@ -3297,7 +3340,7 @@ var Channel = /*#__PURE__*/function () {
3297
3340
  }, _callee32, this);
3298
3341
  }));
3299
3342
 
3300
- function query(_x32) {
3343
+ function query(_x34) {
3301
3344
  return _query.apply(this, arguments);
3302
3345
  }
3303
3346
 
@@ -3322,7 +3365,7 @@ var Channel = /*#__PURE__*/function () {
3322
3365
  this._checkInitialized();
3323
3366
 
3324
3367
  _context33.next = 3;
3325
- return this.getClient().banUser(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3368
+ return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3326
3369
  type: this.type,
3327
3370
  id: this.id
3328
3371
  }));
@@ -3338,7 +3381,7 @@ var Channel = /*#__PURE__*/function () {
3338
3381
  }, _callee33, this);
3339
3382
  }));
3340
3383
 
3341
- function banUser(_x33, _x34) {
3384
+ function banUser(_x35, _x36) {
3342
3385
  return _banUser.apply(this, arguments);
3343
3386
  }
3344
3387
 
@@ -3469,7 +3512,7 @@ var Channel = /*#__PURE__*/function () {
3469
3512
  }, _callee36, this);
3470
3513
  }));
3471
3514
 
3472
- function unbanUser(_x35) {
3515
+ function unbanUser(_x37) {
3473
3516
  return _unbanUser.apply(this, arguments);
3474
3517
  }
3475
3518
 
@@ -3494,7 +3537,7 @@ var Channel = /*#__PURE__*/function () {
3494
3537
  this._checkInitialized();
3495
3538
 
3496
3539
  _context37.next = 3;
3497
- return this.getClient().shadowBan(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3540
+ return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3498
3541
  type: this.type,
3499
3542
  id: this.id
3500
3543
  }));
@@ -3510,7 +3553,7 @@ var Channel = /*#__PURE__*/function () {
3510
3553
  }, _callee37, this);
3511
3554
  }));
3512
3555
 
3513
- function shadowBan(_x36, _x37) {
3556
+ function shadowBan(_x38, _x39) {
3514
3557
  return _shadowBan.apply(this, arguments);
3515
3558
  }
3516
3559
 
@@ -3550,7 +3593,7 @@ var Channel = /*#__PURE__*/function () {
3550
3593
  }, _callee38, this);
3551
3594
  }));
3552
3595
 
3553
- function removeShadowBan(_x38) {
3596
+ function removeShadowBan(_x40) {
3554
3597
  return _removeShadowBan.apply(this, arguments);
3555
3598
  }
3556
3599
 
@@ -3585,7 +3628,7 @@ var Channel = /*#__PURE__*/function () {
3585
3628
  }, _callee39, this);
3586
3629
  }));
3587
3630
 
3588
- function createCall(_x39) {
3631
+ function createCall(_x41) {
3589
3632
  return _createCall.apply(this, arguments);
3590
3633
  }
3591
3634
 
@@ -3880,7 +3923,7 @@ var Channel = /*#__PURE__*/function () {
3880
3923
  });
3881
3924
  }
3882
3925
 
3883
- channel.data = _objectSpread$5(_objectSpread$5({}, event.channel), {}, {
3926
+ channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
3884
3927
  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,
3885
3928
  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
3886
3929
  });
@@ -3911,7 +3954,7 @@ var Channel = /*#__PURE__*/function () {
3911
3954
  break;
3912
3955
 
3913
3956
  case 'channel.hidden':
3914
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3957
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3915
3958
  hidden: true
3916
3959
  });
3917
3960
 
@@ -3922,26 +3965,26 @@ var Channel = /*#__PURE__*/function () {
3922
3965
  break;
3923
3966
 
3924
3967
  case 'channel.visible':
3925
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3968
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3926
3969
  hidden: false
3927
3970
  });
3928
3971
  break;
3929
3972
 
3930
3973
  case 'user.banned':
3931
3974
  if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3932
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3975
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3933
3976
  shadow_banned: !!event.shadow,
3934
3977
  banned: !event.shadow,
3935
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3978
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3936
3979
  });
3937
3980
  break;
3938
3981
 
3939
3982
  case 'user.unbanned':
3940
3983
  if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
3941
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3984
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3942
3985
  shadow_banned: false,
3943
3986
  banned: false,
3944
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3987
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3945
3988
  });
3946
3989
  break;
3947
3990
  } // any event can send over the online count
@@ -3971,7 +4014,7 @@ var Channel = /*#__PURE__*/function () {
3971
4014
 
3972
4015
 
3973
4016
  if (state.members) {
3974
- var _iterator = _createForOfIteratorHelper$2(state.members),
4017
+ var _iterator = _createForOfIteratorHelper$3(state.members),
3975
4018
  _step;
3976
4019
 
3977
4020
  try {
@@ -4015,7 +4058,7 @@ var Channel = /*#__PURE__*/function () {
4015
4058
 
4016
4059
 
4017
4060
  if (state.watchers) {
4018
- var _iterator2 = _createForOfIteratorHelper$2(state.watchers),
4061
+ var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
4019
4062
  _step2;
4020
4063
 
4021
4064
  try {
@@ -4051,7 +4094,7 @@ var Channel = /*#__PURE__*/function () {
4051
4094
 
4052
4095
 
4053
4096
  if (state.read) {
4054
- var _iterator3 = _createForOfIteratorHelper$2(state.read),
4097
+ var _iterator3 = _createForOfIteratorHelper$3(state.read),
4055
4098
  _step3;
4056
4099
 
4057
4100
  try {
@@ -4120,11 +4163,11 @@ var Channel = /*#__PURE__*/function () {
4120
4163
  return Channel;
4121
4164
  }();
4122
4165
 
4123
- 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; } } }; }
4166
+ 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; } } }; }
4124
4167
 
4125
- 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); }
4168
+ 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); }
4126
4169
 
4127
- 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; }
4170
+ 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; }
4128
4171
 
4129
4172
  /**
4130
4173
  * ClientState - A container class for the client state.
@@ -4147,7 +4190,7 @@ var ClientState = /*#__PURE__*/function () {
4147
4190
  _createClass__default['default'](ClientState, [{
4148
4191
  key: "updateUsers",
4149
4192
  value: function updateUsers(users) {
4150
- var _iterator = _createForOfIteratorHelper$1(users),
4193
+ var _iterator = _createForOfIteratorHelper$2(users),
4151
4194
  _step;
4152
4195
 
4153
4196
  try {
@@ -4195,9 +4238,9 @@ var ClientState = /*#__PURE__*/function () {
4195
4238
  return ClientState;
4196
4239
  }();
4197
4240
 
4198
- 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; }
4241
+ 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; }
4199
4242
 
4200
- 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__default['default'](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; }
4243
+ 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__default['default'](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; }
4201
4244
  var InsightMetrics = function InsightMetrics() {
4202
4245
  _classCallCheck__default['default'](this, InsightMetrics);
4203
4246
 
@@ -4276,7 +4319,7 @@ var postInsights = /*#__PURE__*/function () {
4276
4319
  };
4277
4320
  }();
4278
4321
  function buildWsFatalInsight(connection, event) {
4279
- return _objectSpread$4(_objectSpread$4({}, event), buildWsBaseInsight(connection));
4322
+ return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
4280
4323
  }
4281
4324
 
4282
4325
  function buildWsBaseInsight(connection) {
@@ -4309,9 +4352,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
4309
4352
  return buildWsBaseInsight(connection);
4310
4353
  }
4311
4354
 
4312
- 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; }
4355
+ 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; }
4313
4356
 
4314
- 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__default['default'](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; }
4357
+ 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__default['default'](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; }
4315
4358
 
4316
4359
  // Type guards to check WebSocket error type
4317
4360
  var isCloseEvent = function isCloseEvent(res) {
@@ -4675,7 +4718,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4675
4718
  value: function _log(msg) {
4676
4719
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4677
4720
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
4678
- this.client.logger(level, 'connection:' + msg, _objectSpread$3({
4721
+ this.client.logger(level, 'connection:' + msg, _objectSpread$4({
4679
4722
  tags: ['connection']
4680
4723
  }, extra));
4681
4724
  }
@@ -5266,9 +5309,9 @@ var StableWSConnection = /*#__PURE__*/function () {
5266
5309
  return StableWSConnection;
5267
5310
  }();
5268
5311
 
5269
- 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; }
5312
+ 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; }
5270
5313
 
5271
- 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__default['default'](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; }
5314
+ 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__default['default'](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; }
5272
5315
 
5273
5316
  /**
5274
5317
  * Creates the JWT token that can be used for a UserSession
@@ -5289,7 +5332,7 @@ function JWTUserToken(apiSecret, userId) {
5289
5332
  throw new TypeError('userId should be a string');
5290
5333
  }
5291
5334
 
5292
- var payload = _objectSpread$2({
5335
+ var payload = _objectSpread$3({
5293
5336
  user_id: userId
5294
5337
  }, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
5295
5338
 
@@ -5699,9 +5742,9 @@ function isErrorResponse(res) {
5699
5742
  return !res.status || res.status < 200 || 300 <= res.status;
5700
5743
  }
5701
5744
 
5702
- 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; }
5745
+ 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; }
5703
5746
 
5704
- 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__default['default'](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; }
5747
+ 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__default['default'](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; }
5705
5748
  var ConnectionState;
5706
5749
 
5707
5750
  (function (ConnectionState) {
@@ -5764,7 +5807,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5764
5807
  _context.next = 4;
5765
5808
  return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
5766
5809
  undefined, {
5767
- config: _objectSpread$1(_objectSpread$1({}, config), {}, {
5810
+ config: _objectSpread$2(_objectSpread$2({}, config), {}, {
5768
5811
  cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
5769
5812
  }),
5770
5813
  params: params
@@ -6042,7 +6085,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6042
6085
  value: function _log(msg) {
6043
6086
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6044
6087
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
6045
- this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$1({
6088
+ this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
6046
6089
  tags: ['connection_fallback', 'connection']
6047
6090
  }, extra));
6048
6091
  }
@@ -6089,6 +6132,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
6089
6132
  /**
6090
6133
  * Response Types
6091
6134
  */
6135
+ // TODO: Figure out a way to strongly type set and unset.
6092
6136
  // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6093
6137
 
6094
6138
  /**
@@ -6160,6 +6204,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6160
6204
  return ErrorFromResponse;
6161
6205
  }( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
6162
6206
 
6207
+ 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; }
6208
+
6209
+ 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__default['default'](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; }
6210
+
6211
+ 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; } } }; }
6212
+
6213
+ 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); }
6214
+
6215
+ 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; }
6216
+ var Thread = /*#__PURE__*/function () {
6217
+ function Thread(client, t) {
6218
+ _classCallCheck__default['default'](this, Thread);
6219
+
6220
+ _defineProperty__default['default'](this, "id", void 0);
6221
+
6222
+ _defineProperty__default['default'](this, "latestReplies", []);
6223
+
6224
+ _defineProperty__default['default'](this, "participants", []);
6225
+
6226
+ _defineProperty__default['default'](this, "message", void 0);
6227
+
6228
+ _defineProperty__default['default'](this, "channel", void 0);
6229
+
6230
+ _defineProperty__default['default'](this, "_channel", void 0);
6231
+
6232
+ _defineProperty__default['default'](this, "replyCount", 0);
6233
+
6234
+ _defineProperty__default['default'](this, "_client", void 0);
6235
+
6236
+ _defineProperty__default['default'](this, "read", {});
6237
+
6238
+ this.id = t.parent_message.id;
6239
+ this.message = formatMessage(t.parent_message);
6240
+ this.latestReplies = t.latest_replies.map(formatMessage);
6241
+ this.participants = t.thread_participants;
6242
+ this.replyCount = t.reply_count;
6243
+ this.channel = t.channel;
6244
+ this._channel = client.channel(t.channel.type, t.channel.id);
6245
+ this._client = client;
6246
+
6247
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6248
+ _step;
6249
+
6250
+ try {
6251
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6252
+ var r = _step.value;
6253
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6254
+ last_read: new Date(r.last_read)
6255
+ });
6256
+ }
6257
+ } catch (err) {
6258
+ _iterator.e(err);
6259
+ } finally {
6260
+ _iterator.f();
6261
+ }
6262
+ }
6263
+
6264
+ _createClass__default['default'](Thread, [{
6265
+ key: "getClient",
6266
+ value: function getClient() {
6267
+ return this._client;
6268
+ }
6269
+ }, {
6270
+ key: "addReply",
6271
+ value: function addReply(message) {
6272
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6273
+ }
6274
+ }, {
6275
+ key: "updateReply",
6276
+ value: function updateReply(message) {
6277
+ this.latestReplies = this.latestReplies.map(function (m) {
6278
+ if (m.id === message.id) {
6279
+ return formatMessage(message);
6280
+ }
6281
+
6282
+ return m;
6283
+ });
6284
+ }
6285
+ }, {
6286
+ key: "updateMessageOrReplyIfExists",
6287
+ value: function updateMessageOrReplyIfExists(message) {
6288
+ if (!message.parent_id && message.id !== this.message.id) {
6289
+ return;
6290
+ }
6291
+
6292
+ if (message.parent_id && message.parent_id !== this.message.id) {
6293
+ return;
6294
+ }
6295
+
6296
+ if (message.parent_id && message.parent_id === this.message.id) {
6297
+ this.updateReply(message);
6298
+ }
6299
+
6300
+ if (!message.parent_id && message.id === this.message.id) {
6301
+ this.message = formatMessage(message);
6302
+ }
6303
+ }
6304
+ }, {
6305
+ key: "addReaction",
6306
+ value: function addReaction(reaction, message, enforce_unique) {
6307
+ var _this = this;
6308
+
6309
+ if (!message) return;
6310
+ this.latestReplies = this.latestReplies.map(function (m) {
6311
+ if (m.id === message.id) {
6312
+ return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
6313
+ }
6314
+
6315
+ return m;
6316
+ });
6317
+ }
6318
+ }, {
6319
+ key: "removeReaction",
6320
+ value: function removeReaction(reaction, message) {
6321
+ var _this2 = this;
6322
+
6323
+ if (!message) return;
6324
+ this.latestReplies = this.latestReplies.map(function (m) {
6325
+ if (m.id === message.id) {
6326
+ return formatMessage(_this2._channel.state.removeReaction(reaction, message));
6327
+ }
6328
+
6329
+ return m;
6330
+ });
6331
+ }
6332
+ }]);
6333
+
6334
+ return Thread;
6335
+ }();
6336
+
6163
6337
  var _excluded = ["created_at", "updated_at", "last_active", "online"],
6164
6338
  _excluded2 = ["params", "headers"];
6165
6339
 
@@ -10271,10 +10445,197 @@ var StreamChat = /*#__PURE__*/function () {
10271
10445
 
10272
10446
  return getMessage;
10273
10447
  }()
10448
+ /**
10449
+ * queryThreads - returns the list of threads of current user.
10450
+ *
10451
+ * @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
10452
+ * @param {number} options.limit Limits the number of threads to be returned.
10453
+ * @param {boolean} options.watch Subscribes the user to the channels of the threads.
10454
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10455
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10456
+ *
10457
+ * @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
10458
+ */
10459
+
10460
+ }, {
10461
+ key: "queryThreads",
10462
+ value: function () {
10463
+ var _queryThreads = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(options) {
10464
+ var _this5 = this;
10465
+
10466
+ var opts, res;
10467
+ return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10468
+ while (1) {
10469
+ switch (_context59.prev = _context59.next) {
10470
+ case 0:
10471
+ opts = _objectSpread({
10472
+ limit: 10,
10473
+ participant_limit: 10,
10474
+ reply_limit: 3,
10475
+ watch: true
10476
+ }, options);
10477
+ _context59.next = 3;
10478
+ return this.post(this.baseURL + "/threads", opts);
10479
+
10480
+ case 3:
10481
+ res = _context59.sent;
10482
+ return _context59.abrupt("return", {
10483
+ threads: res.threads.map(function (thread) {
10484
+ return new Thread(_this5, thread);
10485
+ }),
10486
+ next: res.next
10487
+ });
10488
+
10489
+ case 5:
10490
+ case "end":
10491
+ return _context59.stop();
10492
+ }
10493
+ }
10494
+ }, _callee59, this);
10495
+ }));
10496
+
10497
+ function queryThreads(_x78) {
10498
+ return _queryThreads.apply(this, arguments);
10499
+ }
10500
+
10501
+ return queryThreads;
10502
+ }()
10503
+ /**
10504
+ * getThread - returns the thread of a message by its id.
10505
+ *
10506
+ * @param {string} messageId The message id
10507
+ * @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
10508
+ * @param {boolean} options.watch Subscribes the user to the channel of the thread.
10509
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10510
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10511
+ *
10512
+ * @returns {Thread<StreamChatGenerics>} Returns the thread.
10513
+ */
10514
+
10515
+ }, {
10516
+ key: "getThread",
10517
+ value: function () {
10518
+ var _getThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(messageId) {
10519
+ var options,
10520
+ opts,
10521
+ res,
10522
+ _args60 = arguments;
10523
+ return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10524
+ while (1) {
10525
+ switch (_context60.prev = _context60.next) {
10526
+ case 0:
10527
+ options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
10528
+
10529
+ if (messageId) {
10530
+ _context60.next = 3;
10531
+ break;
10532
+ }
10533
+
10534
+ throw Error('Please specify the message id when calling partialUpdateThread');
10535
+
10536
+ case 3:
10537
+ opts = _objectSpread({
10538
+ participant_limit: 100,
10539
+ reply_limit: 3,
10540
+ watch: true
10541
+ }, options);
10542
+ _context60.next = 6;
10543
+ return this.get(this.baseURL + "/threads/".concat(messageId), opts);
10544
+
10545
+ case 6:
10546
+ res = _context60.sent;
10547
+ return _context60.abrupt("return", new Thread(this, res.thread));
10548
+
10549
+ case 8:
10550
+ case "end":
10551
+ return _context60.stop();
10552
+ }
10553
+ }
10554
+ }, _callee60, this);
10555
+ }));
10556
+
10557
+ function getThread(_x79) {
10558
+ return _getThread.apply(this, arguments);
10559
+ }
10560
+
10561
+ return getThread;
10562
+ }()
10563
+ /**
10564
+ * partialUpdateThread - updates the given thread
10565
+ *
10566
+ * @param {string} messageId The id of the thread message which needs to be updated.
10567
+ * @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
10568
+ *
10569
+ * @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
10570
+ */
10571
+
10572
+ }, {
10573
+ key: "partialUpdateThread",
10574
+ value: function () {
10575
+ var _partialUpdateThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(messageId, partialThreadObject) {
10576
+ var reservedThreadFields, _key5;
10577
+
10578
+ return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10579
+ while (1) {
10580
+ switch (_context61.prev = _context61.next) {
10581
+ case 0:
10582
+ if (messageId) {
10583
+ _context61.next = 2;
10584
+ break;
10585
+ }
10586
+
10587
+ throw Error('Please specify the message id when calling partialUpdateThread');
10588
+
10589
+ case 2:
10590
+ // check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
10591
+ // Throw error if any of the reserved field is found.
10592
+ reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
10593
+ _context61.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
10594
+
10595
+ case 4:
10596
+ if ((_context61.t1 = _context61.t0()).done) {
10597
+ _context61.next = 10;
10598
+ break;
10599
+ }
10600
+
10601
+ _key5 = _context61.t1.value;
10602
+
10603
+ if (!reservedThreadFields.includes(_key5)) {
10604
+ _context61.next = 8;
10605
+ break;
10606
+ }
10607
+
10608
+ 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."));
10609
+
10610
+ case 8:
10611
+ _context61.next = 4;
10612
+ break;
10613
+
10614
+ case 10:
10615
+ _context61.next = 12;
10616
+ return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
10617
+
10618
+ case 12:
10619
+ return _context61.abrupt("return", _context61.sent);
10620
+
10621
+ case 13:
10622
+ case "end":
10623
+ return _context61.stop();
10624
+ }
10625
+ }
10626
+ }, _callee61, this);
10627
+ }));
10628
+
10629
+ function partialUpdateThread(_x80, _x81) {
10630
+ return _partialUpdateThread.apply(this, arguments);
10631
+ }
10632
+
10633
+ return partialUpdateThread;
10634
+ }()
10274
10635
  }, {
10275
10636
  key: "getUserAgent",
10276
10637
  value: function getUserAgent() {
10277
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.15.0");
10638
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.17.0");
10278
10639
  }
10279
10640
  }, {
10280
10641
  key: "setUserAgent",
@@ -10493,28 +10854,28 @@ var StreamChat = /*#__PURE__*/function () {
10493
10854
  }, {
10494
10855
  key: "sendUserCustomEvent",
10495
10856
  value: function () {
10496
- var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(targetUserID, event) {
10497
- return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10857
+ var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(targetUserID, event) {
10858
+ return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
10498
10859
  while (1) {
10499
- switch (_context59.prev = _context59.next) {
10860
+ switch (_context62.prev = _context62.next) {
10500
10861
  case 0:
10501
- _context59.next = 2;
10862
+ _context62.next = 2;
10502
10863
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
10503
10864
  event: event
10504
10865
  });
10505
10866
 
10506
10867
  case 2:
10507
- return _context59.abrupt("return", _context59.sent);
10868
+ return _context62.abrupt("return", _context62.sent);
10508
10869
 
10509
10870
  case 3:
10510
10871
  case "end":
10511
- return _context59.stop();
10872
+ return _context62.stop();
10512
10873
  }
10513
10874
  }
10514
- }, _callee59, this);
10875
+ }, _callee62, this);
10515
10876
  }));
10516
10877
 
10517
- function sendUserCustomEvent(_x78, _x79) {
10878
+ function sendUserCustomEvent(_x82, _x83) {
10518
10879
  return _sendUserCustomEvent.apply(this, arguments);
10519
10880
  }
10520
10881
 
@@ -10586,12 +10947,12 @@ var StreamChat = /*#__PURE__*/function () {
10586
10947
  }, {
10587
10948
  key: "createSegment",
10588
10949
  value: function () {
10589
- var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(type, id, name, data) {
10950
+ var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(type, id, name, data) {
10590
10951
  var body, _yield$this$post, segment;
10591
10952
 
10592
- return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10953
+ return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
10593
10954
  while (1) {
10594
- switch (_context60.prev = _context60.next) {
10955
+ switch (_context63.prev = _context63.next) {
10595
10956
  case 0:
10596
10957
  body = {
10597
10958
  id: id,
@@ -10599,23 +10960,23 @@ var StreamChat = /*#__PURE__*/function () {
10599
10960
  name: name,
10600
10961
  data: data
10601
10962
  };
10602
- _context60.next = 3;
10963
+ _context63.next = 3;
10603
10964
  return this.post(this.baseURL + "/segments", body);
10604
10965
 
10605
10966
  case 3:
10606
- _yield$this$post = _context60.sent;
10967
+ _yield$this$post = _context63.sent;
10607
10968
  segment = _yield$this$post.segment;
10608
- return _context60.abrupt("return", segment);
10969
+ return _context63.abrupt("return", segment);
10609
10970
 
10610
10971
  case 6:
10611
10972
  case "end":
10612
- return _context60.stop();
10973
+ return _context63.stop();
10613
10974
  }
10614
10975
  }
10615
- }, _callee60, this);
10976
+ }, _callee63, this);
10616
10977
  }));
10617
10978
 
10618
- function createSegment(_x80, _x81, _x82, _x83) {
10979
+ function createSegment(_x84, _x85, _x86, _x87) {
10619
10980
  return _createSegment.apply(this, arguments);
10620
10981
  }
10621
10982
 
@@ -10634,26 +10995,26 @@ var StreamChat = /*#__PURE__*/function () {
10634
10995
  }, {
10635
10996
  key: "createUserSegment",
10636
10997
  value: function () {
10637
- var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(id, name, data) {
10638
- return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10998
+ var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, name, data) {
10999
+ return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
10639
11000
  while (1) {
10640
- switch (_context61.prev = _context61.next) {
11001
+ switch (_context64.prev = _context64.next) {
10641
11002
  case 0:
10642
- _context61.next = 2;
11003
+ _context64.next = 2;
10643
11004
  return this.createSegment('user', id, name, data);
10644
11005
 
10645
11006
  case 2:
10646
- return _context61.abrupt("return", _context61.sent);
11007
+ return _context64.abrupt("return", _context64.sent);
10647
11008
 
10648
11009
  case 3:
10649
11010
  case "end":
10650
- return _context61.stop();
11011
+ return _context64.stop();
10651
11012
  }
10652
11013
  }
10653
- }, _callee61, this);
11014
+ }, _callee64, this);
10654
11015
  }));
10655
11016
 
10656
- function createUserSegment(_x84, _x85, _x86) {
11017
+ function createUserSegment(_x88, _x89, _x90) {
10657
11018
  return _createUserSegment.apply(this, arguments);
10658
11019
  }
10659
11020
 
@@ -10672,26 +11033,26 @@ var StreamChat = /*#__PURE__*/function () {
10672
11033
  }, {
10673
11034
  key: "createChannelSegment",
10674
11035
  value: function () {
10675
- var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(id, name, data) {
10676
- return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
11036
+ var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
11037
+ return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
10677
11038
  while (1) {
10678
- switch (_context62.prev = _context62.next) {
11039
+ switch (_context65.prev = _context65.next) {
10679
11040
  case 0:
10680
- _context62.next = 2;
11041
+ _context65.next = 2;
10681
11042
  return this.createSegment('channel', id, name, data);
10682
11043
 
10683
11044
  case 2:
10684
- return _context62.abrupt("return", _context62.sent);
11045
+ return _context65.abrupt("return", _context65.sent);
10685
11046
 
10686
11047
  case 3:
10687
11048
  case "end":
10688
- return _context62.stop();
11049
+ return _context65.stop();
10689
11050
  }
10690
11051
  }
10691
- }, _callee62, this);
11052
+ }, _callee65, this);
10692
11053
  }));
10693
11054
 
10694
- function createChannelSegment(_x87, _x88, _x89) {
11055
+ function createChannelSegment(_x91, _x92, _x93) {
10695
11056
  return _createChannelSegment.apply(this, arguments);
10696
11057
  }
10697
11058
 
@@ -10709,30 +11070,30 @@ var StreamChat = /*#__PURE__*/function () {
10709
11070
  }, {
10710
11071
  key: "updateSegment",
10711
11072
  value: function () {
10712
- var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(id, data) {
11073
+ var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
10713
11074
  var _yield$this$put, segment;
10714
11075
 
10715
- return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
11076
+ return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
10716
11077
  while (1) {
10717
- switch (_context63.prev = _context63.next) {
11078
+ switch (_context66.prev = _context66.next) {
10718
11079
  case 0:
10719
- _context63.next = 2;
11080
+ _context66.next = 2;
10720
11081
  return this.put(this.baseURL + "/segments/".concat(id), data);
10721
11082
 
10722
11083
  case 2:
10723
- _yield$this$put = _context63.sent;
11084
+ _yield$this$put = _context66.sent;
10724
11085
  segment = _yield$this$put.segment;
10725
- return _context63.abrupt("return", segment);
11086
+ return _context66.abrupt("return", segment);
10726
11087
 
10727
11088
  case 5:
10728
11089
  case "end":
10729
- return _context63.stop();
11090
+ return _context66.stop();
10730
11091
  }
10731
11092
  }
10732
- }, _callee63, this);
11093
+ }, _callee66, this);
10733
11094
  }));
10734
11095
 
10735
- function updateSegment(_x90, _x91) {
11096
+ function updateSegment(_x94, _x95) {
10736
11097
  return _updateSegment.apply(this, arguments);
10737
11098
  }
10738
11099
 
@@ -10750,30 +11111,30 @@ var StreamChat = /*#__PURE__*/function () {
10750
11111
  }, {
10751
11112
  key: "addSegmentTargets",
10752
11113
  value: function () {
10753
- var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, targets) {
11114
+ var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id, targets) {
10754
11115
  var body;
10755
- return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
11116
+ return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
10756
11117
  while (1) {
10757
- switch (_context64.prev = _context64.next) {
11118
+ switch (_context67.prev = _context67.next) {
10758
11119
  case 0:
10759
11120
  body = {
10760
11121
  targets: targets
10761
11122
  };
10762
- _context64.next = 3;
11123
+ _context67.next = 3;
10763
11124
  return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
10764
11125
 
10765
11126
  case 3:
10766
- return _context64.abrupt("return", _context64.sent);
11127
+ return _context67.abrupt("return", _context67.sent);
10767
11128
 
10768
11129
  case 4:
10769
11130
  case "end":
10770
- return _context64.stop();
11131
+ return _context67.stop();
10771
11132
  }
10772
11133
  }
10773
- }, _callee64, this);
11134
+ }, _callee67, this);
10774
11135
  }));
10775
11136
 
10776
- function addSegmentTargets(_x92, _x93) {
11137
+ function addSegmentTargets(_x96, _x97) {
10777
11138
  return _addSegmentTargets.apply(this, arguments);
10778
11139
  }
10779
11140
 
@@ -10791,30 +11152,30 @@ var StreamChat = /*#__PURE__*/function () {
10791
11152
  }, {
10792
11153
  key: "deleteSegmentTargets",
10793
11154
  value: function () {
10794
- var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, targets) {
11155
+ var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(id, targets) {
10795
11156
  var body;
10796
- return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
11157
+ return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
10797
11158
  while (1) {
10798
- switch (_context65.prev = _context65.next) {
11159
+ switch (_context68.prev = _context68.next) {
10799
11160
  case 0:
10800
11161
  body = {
10801
11162
  targets: targets
10802
11163
  };
10803
- _context65.next = 3;
11164
+ _context68.next = 3;
10804
11165
  return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
10805
11166
 
10806
11167
  case 3:
10807
- return _context65.abrupt("return", _context65.sent);
11168
+ return _context68.abrupt("return", _context68.sent);
10808
11169
 
10809
11170
  case 4:
10810
11171
  case "end":
10811
- return _context65.stop();
11172
+ return _context68.stop();
10812
11173
  }
10813
11174
  }
10814
- }, _callee65, this);
11175
+ }, _callee68, this);
10815
11176
  }));
10816
11177
 
10817
- function deleteSegmentTargets(_x94, _x95) {
11178
+ function deleteSegmentTargets(_x98, _x99) {
10818
11179
  return _deleteSegmentTargets.apply(this, arguments);
10819
11180
  }
10820
11181
 
@@ -10832,15 +11193,15 @@ var StreamChat = /*#__PURE__*/function () {
10832
11193
  }, {
10833
11194
  key: "querySegments",
10834
11195
  value: function () {
10835
- var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(filter) {
11196
+ var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(filter) {
10836
11197
  var options,
10837
- _args66 = arguments;
10838
- return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
11198
+ _args69 = arguments;
11199
+ return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
10839
11200
  while (1) {
10840
- switch (_context66.prev = _context66.next) {
11201
+ switch (_context69.prev = _context69.next) {
10841
11202
  case 0:
10842
- options = _args66.length > 1 && _args66[1] !== undefined ? _args66[1] : {};
10843
- _context66.next = 3;
11203
+ options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11204
+ _context69.next = 3;
10844
11205
  return this.get(this.baseURL + "/segments", {
10845
11206
  payload: _objectSpread({
10846
11207
  filter: filter
@@ -10848,17 +11209,17 @@ var StreamChat = /*#__PURE__*/function () {
10848
11209
  });
10849
11210
 
10850
11211
  case 3:
10851
- return _context66.abrupt("return", _context66.sent);
11212
+ return _context69.abrupt("return", _context69.sent);
10852
11213
 
10853
11214
  case 4:
10854
11215
  case "end":
10855
- return _context66.stop();
11216
+ return _context69.stop();
10856
11217
  }
10857
11218
  }
10858
- }, _callee66, this);
11219
+ }, _callee69, this);
10859
11220
  }));
10860
11221
 
10861
- function querySegments(_x96) {
11222
+ function querySegments(_x100) {
10862
11223
  return _querySegments.apply(this, arguments);
10863
11224
  }
10864
11225
 
@@ -10875,26 +11236,26 @@ var StreamChat = /*#__PURE__*/function () {
10875
11236
  }, {
10876
11237
  key: "deleteSegment",
10877
11238
  value: function () {
10878
- var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id) {
10879
- return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
11239
+ var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(id) {
11240
+ return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
10880
11241
  while (1) {
10881
- switch (_context67.prev = _context67.next) {
11242
+ switch (_context70.prev = _context70.next) {
10882
11243
  case 0:
10883
- _context67.next = 2;
11244
+ _context70.next = 2;
10884
11245
  return this.delete(this.baseURL + "/segments/".concat(id));
10885
11246
 
10886
11247
  case 2:
10887
- return _context67.abrupt("return", _context67.sent);
11248
+ return _context70.abrupt("return", _context70.sent);
10888
11249
 
10889
11250
  case 3:
10890
11251
  case "end":
10891
- return _context67.stop();
11252
+ return _context70.stop();
10892
11253
  }
10893
11254
  }
10894
- }, _callee67, this);
11255
+ }, _callee70, this);
10895
11256
  }));
10896
11257
 
10897
- function deleteSegment(_x97) {
11258
+ function deleteSegment(_x101) {
10898
11259
  return _deleteSegment.apply(this, arguments);
10899
11260
  }
10900
11261
 
@@ -10912,26 +11273,26 @@ var StreamChat = /*#__PURE__*/function () {
10912
11273
  }, {
10913
11274
  key: "segmentTargetExists",
10914
11275
  value: function () {
10915
- var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(segmentId, targetId) {
10916
- return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
11276
+ var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(segmentId, targetId) {
11277
+ return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
10917
11278
  while (1) {
10918
- switch (_context68.prev = _context68.next) {
11279
+ switch (_context71.prev = _context71.next) {
10919
11280
  case 0:
10920
- _context68.next = 2;
11281
+ _context71.next = 2;
10921
11282
  return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
10922
11283
 
10923
11284
  case 2:
10924
- return _context68.abrupt("return", _context68.sent);
11285
+ return _context71.abrupt("return", _context71.sent);
10925
11286
 
10926
11287
  case 3:
10927
11288
  case "end":
10928
- return _context68.stop();
11289
+ return _context71.stop();
10929
11290
  }
10930
11291
  }
10931
- }, _callee68, this);
11292
+ }, _callee71, this);
10932
11293
  }));
10933
11294
 
10934
- function segmentTargetExists(_x98, _x99) {
11295
+ function segmentTargetExists(_x102, _x103) {
10935
11296
  return _segmentTargetExists.apply(this, arguments);
10936
11297
  }
10937
11298
 
@@ -10948,32 +11309,32 @@ var StreamChat = /*#__PURE__*/function () {
10948
11309
  }, {
10949
11310
  key: "createCampaign",
10950
11311
  value: function () {
10951
- var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(params) {
11312
+ var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(params) {
10952
11313
  var _yield$this$post2, campaign;
10953
11314
 
10954
- return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
11315
+ return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
10955
11316
  while (1) {
10956
- switch (_context69.prev = _context69.next) {
11317
+ switch (_context72.prev = _context72.next) {
10957
11318
  case 0:
10958
- _context69.next = 2;
11319
+ _context72.next = 2;
10959
11320
  return this.post(this.baseURL + "/campaigns", {
10960
11321
  campaign: params
10961
11322
  });
10962
11323
 
10963
11324
  case 2:
10964
- _yield$this$post2 = _context69.sent;
11325
+ _yield$this$post2 = _context72.sent;
10965
11326
  campaign = _yield$this$post2.campaign;
10966
- return _context69.abrupt("return", campaign);
11327
+ return _context72.abrupt("return", campaign);
10967
11328
 
10968
11329
  case 5:
10969
11330
  case "end":
10970
- return _context69.stop();
11331
+ return _context72.stop();
10971
11332
  }
10972
11333
  }
10973
- }, _callee69, this);
11334
+ }, _callee72, this);
10974
11335
  }));
10975
11336
 
10976
- function createCampaign(_x100) {
11337
+ function createCampaign(_x104) {
10977
11338
  return _createCampaign.apply(this, arguments);
10978
11339
  }
10979
11340
 
@@ -10989,15 +11350,15 @@ var StreamChat = /*#__PURE__*/function () {
10989
11350
  }, {
10990
11351
  key: "queryCampaigns",
10991
11352
  value: function () {
10992
- var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(filters) {
11353
+ var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(filters) {
10993
11354
  var options,
10994
- _args70 = arguments;
10995
- return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
11355
+ _args73 = arguments;
11356
+ return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
10996
11357
  while (1) {
10997
- switch (_context70.prev = _context70.next) {
11358
+ switch (_context73.prev = _context73.next) {
10998
11359
  case 0:
10999
- options = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {};
11000
- _context70.next = 3;
11360
+ options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11361
+ _context73.next = 3;
11001
11362
  return this.get(this.baseURL + "/campaigns", {
11002
11363
  payload: _objectSpread({
11003
11364
  filter_conditions: filters
@@ -11005,17 +11366,17 @@ var StreamChat = /*#__PURE__*/function () {
11005
11366
  });
11006
11367
 
11007
11368
  case 3:
11008
- return _context70.abrupt("return", _context70.sent);
11369
+ return _context73.abrupt("return", _context73.sent);
11009
11370
 
11010
11371
  case 4:
11011
11372
  case "end":
11012
- return _context70.stop();
11373
+ return _context73.stop();
11013
11374
  }
11014
11375
  }
11015
- }, _callee70, this);
11376
+ }, _callee73, this);
11016
11377
  }));
11017
11378
 
11018
- function queryCampaigns(_x101) {
11379
+ function queryCampaigns(_x105) {
11019
11380
  return _queryCampaigns.apply(this, arguments);
11020
11381
  }
11021
11382
 
@@ -11033,32 +11394,32 @@ var StreamChat = /*#__PURE__*/function () {
11033
11394
  }, {
11034
11395
  key: "updateCampaign",
11035
11396
  value: function () {
11036
- var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(id, params) {
11397
+ var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id, params) {
11037
11398
  var _yield$this$put2, campaign;
11038
11399
 
11039
- return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
11400
+ return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11040
11401
  while (1) {
11041
- switch (_context71.prev = _context71.next) {
11402
+ switch (_context74.prev = _context74.next) {
11042
11403
  case 0:
11043
- _context71.next = 2;
11404
+ _context74.next = 2;
11044
11405
  return this.put(this.baseURL + "/campaigns/".concat(id), {
11045
11406
  campaign: params
11046
11407
  });
11047
11408
 
11048
11409
  case 2:
11049
- _yield$this$put2 = _context71.sent;
11410
+ _yield$this$put2 = _context74.sent;
11050
11411
  campaign = _yield$this$put2.campaign;
11051
- return _context71.abrupt("return", campaign);
11412
+ return _context74.abrupt("return", campaign);
11052
11413
 
11053
11414
  case 5:
11054
11415
  case "end":
11055
- return _context71.stop();
11416
+ return _context74.stop();
11056
11417
  }
11057
11418
  }
11058
- }, _callee71, this);
11419
+ }, _callee74, this);
11059
11420
  }));
11060
11421
 
11061
- function updateCampaign(_x102, _x103) {
11422
+ function updateCampaign(_x106, _x107) {
11062
11423
  return _updateCampaign.apply(this, arguments);
11063
11424
  }
11064
11425
 
@@ -11075,25 +11436,25 @@ var StreamChat = /*#__PURE__*/function () {
11075
11436
  }, {
11076
11437
  key: "deleteCampaign",
11077
11438
  value: function () {
11078
- var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(id) {
11439
+ var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11079
11440
  var params,
11080
- _args72 = arguments;
11081
- return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
11441
+ _args75 = arguments;
11442
+ return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11082
11443
  while (1) {
11083
- switch (_context72.prev = _context72.next) {
11444
+ switch (_context75.prev = _context75.next) {
11084
11445
  case 0:
11085
- params = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {};
11086
- return _context72.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11446
+ params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11447
+ return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11087
11448
 
11088
11449
  case 2:
11089
11450
  case "end":
11090
- return _context72.stop();
11451
+ return _context75.stop();
11091
11452
  }
11092
11453
  }
11093
- }, _callee72, this);
11454
+ }, _callee75, this);
11094
11455
  }));
11095
11456
 
11096
- function deleteCampaign(_x104) {
11457
+ function deleteCampaign(_x108) {
11097
11458
  return _deleteCampaign.apply(this, arguments);
11098
11459
  }
11099
11460
 
@@ -11111,33 +11472,33 @@ var StreamChat = /*#__PURE__*/function () {
11111
11472
  }, {
11112
11473
  key: "scheduleCampaign",
11113
11474
  value: function () {
11114
- var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(id, params) {
11475
+ var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11115
11476
  var scheduledFor, _yield$this$patch, campaign;
11116
11477
 
11117
- return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
11478
+ return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11118
11479
  while (1) {
11119
- switch (_context73.prev = _context73.next) {
11480
+ switch (_context76.prev = _context76.next) {
11120
11481
  case 0:
11121
11482
  scheduledFor = params.scheduledFor;
11122
- _context73.next = 3;
11483
+ _context76.next = 3;
11123
11484
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
11124
11485
  scheduled_for: scheduledFor
11125
11486
  });
11126
11487
 
11127
11488
  case 3:
11128
- _yield$this$patch = _context73.sent;
11489
+ _yield$this$patch = _context76.sent;
11129
11490
  campaign = _yield$this$patch.campaign;
11130
- return _context73.abrupt("return", campaign);
11491
+ return _context76.abrupt("return", campaign);
11131
11492
 
11132
11493
  case 6:
11133
11494
  case "end":
11134
- return _context73.stop();
11495
+ return _context76.stop();
11135
11496
  }
11136
11497
  }
11137
- }, _callee73, this);
11498
+ }, _callee76, this);
11138
11499
  }));
11139
11500
 
11140
- function scheduleCampaign(_x105, _x106) {
11501
+ function scheduleCampaign(_x109, _x110) {
11141
11502
  return _scheduleCampaign.apply(this, arguments);
11142
11503
  }
11143
11504
 
@@ -11154,30 +11515,30 @@ var StreamChat = /*#__PURE__*/function () {
11154
11515
  }, {
11155
11516
  key: "stopCampaign",
11156
11517
  value: function () {
11157
- var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id) {
11518
+ var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(id) {
11158
11519
  var _yield$this$patch2, campaign;
11159
11520
 
11160
- return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11521
+ return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11161
11522
  while (1) {
11162
- switch (_context74.prev = _context74.next) {
11523
+ switch (_context77.prev = _context77.next) {
11163
11524
  case 0:
11164
- _context74.next = 2;
11525
+ _context77.next = 2;
11165
11526
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
11166
11527
 
11167
11528
  case 2:
11168
- _yield$this$patch2 = _context74.sent;
11529
+ _yield$this$patch2 = _context77.sent;
11169
11530
  campaign = _yield$this$patch2.campaign;
11170
- return _context74.abrupt("return", campaign);
11531
+ return _context77.abrupt("return", campaign);
11171
11532
 
11172
11533
  case 5:
11173
11534
  case "end":
11174
- return _context74.stop();
11535
+ return _context77.stop();
11175
11536
  }
11176
11537
  }
11177
- }, _callee74, this);
11538
+ }, _callee77, this);
11178
11539
  }));
11179
11540
 
11180
- function stopCampaign(_x107) {
11541
+ function stopCampaign(_x111) {
11181
11542
  return _stopCampaign.apply(this, arguments);
11182
11543
  }
11183
11544
 
@@ -11194,30 +11555,30 @@ var StreamChat = /*#__PURE__*/function () {
11194
11555
  }, {
11195
11556
  key: "resumeCampaign",
11196
11557
  value: function () {
11197
- var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11558
+ var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11198
11559
  var _yield$this$patch3, campaign;
11199
11560
 
11200
- return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11561
+ return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11201
11562
  while (1) {
11202
- switch (_context75.prev = _context75.next) {
11563
+ switch (_context78.prev = _context78.next) {
11203
11564
  case 0:
11204
- _context75.next = 2;
11565
+ _context78.next = 2;
11205
11566
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
11206
11567
 
11207
11568
  case 2:
11208
- _yield$this$patch3 = _context75.sent;
11569
+ _yield$this$patch3 = _context78.sent;
11209
11570
  campaign = _yield$this$patch3.campaign;
11210
- return _context75.abrupt("return", campaign);
11571
+ return _context78.abrupt("return", campaign);
11211
11572
 
11212
11573
  case 5:
11213
11574
  case "end":
11214
- return _context75.stop();
11575
+ return _context78.stop();
11215
11576
  }
11216
11577
  }
11217
- }, _callee75, this);
11578
+ }, _callee78, this);
11218
11579
  }));
11219
11580
 
11220
- function resumeCampaign(_x108) {
11581
+ function resumeCampaign(_x112) {
11221
11582
  return _resumeCampaign.apply(this, arguments);
11222
11583
  }
11223
11584
 
@@ -11235,30 +11596,30 @@ var StreamChat = /*#__PURE__*/function () {
11235
11596
  }, {
11236
11597
  key: "testCampaign",
11237
11598
  value: function () {
11238
- var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11599
+ var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(id, params) {
11239
11600
  var users;
11240
- return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11601
+ return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11241
11602
  while (1) {
11242
- switch (_context76.prev = _context76.next) {
11603
+ switch (_context79.prev = _context79.next) {
11243
11604
  case 0:
11244
11605
  users = params.users;
11245
- _context76.next = 3;
11606
+ _context79.next = 3;
11246
11607
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
11247
11608
  users: users
11248
11609
  });
11249
11610
 
11250
11611
  case 3:
11251
- return _context76.abrupt("return", _context76.sent);
11612
+ return _context79.abrupt("return", _context79.sent);
11252
11613
 
11253
11614
  case 4:
11254
11615
  case "end":
11255
- return _context76.stop();
11616
+ return _context79.stop();
11256
11617
  }
11257
11618
  }
11258
- }, _callee76, this);
11619
+ }, _callee79, this);
11259
11620
  }));
11260
11621
 
11261
- function testCampaign(_x109, _x110) {
11622
+ function testCampaign(_x113, _x114) {
11262
11623
  return _testCampaign.apply(this, arguments);
11263
11624
  }
11264
11625
 
@@ -11274,24 +11635,24 @@ var StreamChat = /*#__PURE__*/function () {
11274
11635
  }, {
11275
11636
  key: "enrichURL",
11276
11637
  value: function () {
11277
- var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(url) {
11278
- return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11638
+ var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(url) {
11639
+ return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11279
11640
  while (1) {
11280
- switch (_context77.prev = _context77.next) {
11641
+ switch (_context80.prev = _context80.next) {
11281
11642
  case 0:
11282
- return _context77.abrupt("return", this.get(this.baseURL + "/og", {
11643
+ return _context80.abrupt("return", this.get(this.baseURL + "/og", {
11283
11644
  url: url
11284
11645
  }));
11285
11646
 
11286
11647
  case 1:
11287
11648
  case "end":
11288
- return _context77.stop();
11649
+ return _context80.stop();
11289
11650
  }
11290
11651
  }
11291
- }, _callee77, this);
11652
+ }, _callee80, this);
11292
11653
  }));
11293
11654
 
11294
- function enrichURL(_x111) {
11655
+ function enrichURL(_x115) {
11295
11656
  return _enrichURL.apply(this, arguments);
11296
11657
  }
11297
11658
 
@@ -11308,22 +11669,22 @@ var StreamChat = /*#__PURE__*/function () {
11308
11669
  }, {
11309
11670
  key: "getTask",
11310
11671
  value: function () {
11311
- var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11312
- return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11672
+ var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
11673
+ return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11313
11674
  while (1) {
11314
- switch (_context78.prev = _context78.next) {
11675
+ switch (_context81.prev = _context81.next) {
11315
11676
  case 0:
11316
- return _context78.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11677
+ return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11317
11678
 
11318
11679
  case 1:
11319
11680
  case "end":
11320
- return _context78.stop();
11681
+ return _context81.stop();
11321
11682
  }
11322
11683
  }
11323
- }, _callee78, this);
11684
+ }, _callee81, this);
11324
11685
  }));
11325
11686
 
11326
- function getTask(_x112) {
11687
+ function getTask(_x116) {
11327
11688
  return _getTask.apply(this, arguments);
11328
11689
  }
11329
11690
 
@@ -11341,31 +11702,31 @@ var StreamChat = /*#__PURE__*/function () {
11341
11702
  }, {
11342
11703
  key: "deleteChannels",
11343
11704
  value: function () {
11344
- var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(cids) {
11705
+ var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(cids) {
11345
11706
  var options,
11346
- _args79 = arguments;
11347
- return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11707
+ _args82 = arguments;
11708
+ return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11348
11709
  while (1) {
11349
- switch (_context79.prev = _context79.next) {
11710
+ switch (_context82.prev = _context82.next) {
11350
11711
  case 0:
11351
- options = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {};
11352
- _context79.next = 3;
11712
+ options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11713
+ _context82.next = 3;
11353
11714
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11354
11715
  cids: cids
11355
11716
  }, options));
11356
11717
 
11357
11718
  case 3:
11358
- return _context79.abrupt("return", _context79.sent);
11719
+ return _context82.abrupt("return", _context82.sent);
11359
11720
 
11360
11721
  case 4:
11361
11722
  case "end":
11362
- return _context79.stop();
11723
+ return _context82.stop();
11363
11724
  }
11364
11725
  }
11365
- }, _callee79, this);
11726
+ }, _callee82, this);
11366
11727
  }));
11367
11728
 
11368
- function deleteChannels(_x113) {
11729
+ function deleteChannels(_x117) {
11369
11730
  return _deleteChannels.apply(this, arguments);
11370
11731
  }
11371
11732
 
@@ -11383,17 +11744,17 @@ var StreamChat = /*#__PURE__*/function () {
11383
11744
  }, {
11384
11745
  key: "deleteUsers",
11385
11746
  value: function () {
11386
- var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(user_ids) {
11747
+ var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(user_ids) {
11387
11748
  var options,
11388
- _args80 = arguments;
11389
- return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11749
+ _args83 = arguments;
11750
+ return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11390
11751
  while (1) {
11391
- switch (_context80.prev = _context80.next) {
11752
+ switch (_context83.prev = _context83.next) {
11392
11753
  case 0:
11393
- options = _args80.length > 1 && _args80[1] !== undefined ? _args80[1] : {};
11754
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
11394
11755
 
11395
11756
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11396
- _context80.next = 3;
11757
+ _context83.next = 3;
11397
11758
  break;
11398
11759
  }
11399
11760
 
@@ -11401,7 +11762,7 @@ var StreamChat = /*#__PURE__*/function () {
11401
11762
 
11402
11763
  case 3:
11403
11764
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11404
- _context80.next = 5;
11765
+ _context83.next = 5;
11405
11766
  break;
11406
11767
  }
11407
11768
 
@@ -11409,30 +11770,30 @@ var StreamChat = /*#__PURE__*/function () {
11409
11770
 
11410
11771
  case 5:
11411
11772
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11412
- _context80.next = 7;
11773
+ _context83.next = 7;
11413
11774
  break;
11414
11775
  }
11415
11776
 
11416
11777
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11417
11778
 
11418
11779
  case 7:
11419
- _context80.next = 9;
11780
+ _context83.next = 9;
11420
11781
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11421
11782
  user_ids: user_ids
11422
11783
  }, options));
11423
11784
 
11424
11785
  case 9:
11425
- return _context80.abrupt("return", _context80.sent);
11786
+ return _context83.abrupt("return", _context83.sent);
11426
11787
 
11427
11788
  case 10:
11428
11789
  case "end":
11429
- return _context80.stop();
11790
+ return _context83.stop();
11430
11791
  }
11431
11792
  }
11432
- }, _callee80, this);
11793
+ }, _callee83, this);
11433
11794
  }));
11434
11795
 
11435
- function deleteUsers(_x114) {
11796
+ function deleteUsers(_x118) {
11436
11797
  return _deleteUsers.apply(this, arguments);
11437
11798
  }
11438
11799
 
@@ -11453,28 +11814,28 @@ var StreamChat = /*#__PURE__*/function () {
11453
11814
  }, {
11454
11815
  key: "_createImportURL",
11455
11816
  value: function () {
11456
- var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(filename) {
11457
- return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11817
+ var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(filename) {
11818
+ return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11458
11819
  while (1) {
11459
- switch (_context81.prev = _context81.next) {
11820
+ switch (_context84.prev = _context84.next) {
11460
11821
  case 0:
11461
- _context81.next = 2;
11822
+ _context84.next = 2;
11462
11823
  return this.post(this.baseURL + "/import_urls", {
11463
11824
  filename: filename
11464
11825
  });
11465
11826
 
11466
11827
  case 2:
11467
- return _context81.abrupt("return", _context81.sent);
11828
+ return _context84.abrupt("return", _context84.sent);
11468
11829
 
11469
11830
  case 3:
11470
11831
  case "end":
11471
- return _context81.stop();
11832
+ return _context84.stop();
11472
11833
  }
11473
11834
  }
11474
- }, _callee81, this);
11835
+ }, _callee84, this);
11475
11836
  }));
11476
11837
 
11477
- function _createImportURL(_x115) {
11838
+ function _createImportURL(_x119) {
11478
11839
  return _createImportURL2.apply(this, arguments);
11479
11840
  }
11480
11841
 
@@ -11496,33 +11857,33 @@ var StreamChat = /*#__PURE__*/function () {
11496
11857
  }, {
11497
11858
  key: "_createImport",
11498
11859
  value: function () {
11499
- var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(path) {
11860
+ var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(path) {
11500
11861
  var options,
11501
- _args82 = arguments;
11502
- return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11862
+ _args85 = arguments;
11863
+ return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11503
11864
  while (1) {
11504
- switch (_context82.prev = _context82.next) {
11865
+ switch (_context85.prev = _context85.next) {
11505
11866
  case 0:
11506
- options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {
11867
+ options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
11507
11868
  mode: 'upsert'
11508
11869
  };
11509
- _context82.next = 3;
11870
+ _context85.next = 3;
11510
11871
  return this.post(this.baseURL + "/imports", _objectSpread({
11511
11872
  path: path
11512
11873
  }, options));
11513
11874
 
11514
11875
  case 3:
11515
- return _context82.abrupt("return", _context82.sent);
11876
+ return _context85.abrupt("return", _context85.sent);
11516
11877
 
11517
11878
  case 4:
11518
11879
  case "end":
11519
- return _context82.stop();
11880
+ return _context85.stop();
11520
11881
  }
11521
11882
  }
11522
- }, _callee82, this);
11883
+ }, _callee85, this);
11523
11884
  }));
11524
11885
 
11525
- function _createImport(_x116) {
11886
+ function _createImport(_x120) {
11526
11887
  return _createImport2.apply(this, arguments);
11527
11888
  }
11528
11889
 
@@ -11544,26 +11905,26 @@ var StreamChat = /*#__PURE__*/function () {
11544
11905
  }, {
11545
11906
  key: "_getImport",
11546
11907
  value: function () {
11547
- var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(id) {
11548
- return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11908
+ var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(id) {
11909
+ return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
11549
11910
  while (1) {
11550
- switch (_context83.prev = _context83.next) {
11911
+ switch (_context86.prev = _context86.next) {
11551
11912
  case 0:
11552
- _context83.next = 2;
11913
+ _context86.next = 2;
11553
11914
  return this.get(this.baseURL + "/imports/".concat(id));
11554
11915
 
11555
11916
  case 2:
11556
- return _context83.abrupt("return", _context83.sent);
11917
+ return _context86.abrupt("return", _context86.sent);
11557
11918
 
11558
11919
  case 3:
11559
11920
  case "end":
11560
- return _context83.stop();
11921
+ return _context86.stop();
11561
11922
  }
11562
11923
  }
11563
- }, _callee83, this);
11924
+ }, _callee86, this);
11564
11925
  }));
11565
11926
 
11566
- function _getImport(_x117) {
11927
+ function _getImport(_x121) {
11567
11928
  return _getImport2.apply(this, arguments);
11568
11929
  }
11569
11930
 
@@ -11585,26 +11946,26 @@ var StreamChat = /*#__PURE__*/function () {
11585
11946
  }, {
11586
11947
  key: "_listImports",
11587
11948
  value: function () {
11588
- var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(options) {
11589
- return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11949
+ var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87(options) {
11950
+ return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
11590
11951
  while (1) {
11591
- switch (_context84.prev = _context84.next) {
11952
+ switch (_context87.prev = _context87.next) {
11592
11953
  case 0:
11593
- _context84.next = 2;
11954
+ _context87.next = 2;
11594
11955
  return this.get(this.baseURL + "/imports", options);
11595
11956
 
11596
11957
  case 2:
11597
- return _context84.abrupt("return", _context84.sent);
11958
+ return _context87.abrupt("return", _context87.sent);
11598
11959
 
11599
11960
  case 3:
11600
11961
  case "end":
11601
- return _context84.stop();
11962
+ return _context87.stop();
11602
11963
  }
11603
11964
  }
11604
- }, _callee84, this);
11965
+ }, _callee87, this);
11605
11966
  }));
11606
11967
 
11607
- function _listImports(_x118) {
11968
+ function _listImports(_x122) {
11608
11969
  return _listImports2.apply(this, arguments);
11609
11970
  }
11610
11971
 
@@ -11623,28 +11984,28 @@ var StreamChat = /*#__PURE__*/function () {
11623
11984
  }, {
11624
11985
  key: "upsertPushProvider",
11625
11986
  value: function () {
11626
- var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(pushProvider) {
11627
- return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11987
+ var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(pushProvider) {
11988
+ return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
11628
11989
  while (1) {
11629
- switch (_context85.prev = _context85.next) {
11990
+ switch (_context88.prev = _context88.next) {
11630
11991
  case 0:
11631
- _context85.next = 2;
11992
+ _context88.next = 2;
11632
11993
  return this.post(this.baseURL + "/push_providers", {
11633
11994
  push_provider: pushProvider
11634
11995
  });
11635
11996
 
11636
11997
  case 2:
11637
- return _context85.abrupt("return", _context85.sent);
11998
+ return _context88.abrupt("return", _context88.sent);
11638
11999
 
11639
12000
  case 3:
11640
12001
  case "end":
11641
- return _context85.stop();
12002
+ return _context88.stop();
11642
12003
  }
11643
12004
  }
11644
- }, _callee85, this);
12005
+ }, _callee88, this);
11645
12006
  }));
11646
12007
 
11647
- function upsertPushProvider(_x119) {
12008
+ function upsertPushProvider(_x123) {
11648
12009
  return _upsertPushProvider.apply(this, arguments);
11649
12010
  }
11650
12011
 
@@ -11663,28 +12024,28 @@ var StreamChat = /*#__PURE__*/function () {
11663
12024
  }, {
11664
12025
  key: "deletePushProvider",
11665
12026
  value: function () {
11666
- var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(_ref10) {
12027
+ var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee89(_ref10) {
11667
12028
  var type, name;
11668
- return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
12029
+ return _regeneratorRuntime__default['default'].wrap(function _callee89$(_context89) {
11669
12030
  while (1) {
11670
- switch (_context86.prev = _context86.next) {
12031
+ switch (_context89.prev = _context89.next) {
11671
12032
  case 0:
11672
12033
  type = _ref10.type, name = _ref10.name;
11673
- _context86.next = 3;
12034
+ _context89.next = 3;
11674
12035
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11675
12036
 
11676
12037
  case 3:
11677
- return _context86.abrupt("return", _context86.sent);
12038
+ return _context89.abrupt("return", _context89.sent);
11678
12039
 
11679
12040
  case 4:
11680
12041
  case "end":
11681
- return _context86.stop();
12042
+ return _context89.stop();
11682
12043
  }
11683
12044
  }
11684
- }, _callee86, this);
12045
+ }, _callee89, this);
11685
12046
  }));
11686
12047
 
11687
- function deletePushProvider(_x120) {
12048
+ function deletePushProvider(_x124) {
11688
12049
  return _deletePushProvider.apply(this, arguments);
11689
12050
  }
11690
12051
 
@@ -11701,23 +12062,23 @@ var StreamChat = /*#__PURE__*/function () {
11701
12062
  }, {
11702
12063
  key: "listPushProviders",
11703
12064
  value: function () {
11704
- var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87() {
11705
- return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
12065
+ var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee90() {
12066
+ return _regeneratorRuntime__default['default'].wrap(function _callee90$(_context90) {
11706
12067
  while (1) {
11707
- switch (_context87.prev = _context87.next) {
12068
+ switch (_context90.prev = _context90.next) {
11708
12069
  case 0:
11709
- _context87.next = 2;
12070
+ _context90.next = 2;
11710
12071
  return this.get(this.baseURL + "/push_providers");
11711
12072
 
11712
12073
  case 2:
11713
- return _context87.abrupt("return", _context87.sent);
12074
+ return _context90.abrupt("return", _context90.sent);
11714
12075
 
11715
12076
  case 3:
11716
12077
  case "end":
11717
- return _context87.stop();
12078
+ return _context90.stop();
11718
12079
  }
11719
12080
  }
11720
- }, _callee87, this);
12081
+ }, _callee90, this);
11721
12082
  }));
11722
12083
 
11723
12084
  function listPushProviders() {
@@ -11745,26 +12106,26 @@ var StreamChat = /*#__PURE__*/function () {
11745
12106
  }, {
11746
12107
  key: "commitMessage",
11747
12108
  value: function () {
11748
- var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(id) {
11749
- return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
12109
+ var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee91(id) {
12110
+ return _regeneratorRuntime__default['default'].wrap(function _callee91$(_context91) {
11750
12111
  while (1) {
11751
- switch (_context88.prev = _context88.next) {
12112
+ switch (_context91.prev = _context91.next) {
11752
12113
  case 0:
11753
- _context88.next = 2;
12114
+ _context91.next = 2;
11754
12115
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
11755
12116
 
11756
12117
  case 2:
11757
- return _context88.abrupt("return", _context88.sent);
12118
+ return _context91.abrupt("return", _context91.sent);
11758
12119
 
11759
12120
  case 3:
11760
12121
  case "end":
11761
- return _context88.stop();
12122
+ return _context91.stop();
11762
12123
  }
11763
12124
  }
11764
- }, _callee88, this);
12125
+ }, _callee91, this);
11765
12126
  }));
11766
12127
 
11767
- function commitMessage(_x121) {
12128
+ function commitMessage(_x125) {
11768
12129
  return _commitMessage.apply(this, arguments);
11769
12130
  }
11770
12131
 
@@ -11820,6 +12181,7 @@ var EVENT_MAP = {
11820
12181
  'notification.message_new': true,
11821
12182
  'notification.mutes_updated': true,
11822
12183
  'notification.removed_from_channel': true,
12184
+ 'notification.thread_message_new': true,
11823
12185
  'reaction.deleted': true,
11824
12186
  'reaction.new': true,
11825
12187
  'reaction.updated': true,
@@ -11938,6 +12300,7 @@ exports.MinPriority = MinPriority;
11938
12300
  exports.Permission = Permission;
11939
12301
  exports.StableWSConnection = StableWSConnection;
11940
12302
  exports.StreamChat = StreamChat;
12303
+ exports.Thread = Thread;
11941
12304
  exports.TokenManager = TokenManager;
11942
12305
  exports.UserFromToken = UserFromToken;
11943
12306
  exports.buildWsFatalInsight = buildWsFatalInsight;
@@ -11945,6 +12308,7 @@ exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
11945
12308
  exports.chatCodes = chatCodes;
11946
12309
  exports.decodeBase64 = decodeBase64;
11947
12310
  exports.encodeBase64 = encodeBase64;
12311
+ exports.formatMessage = formatMessage;
11948
12312
  exports.isOwnUser = isOwnUser;
11949
12313
  exports.logChatPromiseExecution = logChatPromiseExecution;
11950
12314
  exports.postInsights = postInsights;