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/browser.js CHANGED
@@ -118,9 +118,347 @@ var decodeBase64 = function decodeBase64(s) {
118
118
 
119
119
  var https = null;
120
120
 
121
- 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; }
121
+ 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; }
122
122
 
123
- 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; }
123
+ 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; }
124
+
125
+ 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; } } }; }
126
+
127
+ 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); }
128
+
129
+ 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; }
130
+
131
+ /**
132
+ * logChatPromiseExecution - utility function for logging the execution of a promise..
133
+ * use this when you want to run the promise and handle errors by logging a warning
134
+ *
135
+ * @param {Promise<T>} promise The promise you want to run and log
136
+ * @param {string} name A descriptive name of what the promise does for log output
137
+ *
138
+ */
139
+ function logChatPromiseExecution(promise, name) {
140
+ promise.then().catch(function (error) {
141
+ console.warn("failed to do ".concat(name, ", ran into error: "), error);
142
+ });
143
+ }
144
+ var sleep = function sleep(m) {
145
+ return new Promise(function (r) {
146
+ return setTimeout(r, m);
147
+ });
148
+ };
149
+ function isFunction(value) {
150
+ return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
151
+ }
152
+ var chatCodes = {
153
+ TOKEN_EXPIRED: 40,
154
+ WS_CLOSED_SUCCESS: 1000
155
+ };
156
+
157
+ function isReadableStream(obj) {
158
+ return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
159
+ }
160
+
161
+ function isBuffer(obj) {
162
+ return obj != null && obj.constructor != null && // @ts-expect-error
163
+ typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
164
+ obj.constructor.isBuffer(obj);
165
+ }
166
+
167
+ function isFileWebAPI(uri) {
168
+ return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
169
+ }
170
+
171
+ function isOwnUser(user) {
172
+ return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
173
+ }
174
+
175
+ function isBlobWebAPI(uri) {
176
+ return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
177
+ }
178
+
179
+ function isOwnUserBaseProperty(property) {
180
+ var ownUserBaseProperties = {
181
+ channel_mutes: true,
182
+ devices: true,
183
+ mutes: true,
184
+ total_unread_count: true,
185
+ unread_channels: true,
186
+ unread_count: true,
187
+ invisible: true,
188
+ roles: true
189
+ };
190
+ return ownUserBaseProperties[property];
191
+ }
192
+ function addFileToFormData(uri, name, contentType) {
193
+ var data = new FormData__default['default']();
194
+
195
+ if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
196
+ if (name) data.append('file', uri, name);else data.append('file', uri);
197
+ } else {
198
+ data.append('file', {
199
+ uri: uri,
200
+ name: name || uri.split('/').reverse()[0],
201
+ contentType: contentType || undefined,
202
+ type: contentType || undefined
203
+ });
204
+ }
205
+
206
+ return data;
207
+ }
208
+ function normalizeQuerySort(sort) {
209
+ var sortFields = [];
210
+ var sortArr = Array.isArray(sort) ? sort : [sort];
211
+
212
+ var _iterator = _createForOfIteratorHelper$4(sortArr),
213
+ _step;
214
+
215
+ try {
216
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
217
+ var item = _step.value;
218
+ var entries = Object.entries(item);
219
+
220
+ if (entries.length > 1) {
221
+ console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
222
+ }
223
+
224
+ for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
225
+ var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
226
+ field = _entries$_i[0],
227
+ direction = _entries$_i[1];
228
+
229
+ sortFields.push({
230
+ field: field,
231
+ direction: direction
232
+ });
233
+ }
234
+ }
235
+ } catch (err) {
236
+ _iterator.e(err);
237
+ } finally {
238
+ _iterator.f();
239
+ }
240
+
241
+ return sortFields;
242
+ }
243
+ /**
244
+ * retryInterval - A retry interval which increases acc to number of failures
245
+ *
246
+ * @return {number} Duration to wait in milliseconds
247
+ */
248
+
249
+ function retryInterval(numberOfFailures) {
250
+ // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
251
+ var max = Math.min(500 + numberOfFailures * 2000, 25000);
252
+ var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
253
+ return Math.floor(Math.random() * (max - min) + min);
254
+ }
255
+ function randomId() {
256
+ return generateUUIDv4();
257
+ }
258
+
259
+ function hex(bytes) {
260
+ var s = '';
261
+
262
+ for (var i = 0; i < bytes.length; i++) {
263
+ s += bytes[i].toString(16).padStart(2, '0');
264
+ }
265
+
266
+ return s;
267
+ } // https://tools.ietf.org/html/rfc4122
268
+
269
+
270
+ function generateUUIDv4() {
271
+ var bytes = getRandomBytes(16);
272
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
273
+
274
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
275
+
276
+ 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));
277
+ }
278
+
279
+ function getRandomValuesWithMathRandom(bytes) {
280
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
281
+
282
+ for (var i = 0; i < bytes.length; i++) {
283
+ bytes[i] = Math.random() * max;
284
+ }
285
+ }
286
+
287
+ var getRandomValues = function () {
288
+ var _crypto;
289
+
290
+ if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
291
+ return crypto.getRandomValues.bind(crypto);
292
+ } else if (typeof msCrypto !== 'undefined') {
293
+ return msCrypto.getRandomValues.bind(msCrypto);
294
+ } else {
295
+ return getRandomValuesWithMathRandom;
296
+ }
297
+ }();
298
+
299
+ function getRandomBytes(length) {
300
+ var bytes = new Uint8Array(length);
301
+ getRandomValues(bytes);
302
+ return bytes;
303
+ }
304
+
305
+ function convertErrorToJson(err) {
306
+ var jsonObj = {};
307
+ if (!err) return jsonObj;
308
+
309
+ try {
310
+ Object.getOwnPropertyNames(err).forEach(function (key) {
311
+ jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
312
+ });
313
+ } catch (_) {
314
+ return {
315
+ error: 'failed to serialize the error'
316
+ };
317
+ }
318
+
319
+ return jsonObj;
320
+ }
321
+ /**
322
+ * isOnline safely return the navigator.online value for browser env
323
+ * if navigator is not in global object, it always return true
324
+ */
325
+
326
+ function isOnline() {
327
+ var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
328
+
329
+ if (!nav) {
330
+ console.warn('isOnline failed to access window.navigator and assume browser is online');
331
+ return true;
332
+ } // RN navigator has undefined for onLine
333
+
334
+
335
+ if (typeof nav.onLine !== 'boolean') {
336
+ return true;
337
+ }
338
+
339
+ return nav.onLine;
340
+ }
341
+ /**
342
+ * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
343
+ */
344
+
345
+ function addConnectionEventListeners(cb) {
346
+ if (typeof window !== 'undefined' && window.addEventListener) {
347
+ window.addEventListener('offline', cb);
348
+ window.addEventListener('online', cb);
349
+ }
350
+ }
351
+ function removeConnectionEventListeners(cb) {
352
+ if (typeof window !== 'undefined' && window.removeEventListener) {
353
+ window.removeEventListener('offline', cb);
354
+ window.removeEventListener('online', cb);
355
+ }
356
+ }
357
+ var axiosParamsSerializer = function axiosParamsSerializer(params) {
358
+ var newParams = [];
359
+
360
+ for (var k in params) {
361
+ // Stream backend doesn't treat "undefined" value same as value not being present.
362
+ // So, we need to skip the undefined values.
363
+ if (params[k] === undefined) continue;
364
+
365
+ if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
366
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
367
+ } else {
368
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
369
+ }
370
+ }
371
+
372
+ return newParams.join('&');
373
+ };
374
+ /**
375
+ * formatMessage - Takes the message object. Parses the dates, sets __html
376
+ * and sets the status to received if missing. Returns a message object
377
+ *
378
+ * @param {MessageResponse<StreamChatGenerics>} message a message object
379
+ *
380
+ */
381
+
382
+ function formatMessage(message) {
383
+ return _objectSpread$8(_objectSpread$8({}, message), {}, {
384
+ /**
385
+ * @deprecated please use `html`
386
+ */
387
+ __html: message.html,
388
+ // parse the date..
389
+ pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
390
+ created_at: message.created_at ? new Date(message.created_at) : new Date(),
391
+ updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
392
+ status: message.status || 'received'
393
+ });
394
+ }
395
+ function addToMessageList(messages, message) {
396
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
397
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
398
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
399
+ var addMessageToList = addIfDoesNotExist || timestampChanged;
400
+ var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
401
+ // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
402
+
403
+ if (timestampChanged) {
404
+ messageArr = messageArr.filter(function (msg) {
405
+ return !(msg.id && message.id === msg.id);
406
+ });
407
+ } // Get array length after filtering
408
+
409
+
410
+ var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
411
+
412
+ if (messageArrayLength === 0 && addMessageToList) {
413
+ return messageArr.concat(message);
414
+ } else if (messageArrayLength === 0) {
415
+ return _toConsumableArray__default['default'](messageArr);
416
+ }
417
+
418
+ var messageTime = message[sortBy].getTime();
419
+ 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
420
+
421
+ if (messageIsNewest && addMessageToList) {
422
+ return messageArr.concat(message);
423
+ } else if (messageIsNewest) {
424
+ return _toConsumableArray__default['default'](messageArr);
425
+ } // find the closest index to push the new message
426
+
427
+
428
+ var left = 0;
429
+ var middle = 0;
430
+ var right = messageArrayLength - 1;
431
+
432
+ while (left <= right) {
433
+ middle = Math.floor((right + left) / 2);
434
+ if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
435
+ } // message already exists and not filtered due to timestampChanged, update and return
436
+
437
+
438
+ if (!timestampChanged && message.id) {
439
+ if (messageArr[left] && message.id === messageArr[left].id) {
440
+ messageArr[left] = message;
441
+ return _toConsumableArray__default['default'](messageArr);
442
+ }
443
+
444
+ if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
445
+ messageArr[left - 1] = message;
446
+ return _toConsumableArray__default['default'](messageArr);
447
+ }
448
+ } // Do not add updated or deleted messages to the list if they do not already exist
449
+ // or have a timestamp change.
450
+
451
+
452
+ if (addMessageToList) {
453
+ messageArr.splice(left, 0, message);
454
+ }
455
+
456
+ return _toConsumableArray__default['default'](messageArr);
457
+ }
458
+
459
+ 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; }
460
+
461
+ 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; }
124
462
 
125
463
  /**
126
464
  * ChannelState - A container class for the channel state.
@@ -197,7 +535,7 @@ var ChannelState = /*#__PURE__*/function () {
197
535
  var m = messages[i];
198
536
 
199
537
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
200
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
538
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
201
539
  user: user
202
540
  });
203
541
  }
@@ -252,7 +590,7 @@ var ChannelState = /*#__PURE__*/function () {
252
590
  user: m.user
253
591
  };
254
592
  } else {
255
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
593
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
256
594
  type: 'deleted',
257
595
  deleted_at: user.deleted_at
258
596
  });
@@ -359,7 +697,7 @@ var ChannelState = /*#__PURE__*/function () {
359
697
  }, {
360
698
  key: "formatMessage",
361
699
  value: function formatMessage(message) {
362
- return _objectSpread$6(_objectSpread$6({}, message), {}, {
700
+ return _objectSpread$7(_objectSpread$7({}, message), {}, {
363
701
  /**
364
702
  * @deprecated please use `html`
365
703
  */
@@ -577,7 +915,7 @@ var ChannelState = /*#__PURE__*/function () {
577
915
  var parseMessage = function parseMessage(m) {
578
916
  var _m$pinned_at, _m$updated_at;
579
917
 
580
- return _objectSpread$6(_objectSpread$6({}, m), {}, {
918
+ return _objectSpread$7(_objectSpread$7({}, m), {}, {
581
919
  created_at: m.created_at.toISOString(),
582
920
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
583
921
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
@@ -588,8 +926,8 @@ var ChannelState = /*#__PURE__*/function () {
588
926
  var updatedMessages = set.messages.filter(function (msg) {
589
927
  return msg.quoted_message_id === message.id;
590
928
  }).map(parseMessage).map(function (msg) {
591
- return _objectSpread$6(_objectSpread$6({}, msg), {}, {
592
- quoted_message: _objectSpread$6(_objectSpread$6({}, message), {}, {
929
+ return _objectSpread$7(_objectSpread$7({}, msg), {}, {
930
+ quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
593
931
  attachments: []
594
932
  })
595
933
  });
@@ -666,70 +1004,13 @@ var ChannelState = /*#__PURE__*/function () {
666
1004
  * @param message
667
1005
  * @param {boolean} timestampChanged Whether updating a message with changed created_at value.
668
1006
  * @param {string} sortBy field name to use to sort the messages by
669
- * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
670
- */
671
- function _addToMessageList(messages, message) {
672
- var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
673
- var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
674
- var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
675
- var addMessageToList = addIfDoesNotExist || timestampChanged;
676
- var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
677
- // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
678
-
679
- if (timestampChanged) {
680
- messageArr = messageArr.filter(function (msg) {
681
- return !(msg.id && message.id === msg.id);
682
- });
683
- } // Get array length after filtering
684
-
685
-
686
- var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
687
-
688
- if (messageArrayLength === 0 && addMessageToList) {
689
- return messageArr.concat(message);
690
- } else if (messageArrayLength === 0) {
691
- return _toConsumableArray__default['default'](messageArr);
692
- }
693
-
694
- var messageTime = message[sortBy].getTime();
695
- 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
696
-
697
- if (messageIsNewest && addMessageToList) {
698
- return messageArr.concat(message);
699
- } else if (messageIsNewest) {
700
- return _toConsumableArray__default['default'](messageArr);
701
- } // find the closest index to push the new message
702
-
703
-
704
- var left = 0;
705
- var middle = 0;
706
- var right = messageArrayLength - 1;
707
-
708
- while (left <= right) {
709
- middle = Math.floor((right + left) / 2);
710
- if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
711
- } // message already exists and not filtered due to timestampChanged, update and return
712
-
713
-
714
- if (!timestampChanged && message.id) {
715
- if (messageArr[left] && message.id === messageArr[left].id) {
716
- messageArr[left] = message;
717
- return _toConsumableArray__default['default'](messageArr);
718
- }
719
-
720
- if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
721
- messageArr[left - 1] = message;
722
- return _toConsumableArray__default['default'](messageArr);
723
- }
724
- } // Do not add updated or deleted messages to the list if they do not already exist
725
- // or have a timestamp change.
726
-
727
-
728
- if (addMessageToList) {
729
- messageArr.splice(left, 0, message);
730
- }
731
-
732
- return _toConsumableArray__default['default'](messageArr);
1007
+ * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
1008
+ */
1009
+ function _addToMessageList(messages, message) {
1010
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1011
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
1012
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1013
+ return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
733
1014
  }
734
1015
  /**
735
1016
  * removeMessage - Description
@@ -1101,268 +1382,18 @@ var ChannelState = /*#__PURE__*/function () {
1101
1382
  }
1102
1383
  }]);
1103
1384
 
1104
- return ChannelState;
1105
- }();
1106
-
1107
- 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; } } }; }
1108
-
1109
- 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); }
1110
-
1111
- 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; }
1112
-
1113
- /**
1114
- * logChatPromiseExecution - utility function for logging the execution of a promise..
1115
- * use this when you want to run the promise and handle errors by logging a warning
1116
- *
1117
- * @param {Promise<T>} promise The promise you want to run and log
1118
- * @param {string} name A descriptive name of what the promise does for log output
1119
- *
1120
- */
1121
- function logChatPromiseExecution(promise, name) {
1122
- promise.then().catch(function (error) {
1123
- console.warn("failed to do ".concat(name, ", ran into error: "), error);
1124
- });
1125
- }
1126
- var sleep = function sleep(m) {
1127
- return new Promise(function (r) {
1128
- return setTimeout(r, m);
1129
- });
1130
- };
1131
- function isFunction(value) {
1132
- return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
1133
- }
1134
- var chatCodes = {
1135
- TOKEN_EXPIRED: 40,
1136
- WS_CLOSED_SUCCESS: 1000
1137
- };
1138
-
1139
- function isReadableStream(obj) {
1140
- return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
1141
- }
1142
-
1143
- function isBuffer(obj) {
1144
- return obj != null && obj.constructor != null && // @ts-expect-error
1145
- typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
1146
- obj.constructor.isBuffer(obj);
1147
- }
1148
-
1149
- function isFileWebAPI(uri) {
1150
- return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
1151
- }
1152
-
1153
- function isOwnUser(user) {
1154
- return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
1155
- }
1156
-
1157
- function isBlobWebAPI(uri) {
1158
- return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
1159
- }
1160
-
1161
- function isOwnUserBaseProperty(property) {
1162
- var ownUserBaseProperties = {
1163
- channel_mutes: true,
1164
- devices: true,
1165
- mutes: true,
1166
- total_unread_count: true,
1167
- unread_channels: true,
1168
- unread_count: true,
1169
- invisible: true,
1170
- roles: true
1171
- };
1172
- return ownUserBaseProperties[property];
1173
- }
1174
- function addFileToFormData(uri, name, contentType) {
1175
- var data = new FormData__default['default']();
1176
-
1177
- if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
1178
- if (name) data.append('file', uri, name);else data.append('file', uri);
1179
- } else {
1180
- data.append('file', {
1181
- uri: uri,
1182
- name: name || uri.split('/').reverse()[0],
1183
- contentType: contentType || undefined,
1184
- type: contentType || undefined
1185
- });
1186
- }
1187
-
1188
- return data;
1189
- }
1190
- function normalizeQuerySort(sort) {
1191
- var sortFields = [];
1192
- var sortArr = Array.isArray(sort) ? sort : [sort];
1193
-
1194
- var _iterator = _createForOfIteratorHelper$3(sortArr),
1195
- _step;
1196
-
1197
- try {
1198
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1199
- var item = _step.value;
1200
- var entries = Object.entries(item);
1201
-
1202
- if (entries.length > 1) {
1203
- console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
1204
- }
1205
-
1206
- for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
1207
- var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
1208
- field = _entries$_i[0],
1209
- direction = _entries$_i[1];
1210
-
1211
- sortFields.push({
1212
- field: field,
1213
- direction: direction
1214
- });
1215
- }
1216
- }
1217
- } catch (err) {
1218
- _iterator.e(err);
1219
- } finally {
1220
- _iterator.f();
1221
- }
1222
-
1223
- return sortFields;
1224
- }
1225
- /**
1226
- * retryInterval - A retry interval which increases acc to number of failures
1227
- *
1228
- * @return {number} Duration to wait in milliseconds
1229
- */
1230
-
1231
- function retryInterval(numberOfFailures) {
1232
- // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
1233
- var max = Math.min(500 + numberOfFailures * 2000, 25000);
1234
- var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
1235
- return Math.floor(Math.random() * (max - min) + min);
1236
- }
1237
- function randomId() {
1238
- return generateUUIDv4();
1239
- }
1240
-
1241
- function hex(bytes) {
1242
- var s = '';
1243
-
1244
- for (var i = 0; i < bytes.length; i++) {
1245
- s += bytes[i].toString(16).padStart(2, '0');
1246
- }
1247
-
1248
- return s;
1249
- } // https://tools.ietf.org/html/rfc4122
1250
-
1251
-
1252
- function generateUUIDv4() {
1253
- var bytes = getRandomBytes(16);
1254
- bytes[6] = bytes[6] & 0x0f | 0x40; // version
1255
-
1256
- bytes[8] = bytes[8] & 0xbf | 0x80; // variant
1257
-
1258
- 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));
1259
- }
1260
-
1261
- function getRandomValuesWithMathRandom(bytes) {
1262
- var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
1263
-
1264
- for (var i = 0; i < bytes.length; i++) {
1265
- bytes[i] = Math.random() * max;
1266
- }
1267
- }
1268
-
1269
- var getRandomValues = function () {
1270
- var _crypto;
1271
-
1272
- if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
1273
- return crypto.getRandomValues.bind(crypto);
1274
- } else if (typeof msCrypto !== 'undefined') {
1275
- return msCrypto.getRandomValues.bind(msCrypto);
1276
- } else {
1277
- return getRandomValuesWithMathRandom;
1278
- }
1279
- }();
1280
-
1281
- function getRandomBytes(length) {
1282
- var bytes = new Uint8Array(length);
1283
- getRandomValues(bytes);
1284
- return bytes;
1285
- }
1286
-
1287
- function convertErrorToJson(err) {
1288
- var jsonObj = {};
1289
- if (!err) return jsonObj;
1290
-
1291
- try {
1292
- Object.getOwnPropertyNames(err).forEach(function (key) {
1293
- jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
1294
- });
1295
- } catch (_) {
1296
- return {
1297
- error: 'failed to serialize the error'
1298
- };
1299
- }
1300
-
1301
- return jsonObj;
1302
- }
1303
- /**
1304
- * isOnline safely return the navigator.online value for browser env
1305
- * if navigator is not in global object, it always return true
1306
- */
1307
-
1308
- function isOnline() {
1309
- var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
1310
-
1311
- if (!nav) {
1312
- console.warn('isOnline failed to access window.navigator and assume browser is online');
1313
- return true;
1314
- } // RN navigator has undefined for onLine
1315
-
1316
-
1317
- if (typeof nav.onLine !== 'boolean') {
1318
- return true;
1319
- }
1320
-
1321
- return nav.onLine;
1322
- }
1323
- /**
1324
- * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
1325
- */
1326
-
1327
- function addConnectionEventListeners(cb) {
1328
- if (typeof window !== 'undefined' && window.addEventListener) {
1329
- window.addEventListener('offline', cb);
1330
- window.addEventListener('online', cb);
1331
- }
1332
- }
1333
- function removeConnectionEventListeners(cb) {
1334
- if (typeof window !== 'undefined' && window.removeEventListener) {
1335
- window.removeEventListener('offline', cb);
1336
- window.removeEventListener('online', cb);
1337
- }
1338
- }
1339
- var axiosParamsSerializer = function axiosParamsSerializer(params) {
1340
- var newParams = [];
1341
-
1342
- for (var k in params) {
1343
- // Stream backend doesn't treat "undefined" value same as value not being present.
1344
- // So, we need to skip the undefined values.
1345
- if (params[k] === undefined) continue;
1346
-
1347
- if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
1348
- newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1349
- } else {
1350
- newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
1351
- }
1352
- }
1353
-
1354
- return newParams.join('&');
1355
- };
1385
+ return ChannelState;
1386
+ }();
1356
1387
 
1357
- 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; } } }; }
1388
+ 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; } } }; }
1358
1389
 
1359
- 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); }
1390
+ 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); }
1360
1391
 
1361
- 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; }
1392
+ 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; }
1362
1393
 
1363
- 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; }
1394
+ 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; }
1364
1395
 
1365
- 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; }
1396
+ 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; }
1366
1397
 
1367
1398
  /**
1368
1399
  * Channel - The Channel class manages it's own state.
@@ -1435,7 +1466,7 @@ var Channel = /*#__PURE__*/function () {
1435
1466
  while (1) {
1436
1467
  switch (_context.prev = _context.next) {
1437
1468
  case 0:
1438
- defaultOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
1469
+ defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
1439
1470
  watch: false,
1440
1471
  state: false,
1441
1472
  presence: false
@@ -1507,7 +1538,7 @@ var Channel = /*#__PURE__*/function () {
1507
1538
 
1508
1539
  this.data = data; // this._data is used for the requests...
1509
1540
 
1510
- this._data = _objectSpread$5({}, data);
1541
+ this._data = _objectSpread$6({}, data);
1511
1542
  this.cid = "".concat(type, ":").concat(id);
1512
1543
  this.listeners = {}; // perhaps the state variable should be private
1513
1544
 
@@ -1569,7 +1600,7 @@ var Channel = /*#__PURE__*/function () {
1569
1600
  switch (_context2.prev = _context2.next) {
1570
1601
  case 0:
1571
1602
  _context2.next = 2;
1572
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1603
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
1573
1604
  message: message
1574
1605
  }, options));
1575
1606
 
@@ -1685,7 +1716,7 @@ var Channel = /*#__PURE__*/function () {
1685
1716
 
1686
1717
  case 3:
1687
1718
  // Return a list of channels
1688
- payload = _objectSpread$5(_objectSpread$5({
1719
+ payload = _objectSpread$6(_objectSpread$6({
1689
1720
  filter_conditions: {
1690
1721
  cid: this.cid
1691
1722
  }
@@ -1782,7 +1813,7 @@ var Channel = /*#__PURE__*/function () {
1782
1813
 
1783
1814
  _context5.next = 6;
1784
1815
  return this.getClient().get(this.getClient().baseURL + '/members', {
1785
- payload: _objectSpread$5({
1816
+ payload: _objectSpread$6({
1786
1817
  type: type,
1787
1818
  id: id,
1788
1819
  members: members,
@@ -1843,7 +1874,7 @@ var Channel = /*#__PURE__*/function () {
1843
1874
 
1844
1875
  case 4:
1845
1876
  _context6.next = 6;
1846
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$5({
1877
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
1847
1878
  reaction: reaction
1848
1879
  }, options));
1849
1880
 
@@ -1924,7 +1955,7 @@ var Channel = /*#__PURE__*/function () {
1924
1955
  delete channelData[key];
1925
1956
  });
1926
1957
  _context7.next = 7;
1927
- return this._update(_objectSpread$5({
1958
+ return this._update(_objectSpread$6({
1928
1959
  message: updateMessage,
1929
1960
  data: channelData
1930
1961
  }, options));
@@ -1958,7 +1989,9 @@ var Channel = /*#__PURE__*/function () {
1958
1989
  key: "updatePartial",
1959
1990
  value: function () {
1960
1991
  var _updatePartial = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8(update) {
1961
- var data;
1992
+ var _this$data2, _this$data3;
1993
+
1994
+ var data, areCapabilitiesChanged;
1962
1995
  return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
1963
1996
  while (1) {
1964
1997
  switch (_context8.prev = _context8.next) {
@@ -1968,10 +2001,20 @@ var Channel = /*#__PURE__*/function () {
1968
2001
 
1969
2002
  case 2:
1970
2003
  data = _context8.sent;
1971
- this.data = data.channel;
2004
+ 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();
2005
+ this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
2006
+
2007
+ if (areCapabilitiesChanged) {
2008
+ this.getClient().dispatchEvent({
2009
+ type: 'capabilities.changed',
2010
+ cid: this.cid,
2011
+ own_capabilities: data.channel.own_capabilities
2012
+ });
2013
+ }
2014
+
1972
2015
  return _context8.abrupt("return", data);
1973
2016
 
1974
- case 5:
2017
+ case 7:
1975
2018
  case "end":
1976
2019
  return _context8.stop();
1977
2020
  }
@@ -2084,7 +2127,7 @@ var Channel = /*#__PURE__*/function () {
2084
2127
  case 0:
2085
2128
  options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
2086
2129
  _context11.next = 3;
2087
- return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
2130
+ return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
2088
2131
 
2089
2132
  case 3:
2090
2133
  return _context11.abrupt("return", _context11.sent);
@@ -2160,7 +2203,7 @@ var Channel = /*#__PURE__*/function () {
2160
2203
  case 0:
2161
2204
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2162
2205
  _context13.next = 3;
2163
- return this._update(_objectSpread$5({
2206
+ return this._update(_objectSpread$6({
2164
2207
  accept_invite: true
2165
2208
  }, options));
2166
2209
 
@@ -2201,7 +2244,7 @@ var Channel = /*#__PURE__*/function () {
2201
2244
  case 0:
2202
2245
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2203
2246
  _context14.next = 3;
2204
- return this._update(_objectSpread$5({
2247
+ return this._update(_objectSpread$6({
2205
2248
  reject_invite: true
2206
2249
  }, options));
2207
2250
 
@@ -2243,7 +2286,7 @@ var Channel = /*#__PURE__*/function () {
2243
2286
  case 0:
2244
2287
  options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
2245
2288
  _context15.next = 3;
2246
- return this._update(_objectSpread$5({
2289
+ return this._update(_objectSpread$6({
2247
2290
  add_members: members,
2248
2291
  message: message
2249
2292
  }, options));
@@ -2286,7 +2329,7 @@ var Channel = /*#__PURE__*/function () {
2286
2329
  case 0:
2287
2330
  options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
2288
2331
  _context16.next = 3;
2289
- return this._update(_objectSpread$5({
2332
+ return this._update(_objectSpread$6({
2290
2333
  add_moderators: members,
2291
2334
  message: message
2292
2335
  }, options));
@@ -2329,7 +2372,7 @@ var Channel = /*#__PURE__*/function () {
2329
2372
  case 0:
2330
2373
  options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
2331
2374
  _context17.next = 3;
2332
- return this._update(_objectSpread$5({
2375
+ return this._update(_objectSpread$6({
2333
2376
  assign_roles: roles,
2334
2377
  message: message
2335
2378
  }, options));
@@ -2372,7 +2415,7 @@ var Channel = /*#__PURE__*/function () {
2372
2415
  case 0:
2373
2416
  options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
2374
2417
  _context18.next = 3;
2375
- return this._update(_objectSpread$5({
2418
+ return this._update(_objectSpread$6({
2376
2419
  invites: members,
2377
2420
  message: message
2378
2421
  }, options));
@@ -2415,7 +2458,7 @@ var Channel = /*#__PURE__*/function () {
2415
2458
  case 0:
2416
2459
  options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
2417
2460
  _context19.next = 3;
2418
- return this._update(_objectSpread$5({
2461
+ return this._update(_objectSpread$6({
2419
2462
  remove_members: members,
2420
2463
  message: message
2421
2464
  }, options));
@@ -2458,7 +2501,7 @@ var Channel = /*#__PURE__*/function () {
2458
2501
  case 0:
2459
2502
  options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
2460
2503
  _context20.next = 3;
2461
- return this._update(_objectSpread$5({
2504
+ return this._update(_objectSpread$6({
2462
2505
  demote_moderators: members,
2463
2506
  message: message
2464
2507
  }, options));
@@ -2543,7 +2586,7 @@ var Channel = /*#__PURE__*/function () {
2543
2586
  case 0:
2544
2587
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2545
2588
  _context22.next = 3;
2546
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$5({
2589
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
2547
2590
  channel_cid: this.cid
2548
2591
  }, opts));
2549
2592
 
@@ -2585,7 +2628,7 @@ var Channel = /*#__PURE__*/function () {
2585
2628
  case 0:
2586
2629
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2587
2630
  _context23.next = 3;
2588
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$5({
2631
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
2589
2632
  channel_cid: this.cid
2590
2633
  }, opts));
2591
2634
 
@@ -2644,7 +2687,7 @@ var Channel = /*#__PURE__*/function () {
2644
2687
  }, {
2645
2688
  key: "keystroke",
2646
2689
  value: function () {
2647
- var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id) {
2690
+ var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
2648
2691
  var _this$getConfig;
2649
2692
 
2650
2693
  var now, diff;
@@ -2672,10 +2715,10 @@ var Channel = /*#__PURE__*/function () {
2672
2715
 
2673
2716
  this.lastTypingEvent = new Date();
2674
2717
  _context24.next = 10;
2675
- return this.sendEvent({
2718
+ return this.sendEvent(_objectSpread$6({
2676
2719
  type: 'typing.start',
2677
2720
  parent_id: parent_id
2678
- });
2721
+ }, options || {}));
2679
2722
 
2680
2723
  case 10:
2681
2724
  case "end":
@@ -2685,7 +2728,7 @@ var Channel = /*#__PURE__*/function () {
2685
2728
  }, _callee24, this);
2686
2729
  }));
2687
2730
 
2688
- function keystroke(_x25) {
2731
+ function keystroke(_x25, _x26) {
2689
2732
  return _keystroke.apply(this, arguments);
2690
2733
  }
2691
2734
 
@@ -2700,7 +2743,7 @@ var Channel = /*#__PURE__*/function () {
2700
2743
  }, {
2701
2744
  key: "stopTyping",
2702
2745
  value: function () {
2703
- var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id) {
2746
+ var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
2704
2747
  var _this$getConfig2;
2705
2748
 
2706
2749
  return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
@@ -2718,10 +2761,10 @@ var Channel = /*#__PURE__*/function () {
2718
2761
  this.lastTypingEvent = null;
2719
2762
  this.isTyping = false;
2720
2763
  _context25.next = 6;
2721
- return this.sendEvent({
2764
+ return this.sendEvent(_objectSpread$6({
2722
2765
  type: 'typing.stop',
2723
2766
  parent_id: parent_id
2724
- });
2767
+ }, options || {}));
2725
2768
 
2726
2769
  case 6:
2727
2770
  case "end":
@@ -2731,7 +2774,7 @@ var Channel = /*#__PURE__*/function () {
2731
2774
  }, _callee25, this);
2732
2775
  }));
2733
2776
 
2734
- function stopTyping(_x26) {
2777
+ function stopTyping(_x27, _x28) {
2735
2778
  return _stopTyping.apply(this, arguments);
2736
2779
  }
2737
2780
 
@@ -2785,7 +2828,7 @@ var Channel = /*#__PURE__*/function () {
2785
2828
 
2786
2829
  this._checkInitialized();
2787
2830
 
2788
- if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
2831
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2789
2832
  _context26.next = 4;
2790
2833
  break;
2791
2834
  }
@@ -2794,7 +2837,7 @@ var Channel = /*#__PURE__*/function () {
2794
2837
 
2795
2838
  case 4:
2796
2839
  _context26.next = 6;
2797
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$5({}, data));
2840
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
2798
2841
 
2799
2842
  case 6:
2800
2843
  return _context26.abrupt("return", _context26.sent);
@@ -2832,7 +2875,7 @@ var Channel = /*#__PURE__*/function () {
2832
2875
  case 0:
2833
2876
  this._checkInitialized();
2834
2877
 
2835
- if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
2878
+ if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2836
2879
  _context27.next = 3;
2837
2880
  break;
2838
2881
  }
@@ -2841,7 +2884,7 @@ var Channel = /*#__PURE__*/function () {
2841
2884
 
2842
2885
  case 3:
2843
2886
  _context27.next = 5;
2844
- return this.getClient().post(this._channelURL() + '/unread', _objectSpread$5({}, data));
2887
+ return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
2845
2888
 
2846
2889
  case 5:
2847
2890
  return _context27.abrupt("return", _context27.sent);
@@ -2854,7 +2897,7 @@ var Channel = /*#__PURE__*/function () {
2854
2897
  }, _callee27, this);
2855
2898
  }));
2856
2899
 
2857
- function markUnread(_x27) {
2900
+ function markUnread(_x29) {
2858
2901
  return _markUnread.apply(this, arguments);
2859
2902
  }
2860
2903
 
@@ -2909,7 +2952,7 @@ var Channel = /*#__PURE__*/function () {
2909
2952
  defaultOptions.watch = false;
2910
2953
  }
2911
2954
 
2912
- combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
2955
+ combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
2913
2956
  _context28.next = 7;
2914
2957
  return this.query(combined, 'latest');
2915
2958
 
@@ -2933,7 +2976,7 @@ var Channel = /*#__PURE__*/function () {
2933
2976
  }, _callee28, this);
2934
2977
  }));
2935
2978
 
2936
- function watch(_x28) {
2979
+ function watch(_x30) {
2937
2980
  return _watch.apply(this, arguments);
2938
2981
  }
2939
2982
 
@@ -3000,7 +3043,7 @@ var Channel = /*#__PURE__*/function () {
3000
3043
  switch (_context30.prev = _context30.next) {
3001
3044
  case 0:
3002
3045
  _context30.next = 2;
3003
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$5({}, options));
3046
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
3004
3047
 
3005
3048
  case 2:
3006
3049
  data = _context30.sent;
@@ -3020,7 +3063,7 @@ var Channel = /*#__PURE__*/function () {
3020
3063
  }, _callee30, this);
3021
3064
  }));
3022
3065
 
3023
- function getReplies(_x29, _x30) {
3066
+ function getReplies(_x31, _x32) {
3024
3067
  return _getReplies.apply(this, arguments);
3025
3068
  }
3026
3069
 
@@ -3048,7 +3091,7 @@ var Channel = /*#__PURE__*/function () {
3048
3091
  sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
3049
3092
  _context31.next = 3;
3050
3093
  return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
3051
- payload: _objectSpread$5(_objectSpread$5({}, options), {}, {
3094
+ payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
3052
3095
  sort: normalizeQuerySort(sort)
3053
3096
  })
3054
3097
  });
@@ -3064,7 +3107,7 @@ var Channel = /*#__PURE__*/function () {
3064
3107
  }, _callee31, this);
3065
3108
  }));
3066
3109
 
3067
- function getPinnedMessages(_x31) {
3110
+ function getPinnedMessages(_x33) {
3068
3111
  return _getPinnedMessages.apply(this, arguments);
3069
3112
  }
3070
3113
 
@@ -3082,7 +3125,7 @@ var Channel = /*#__PURE__*/function () {
3082
3125
  }, {
3083
3126
  key: "getReactions",
3084
3127
  value: function getReactions(message_id, options) {
3085
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$5({}, options));
3128
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
3086
3129
  }
3087
3130
  /**
3088
3131
  * getMessagesById - Retrieves a list of messages by ID
@@ -3117,7 +3160,7 @@ var Channel = /*#__PURE__*/function () {
3117
3160
  }, {
3118
3161
  key: "_countMessageAsUnread",
3119
3162
  value: function _countMessageAsUnread(message) {
3120
- var _message$user, _message$user2, _this$data2, _this$data3;
3163
+ var _message$user, _message$user2, _this$data4, _this$data5;
3121
3164
 
3122
3165
  if (message.shadowed) return false;
3123
3166
  if (message.silent) return false;
@@ -3126,7 +3169,7 @@ var Channel = /*#__PURE__*/function () {
3126
3169
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3127
3170
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3128
3171
 
3129
- 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;
3172
+ 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;
3130
3173
  if (this.muteStatus().muted) return false;
3131
3174
  return true;
3132
3175
  }
@@ -3201,7 +3244,7 @@ var Channel = /*#__PURE__*/function () {
3201
3244
  */
3202
3245
  function () {
3203
3246
  var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee32(options) {
3204
- var _this$data4, _this$data5;
3247
+ var _this$data6, _this$data7;
3205
3248
 
3206
3249
  var messageSetToAddToIfDoesNotExist,
3207
3250
  queryURL,
@@ -3229,7 +3272,7 @@ var Channel = /*#__PURE__*/function () {
3229
3272
  }
3230
3273
 
3231
3274
  _context32.next = 7;
3232
- return this.getClient().post(queryURL + '/query', _objectSpread$5({
3275
+ return this.getClient().post(queryURL + '/query', _objectSpread$6({
3233
3276
  data: this._data,
3234
3277
  state: true
3235
3278
  }, options));
@@ -3264,7 +3307,7 @@ var Channel = /*#__PURE__*/function () {
3264
3307
 
3265
3308
 
3266
3309
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3267
- 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();
3310
+ 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();
3268
3311
  this.data = state.channel;
3269
3312
  this.offlineMode = false;
3270
3313
 
@@ -3293,7 +3336,7 @@ var Channel = /*#__PURE__*/function () {
3293
3336
  }, _callee32, this);
3294
3337
  }));
3295
3338
 
3296
- function query(_x32) {
3339
+ function query(_x34) {
3297
3340
  return _query.apply(this, arguments);
3298
3341
  }
3299
3342
 
@@ -3318,7 +3361,7 @@ var Channel = /*#__PURE__*/function () {
3318
3361
  this._checkInitialized();
3319
3362
 
3320
3363
  _context33.next = 3;
3321
- return this.getClient().banUser(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3364
+ return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3322
3365
  type: this.type,
3323
3366
  id: this.id
3324
3367
  }));
@@ -3334,7 +3377,7 @@ var Channel = /*#__PURE__*/function () {
3334
3377
  }, _callee33, this);
3335
3378
  }));
3336
3379
 
3337
- function banUser(_x33, _x34) {
3380
+ function banUser(_x35, _x36) {
3338
3381
  return _banUser.apply(this, arguments);
3339
3382
  }
3340
3383
 
@@ -3465,7 +3508,7 @@ var Channel = /*#__PURE__*/function () {
3465
3508
  }, _callee36, this);
3466
3509
  }));
3467
3510
 
3468
- function unbanUser(_x35) {
3511
+ function unbanUser(_x37) {
3469
3512
  return _unbanUser.apply(this, arguments);
3470
3513
  }
3471
3514
 
@@ -3490,7 +3533,7 @@ var Channel = /*#__PURE__*/function () {
3490
3533
  this._checkInitialized();
3491
3534
 
3492
3535
  _context37.next = 3;
3493
- return this.getClient().shadowBan(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3536
+ return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3494
3537
  type: this.type,
3495
3538
  id: this.id
3496
3539
  }));
@@ -3506,7 +3549,7 @@ var Channel = /*#__PURE__*/function () {
3506
3549
  }, _callee37, this);
3507
3550
  }));
3508
3551
 
3509
- function shadowBan(_x36, _x37) {
3552
+ function shadowBan(_x38, _x39) {
3510
3553
  return _shadowBan.apply(this, arguments);
3511
3554
  }
3512
3555
 
@@ -3546,7 +3589,7 @@ var Channel = /*#__PURE__*/function () {
3546
3589
  }, _callee38, this);
3547
3590
  }));
3548
3591
 
3549
- function removeShadowBan(_x38) {
3592
+ function removeShadowBan(_x40) {
3550
3593
  return _removeShadowBan.apply(this, arguments);
3551
3594
  }
3552
3595
 
@@ -3581,7 +3624,7 @@ var Channel = /*#__PURE__*/function () {
3581
3624
  }, _callee39, this);
3582
3625
  }));
3583
3626
 
3584
- function createCall(_x39) {
3627
+ function createCall(_x41) {
3585
3628
  return _createCall.apply(this, arguments);
3586
3629
  }
3587
3630
 
@@ -3876,7 +3919,7 @@ var Channel = /*#__PURE__*/function () {
3876
3919
  });
3877
3920
  }
3878
3921
 
3879
- channel.data = _objectSpread$5(_objectSpread$5({}, event.channel), {}, {
3922
+ channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
3880
3923
  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,
3881
3924
  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
3882
3925
  });
@@ -3907,7 +3950,7 @@ var Channel = /*#__PURE__*/function () {
3907
3950
  break;
3908
3951
 
3909
3952
  case 'channel.hidden':
3910
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3953
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3911
3954
  hidden: true
3912
3955
  });
3913
3956
 
@@ -3918,26 +3961,26 @@ var Channel = /*#__PURE__*/function () {
3918
3961
  break;
3919
3962
 
3920
3963
  case 'channel.visible':
3921
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3964
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3922
3965
  hidden: false
3923
3966
  });
3924
3967
  break;
3925
3968
 
3926
3969
  case 'user.banned':
3927
3970
  if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3928
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3971
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3929
3972
  shadow_banned: !!event.shadow,
3930
3973
  banned: !event.shadow,
3931
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3974
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3932
3975
  });
3933
3976
  break;
3934
3977
 
3935
3978
  case 'user.unbanned':
3936
3979
  if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
3937
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3980
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3938
3981
  shadow_banned: false,
3939
3982
  banned: false,
3940
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3983
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3941
3984
  });
3942
3985
  break;
3943
3986
  } // any event can send over the online count
@@ -3967,7 +4010,7 @@ var Channel = /*#__PURE__*/function () {
3967
4010
 
3968
4011
 
3969
4012
  if (state.members) {
3970
- var _iterator = _createForOfIteratorHelper$2(state.members),
4013
+ var _iterator = _createForOfIteratorHelper$3(state.members),
3971
4014
  _step;
3972
4015
 
3973
4016
  try {
@@ -4011,7 +4054,7 @@ var Channel = /*#__PURE__*/function () {
4011
4054
 
4012
4055
 
4013
4056
  if (state.watchers) {
4014
- var _iterator2 = _createForOfIteratorHelper$2(state.watchers),
4057
+ var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
4015
4058
  _step2;
4016
4059
 
4017
4060
  try {
@@ -4047,7 +4090,7 @@ var Channel = /*#__PURE__*/function () {
4047
4090
 
4048
4091
 
4049
4092
  if (state.read) {
4050
- var _iterator3 = _createForOfIteratorHelper$2(state.read),
4093
+ var _iterator3 = _createForOfIteratorHelper$3(state.read),
4051
4094
  _step3;
4052
4095
 
4053
4096
  try {
@@ -4116,11 +4159,11 @@ var Channel = /*#__PURE__*/function () {
4116
4159
  return Channel;
4117
4160
  }();
4118
4161
 
4119
- 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; } } }; }
4162
+ 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; } } }; }
4120
4163
 
4121
- 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); }
4164
+ 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); }
4122
4165
 
4123
- 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; }
4166
+ 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; }
4124
4167
 
4125
4168
  /**
4126
4169
  * ClientState - A container class for the client state.
@@ -4143,7 +4186,7 @@ var ClientState = /*#__PURE__*/function () {
4143
4186
  _createClass__default['default'](ClientState, [{
4144
4187
  key: "updateUsers",
4145
4188
  value: function updateUsers(users) {
4146
- var _iterator = _createForOfIteratorHelper$1(users),
4189
+ var _iterator = _createForOfIteratorHelper$2(users),
4147
4190
  _step;
4148
4191
 
4149
4192
  try {
@@ -4191,9 +4234,9 @@ var ClientState = /*#__PURE__*/function () {
4191
4234
  return ClientState;
4192
4235
  }();
4193
4236
 
4194
- 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; }
4237
+ 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; }
4195
4238
 
4196
- 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; }
4239
+ 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; }
4197
4240
  var InsightMetrics = function InsightMetrics() {
4198
4241
  _classCallCheck__default['default'](this, InsightMetrics);
4199
4242
 
@@ -4272,7 +4315,7 @@ var postInsights = /*#__PURE__*/function () {
4272
4315
  };
4273
4316
  }();
4274
4317
  function buildWsFatalInsight(connection, event) {
4275
- return _objectSpread$4(_objectSpread$4({}, event), buildWsBaseInsight(connection));
4318
+ return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
4276
4319
  }
4277
4320
 
4278
4321
  function buildWsBaseInsight(connection) {
@@ -4305,9 +4348,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
4305
4348
  return buildWsBaseInsight(connection);
4306
4349
  }
4307
4350
 
4308
- 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; }
4351
+ 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; }
4309
4352
 
4310
- 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; }
4353
+ 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; }
4311
4354
 
4312
4355
  // Type guards to check WebSocket error type
4313
4356
  var isCloseEvent = function isCloseEvent(res) {
@@ -4671,7 +4714,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4671
4714
  value: function _log(msg) {
4672
4715
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4673
4716
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
4674
- this.client.logger(level, 'connection:' + msg, _objectSpread$3({
4717
+ this.client.logger(level, 'connection:' + msg, _objectSpread$4({
4675
4718
  tags: ['connection']
4676
4719
  }, extra));
4677
4720
  }
@@ -5266,9 +5309,9 @@ var jwt = null;
5266
5309
 
5267
5310
  var crypto$1 = null;
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
 
@@ -5693,9 +5736,9 @@ function isErrorResponse(res) {
5693
5736
  return !res.status || res.status < 200 || 300 <= res.status;
5694
5737
  }
5695
5738
 
5696
- 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; }
5739
+ 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; }
5697
5740
 
5698
- 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; }
5741
+ 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; }
5699
5742
  var ConnectionState;
5700
5743
 
5701
5744
  (function (ConnectionState) {
@@ -5758,7 +5801,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5758
5801
  _context.next = 4;
5759
5802
  return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
5760
5803
  undefined, {
5761
- config: _objectSpread$1(_objectSpread$1({}, config), {}, {
5804
+ config: _objectSpread$2(_objectSpread$2({}, config), {}, {
5762
5805
  cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
5763
5806
  }),
5764
5807
  params: params
@@ -6036,7 +6079,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6036
6079
  value: function _log(msg) {
6037
6080
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6038
6081
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
6039
- this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$1({
6082
+ this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
6040
6083
  tags: ['connection_fallback', 'connection']
6041
6084
  }, extra));
6042
6085
  }
@@ -6083,6 +6126,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
6083
6126
  /**
6084
6127
  * Response Types
6085
6128
  */
6129
+ // TODO: Figure out a way to strongly type set and unset.
6086
6130
  // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6087
6131
 
6088
6132
  /**
@@ -6154,6 +6198,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6154
6198
  return ErrorFromResponse;
6155
6199
  }( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
6156
6200
 
6201
+ 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; }
6202
+
6203
+ 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; }
6204
+
6205
+ 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; } } }; }
6206
+
6207
+ 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); }
6208
+
6209
+ 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; }
6210
+ var Thread = /*#__PURE__*/function () {
6211
+ function Thread(client, t) {
6212
+ _classCallCheck__default['default'](this, Thread);
6213
+
6214
+ _defineProperty__default['default'](this, "id", void 0);
6215
+
6216
+ _defineProperty__default['default'](this, "latestReplies", []);
6217
+
6218
+ _defineProperty__default['default'](this, "participants", []);
6219
+
6220
+ _defineProperty__default['default'](this, "message", void 0);
6221
+
6222
+ _defineProperty__default['default'](this, "channel", void 0);
6223
+
6224
+ _defineProperty__default['default'](this, "_channel", void 0);
6225
+
6226
+ _defineProperty__default['default'](this, "replyCount", 0);
6227
+
6228
+ _defineProperty__default['default'](this, "_client", void 0);
6229
+
6230
+ _defineProperty__default['default'](this, "read", {});
6231
+
6232
+ this.id = t.parent_message.id;
6233
+ this.message = formatMessage(t.parent_message);
6234
+ this.latestReplies = t.latest_replies.map(formatMessage);
6235
+ this.participants = t.thread_participants;
6236
+ this.replyCount = t.reply_count;
6237
+ this.channel = t.channel;
6238
+ this._channel = client.channel(t.channel.type, t.channel.id);
6239
+ this._client = client;
6240
+
6241
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6242
+ _step;
6243
+
6244
+ try {
6245
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6246
+ var r = _step.value;
6247
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6248
+ last_read: new Date(r.last_read)
6249
+ });
6250
+ }
6251
+ } catch (err) {
6252
+ _iterator.e(err);
6253
+ } finally {
6254
+ _iterator.f();
6255
+ }
6256
+ }
6257
+
6258
+ _createClass__default['default'](Thread, [{
6259
+ key: "getClient",
6260
+ value: function getClient() {
6261
+ return this._client;
6262
+ }
6263
+ }, {
6264
+ key: "addReply",
6265
+ value: function addReply(message) {
6266
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6267
+ }
6268
+ }, {
6269
+ key: "updateReply",
6270
+ value: function updateReply(message) {
6271
+ this.latestReplies = this.latestReplies.map(function (m) {
6272
+ if (m.id === message.id) {
6273
+ return formatMessage(message);
6274
+ }
6275
+
6276
+ return m;
6277
+ });
6278
+ }
6279
+ }, {
6280
+ key: "updateMessageOrReplyIfExists",
6281
+ value: function updateMessageOrReplyIfExists(message) {
6282
+ if (!message.parent_id && message.id !== this.message.id) {
6283
+ return;
6284
+ }
6285
+
6286
+ if (message.parent_id && message.parent_id !== this.message.id) {
6287
+ return;
6288
+ }
6289
+
6290
+ if (message.parent_id && message.parent_id === this.message.id) {
6291
+ this.updateReply(message);
6292
+ }
6293
+
6294
+ if (!message.parent_id && message.id === this.message.id) {
6295
+ this.message = formatMessage(message);
6296
+ }
6297
+ }
6298
+ }, {
6299
+ key: "addReaction",
6300
+ value: function addReaction(reaction, message, enforce_unique) {
6301
+ var _this = this;
6302
+
6303
+ if (!message) return;
6304
+ this.latestReplies = this.latestReplies.map(function (m) {
6305
+ if (m.id === message.id) {
6306
+ return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
6307
+ }
6308
+
6309
+ return m;
6310
+ });
6311
+ }
6312
+ }, {
6313
+ key: "removeReaction",
6314
+ value: function removeReaction(reaction, message) {
6315
+ var _this2 = this;
6316
+
6317
+ if (!message) return;
6318
+ this.latestReplies = this.latestReplies.map(function (m) {
6319
+ if (m.id === message.id) {
6320
+ return formatMessage(_this2._channel.state.removeReaction(reaction, message));
6321
+ }
6322
+
6323
+ return m;
6324
+ });
6325
+ }
6326
+ }]);
6327
+
6328
+ return Thread;
6329
+ }();
6330
+
6157
6331
  var _excluded = ["created_at", "updated_at", "last_active", "online"],
6158
6332
  _excluded2 = ["params", "headers"];
6159
6333
 
@@ -10265,10 +10439,197 @@ var StreamChat = /*#__PURE__*/function () {
10265
10439
 
10266
10440
  return getMessage;
10267
10441
  }()
10442
+ /**
10443
+ * queryThreads - returns the list of threads of current user.
10444
+ *
10445
+ * @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
10446
+ * @param {number} options.limit Limits the number of threads to be returned.
10447
+ * @param {boolean} options.watch Subscribes the user to the channels of the threads.
10448
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10449
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10450
+ *
10451
+ * @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
10452
+ */
10453
+
10454
+ }, {
10455
+ key: "queryThreads",
10456
+ value: function () {
10457
+ var _queryThreads = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(options) {
10458
+ var _this5 = this;
10459
+
10460
+ var opts, res;
10461
+ return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10462
+ while (1) {
10463
+ switch (_context59.prev = _context59.next) {
10464
+ case 0:
10465
+ opts = _objectSpread({
10466
+ limit: 10,
10467
+ participant_limit: 10,
10468
+ reply_limit: 3,
10469
+ watch: true
10470
+ }, options);
10471
+ _context59.next = 3;
10472
+ return this.post(this.baseURL + "/threads", opts);
10473
+
10474
+ case 3:
10475
+ res = _context59.sent;
10476
+ return _context59.abrupt("return", {
10477
+ threads: res.threads.map(function (thread) {
10478
+ return new Thread(_this5, thread);
10479
+ }),
10480
+ next: res.next
10481
+ });
10482
+
10483
+ case 5:
10484
+ case "end":
10485
+ return _context59.stop();
10486
+ }
10487
+ }
10488
+ }, _callee59, this);
10489
+ }));
10490
+
10491
+ function queryThreads(_x78) {
10492
+ return _queryThreads.apply(this, arguments);
10493
+ }
10494
+
10495
+ return queryThreads;
10496
+ }()
10497
+ /**
10498
+ * getThread - returns the thread of a message by its id.
10499
+ *
10500
+ * @param {string} messageId The message id
10501
+ * @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
10502
+ * @param {boolean} options.watch Subscribes the user to the channel of the thread.
10503
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10504
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10505
+ *
10506
+ * @returns {Thread<StreamChatGenerics>} Returns the thread.
10507
+ */
10508
+
10509
+ }, {
10510
+ key: "getThread",
10511
+ value: function () {
10512
+ var _getThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(messageId) {
10513
+ var options,
10514
+ opts,
10515
+ res,
10516
+ _args60 = arguments;
10517
+ return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10518
+ while (1) {
10519
+ switch (_context60.prev = _context60.next) {
10520
+ case 0:
10521
+ options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
10522
+
10523
+ if (messageId) {
10524
+ _context60.next = 3;
10525
+ break;
10526
+ }
10527
+
10528
+ throw Error('Please specify the message id when calling partialUpdateThread');
10529
+
10530
+ case 3:
10531
+ opts = _objectSpread({
10532
+ participant_limit: 100,
10533
+ reply_limit: 3,
10534
+ watch: true
10535
+ }, options);
10536
+ _context60.next = 6;
10537
+ return this.get(this.baseURL + "/threads/".concat(messageId), opts);
10538
+
10539
+ case 6:
10540
+ res = _context60.sent;
10541
+ return _context60.abrupt("return", new Thread(this, res.thread));
10542
+
10543
+ case 8:
10544
+ case "end":
10545
+ return _context60.stop();
10546
+ }
10547
+ }
10548
+ }, _callee60, this);
10549
+ }));
10550
+
10551
+ function getThread(_x79) {
10552
+ return _getThread.apply(this, arguments);
10553
+ }
10554
+
10555
+ return getThread;
10556
+ }()
10557
+ /**
10558
+ * partialUpdateThread - updates the given thread
10559
+ *
10560
+ * @param {string} messageId The id of the thread message which needs to be updated.
10561
+ * @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
10562
+ *
10563
+ * @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
10564
+ */
10565
+
10566
+ }, {
10567
+ key: "partialUpdateThread",
10568
+ value: function () {
10569
+ var _partialUpdateThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(messageId, partialThreadObject) {
10570
+ var reservedThreadFields, _key5;
10571
+
10572
+ return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10573
+ while (1) {
10574
+ switch (_context61.prev = _context61.next) {
10575
+ case 0:
10576
+ if (messageId) {
10577
+ _context61.next = 2;
10578
+ break;
10579
+ }
10580
+
10581
+ throw Error('Please specify the message id when calling partialUpdateThread');
10582
+
10583
+ case 2:
10584
+ // check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
10585
+ // Throw error if any of the reserved field is found.
10586
+ reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
10587
+ _context61.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
10588
+
10589
+ case 4:
10590
+ if ((_context61.t1 = _context61.t0()).done) {
10591
+ _context61.next = 10;
10592
+ break;
10593
+ }
10594
+
10595
+ _key5 = _context61.t1.value;
10596
+
10597
+ if (!reservedThreadFields.includes(_key5)) {
10598
+ _context61.next = 8;
10599
+ break;
10600
+ }
10601
+
10602
+ 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."));
10603
+
10604
+ case 8:
10605
+ _context61.next = 4;
10606
+ break;
10607
+
10608
+ case 10:
10609
+ _context61.next = 12;
10610
+ return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
10611
+
10612
+ case 12:
10613
+ return _context61.abrupt("return", _context61.sent);
10614
+
10615
+ case 13:
10616
+ case "end":
10617
+ return _context61.stop();
10618
+ }
10619
+ }
10620
+ }, _callee61, this);
10621
+ }));
10622
+
10623
+ function partialUpdateThread(_x80, _x81) {
10624
+ return _partialUpdateThread.apply(this, arguments);
10625
+ }
10626
+
10627
+ return partialUpdateThread;
10628
+ }()
10268
10629
  }, {
10269
10630
  key: "getUserAgent",
10270
10631
  value: function getUserAgent() {
10271
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.15.0");
10632
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.17.0");
10272
10633
  }
10273
10634
  }, {
10274
10635
  key: "setUserAgent",
@@ -10487,28 +10848,28 @@ var StreamChat = /*#__PURE__*/function () {
10487
10848
  }, {
10488
10849
  key: "sendUserCustomEvent",
10489
10850
  value: function () {
10490
- var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(targetUserID, event) {
10491
- return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10851
+ var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(targetUserID, event) {
10852
+ return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
10492
10853
  while (1) {
10493
- switch (_context59.prev = _context59.next) {
10854
+ switch (_context62.prev = _context62.next) {
10494
10855
  case 0:
10495
- _context59.next = 2;
10856
+ _context62.next = 2;
10496
10857
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
10497
10858
  event: event
10498
10859
  });
10499
10860
 
10500
10861
  case 2:
10501
- return _context59.abrupt("return", _context59.sent);
10862
+ return _context62.abrupt("return", _context62.sent);
10502
10863
 
10503
10864
  case 3:
10504
10865
  case "end":
10505
- return _context59.stop();
10866
+ return _context62.stop();
10506
10867
  }
10507
10868
  }
10508
- }, _callee59, this);
10869
+ }, _callee62, this);
10509
10870
  }));
10510
10871
 
10511
- function sendUserCustomEvent(_x78, _x79) {
10872
+ function sendUserCustomEvent(_x82, _x83) {
10512
10873
  return _sendUserCustomEvent.apply(this, arguments);
10513
10874
  }
10514
10875
 
@@ -10580,12 +10941,12 @@ var StreamChat = /*#__PURE__*/function () {
10580
10941
  }, {
10581
10942
  key: "createSegment",
10582
10943
  value: function () {
10583
- var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(type, id, name, data) {
10944
+ var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(type, id, name, data) {
10584
10945
  var body, _yield$this$post, segment;
10585
10946
 
10586
- return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10947
+ return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
10587
10948
  while (1) {
10588
- switch (_context60.prev = _context60.next) {
10949
+ switch (_context63.prev = _context63.next) {
10589
10950
  case 0:
10590
10951
  body = {
10591
10952
  id: id,
@@ -10593,23 +10954,23 @@ var StreamChat = /*#__PURE__*/function () {
10593
10954
  name: name,
10594
10955
  data: data
10595
10956
  };
10596
- _context60.next = 3;
10957
+ _context63.next = 3;
10597
10958
  return this.post(this.baseURL + "/segments", body);
10598
10959
 
10599
10960
  case 3:
10600
- _yield$this$post = _context60.sent;
10961
+ _yield$this$post = _context63.sent;
10601
10962
  segment = _yield$this$post.segment;
10602
- return _context60.abrupt("return", segment);
10963
+ return _context63.abrupt("return", segment);
10603
10964
 
10604
10965
  case 6:
10605
10966
  case "end":
10606
- return _context60.stop();
10967
+ return _context63.stop();
10607
10968
  }
10608
10969
  }
10609
- }, _callee60, this);
10970
+ }, _callee63, this);
10610
10971
  }));
10611
10972
 
10612
- function createSegment(_x80, _x81, _x82, _x83) {
10973
+ function createSegment(_x84, _x85, _x86, _x87) {
10613
10974
  return _createSegment.apply(this, arguments);
10614
10975
  }
10615
10976
 
@@ -10628,26 +10989,26 @@ var StreamChat = /*#__PURE__*/function () {
10628
10989
  }, {
10629
10990
  key: "createUserSegment",
10630
10991
  value: function () {
10631
- var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(id, name, data) {
10632
- return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10992
+ var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, name, data) {
10993
+ return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
10633
10994
  while (1) {
10634
- switch (_context61.prev = _context61.next) {
10995
+ switch (_context64.prev = _context64.next) {
10635
10996
  case 0:
10636
- _context61.next = 2;
10997
+ _context64.next = 2;
10637
10998
  return this.createSegment('user', id, name, data);
10638
10999
 
10639
11000
  case 2:
10640
- return _context61.abrupt("return", _context61.sent);
11001
+ return _context64.abrupt("return", _context64.sent);
10641
11002
 
10642
11003
  case 3:
10643
11004
  case "end":
10644
- return _context61.stop();
11005
+ return _context64.stop();
10645
11006
  }
10646
11007
  }
10647
- }, _callee61, this);
11008
+ }, _callee64, this);
10648
11009
  }));
10649
11010
 
10650
- function createUserSegment(_x84, _x85, _x86) {
11011
+ function createUserSegment(_x88, _x89, _x90) {
10651
11012
  return _createUserSegment.apply(this, arguments);
10652
11013
  }
10653
11014
 
@@ -10666,26 +11027,26 @@ var StreamChat = /*#__PURE__*/function () {
10666
11027
  }, {
10667
11028
  key: "createChannelSegment",
10668
11029
  value: function () {
10669
- var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(id, name, data) {
10670
- return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
11030
+ var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
11031
+ return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
10671
11032
  while (1) {
10672
- switch (_context62.prev = _context62.next) {
11033
+ switch (_context65.prev = _context65.next) {
10673
11034
  case 0:
10674
- _context62.next = 2;
11035
+ _context65.next = 2;
10675
11036
  return this.createSegment('channel', id, name, data);
10676
11037
 
10677
11038
  case 2:
10678
- return _context62.abrupt("return", _context62.sent);
11039
+ return _context65.abrupt("return", _context65.sent);
10679
11040
 
10680
11041
  case 3:
10681
11042
  case "end":
10682
- return _context62.stop();
11043
+ return _context65.stop();
10683
11044
  }
10684
11045
  }
10685
- }, _callee62, this);
11046
+ }, _callee65, this);
10686
11047
  }));
10687
11048
 
10688
- function createChannelSegment(_x87, _x88, _x89) {
11049
+ function createChannelSegment(_x91, _x92, _x93) {
10689
11050
  return _createChannelSegment.apply(this, arguments);
10690
11051
  }
10691
11052
 
@@ -10703,30 +11064,30 @@ var StreamChat = /*#__PURE__*/function () {
10703
11064
  }, {
10704
11065
  key: "updateSegment",
10705
11066
  value: function () {
10706
- var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(id, data) {
11067
+ var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
10707
11068
  var _yield$this$put, segment;
10708
11069
 
10709
- return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
11070
+ return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
10710
11071
  while (1) {
10711
- switch (_context63.prev = _context63.next) {
11072
+ switch (_context66.prev = _context66.next) {
10712
11073
  case 0:
10713
- _context63.next = 2;
11074
+ _context66.next = 2;
10714
11075
  return this.put(this.baseURL + "/segments/".concat(id), data);
10715
11076
 
10716
11077
  case 2:
10717
- _yield$this$put = _context63.sent;
11078
+ _yield$this$put = _context66.sent;
10718
11079
  segment = _yield$this$put.segment;
10719
- return _context63.abrupt("return", segment);
11080
+ return _context66.abrupt("return", segment);
10720
11081
 
10721
11082
  case 5:
10722
11083
  case "end":
10723
- return _context63.stop();
11084
+ return _context66.stop();
10724
11085
  }
10725
11086
  }
10726
- }, _callee63, this);
11087
+ }, _callee66, this);
10727
11088
  }));
10728
11089
 
10729
- function updateSegment(_x90, _x91) {
11090
+ function updateSegment(_x94, _x95) {
10730
11091
  return _updateSegment.apply(this, arguments);
10731
11092
  }
10732
11093
 
@@ -10744,30 +11105,30 @@ var StreamChat = /*#__PURE__*/function () {
10744
11105
  }, {
10745
11106
  key: "addSegmentTargets",
10746
11107
  value: function () {
10747
- var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, targets) {
11108
+ var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id, targets) {
10748
11109
  var body;
10749
- return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
11110
+ return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
10750
11111
  while (1) {
10751
- switch (_context64.prev = _context64.next) {
11112
+ switch (_context67.prev = _context67.next) {
10752
11113
  case 0:
10753
11114
  body = {
10754
11115
  targets: targets
10755
11116
  };
10756
- _context64.next = 3;
11117
+ _context67.next = 3;
10757
11118
  return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
10758
11119
 
10759
11120
  case 3:
10760
- return _context64.abrupt("return", _context64.sent);
11121
+ return _context67.abrupt("return", _context67.sent);
10761
11122
 
10762
11123
  case 4:
10763
11124
  case "end":
10764
- return _context64.stop();
11125
+ return _context67.stop();
10765
11126
  }
10766
11127
  }
10767
- }, _callee64, this);
11128
+ }, _callee67, this);
10768
11129
  }));
10769
11130
 
10770
- function addSegmentTargets(_x92, _x93) {
11131
+ function addSegmentTargets(_x96, _x97) {
10771
11132
  return _addSegmentTargets.apply(this, arguments);
10772
11133
  }
10773
11134
 
@@ -10785,30 +11146,30 @@ var StreamChat = /*#__PURE__*/function () {
10785
11146
  }, {
10786
11147
  key: "deleteSegmentTargets",
10787
11148
  value: function () {
10788
- var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, targets) {
11149
+ var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(id, targets) {
10789
11150
  var body;
10790
- return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
11151
+ return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
10791
11152
  while (1) {
10792
- switch (_context65.prev = _context65.next) {
11153
+ switch (_context68.prev = _context68.next) {
10793
11154
  case 0:
10794
11155
  body = {
10795
11156
  targets: targets
10796
11157
  };
10797
- _context65.next = 3;
11158
+ _context68.next = 3;
10798
11159
  return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
10799
11160
 
10800
11161
  case 3:
10801
- return _context65.abrupt("return", _context65.sent);
11162
+ return _context68.abrupt("return", _context68.sent);
10802
11163
 
10803
11164
  case 4:
10804
11165
  case "end":
10805
- return _context65.stop();
11166
+ return _context68.stop();
10806
11167
  }
10807
11168
  }
10808
- }, _callee65, this);
11169
+ }, _callee68, this);
10809
11170
  }));
10810
11171
 
10811
- function deleteSegmentTargets(_x94, _x95) {
11172
+ function deleteSegmentTargets(_x98, _x99) {
10812
11173
  return _deleteSegmentTargets.apply(this, arguments);
10813
11174
  }
10814
11175
 
@@ -10826,15 +11187,15 @@ var StreamChat = /*#__PURE__*/function () {
10826
11187
  }, {
10827
11188
  key: "querySegments",
10828
11189
  value: function () {
10829
- var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(filter) {
11190
+ var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(filter) {
10830
11191
  var options,
10831
- _args66 = arguments;
10832
- return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
11192
+ _args69 = arguments;
11193
+ return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
10833
11194
  while (1) {
10834
- switch (_context66.prev = _context66.next) {
11195
+ switch (_context69.prev = _context69.next) {
10835
11196
  case 0:
10836
- options = _args66.length > 1 && _args66[1] !== undefined ? _args66[1] : {};
10837
- _context66.next = 3;
11197
+ options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11198
+ _context69.next = 3;
10838
11199
  return this.get(this.baseURL + "/segments", {
10839
11200
  payload: _objectSpread({
10840
11201
  filter: filter
@@ -10842,17 +11203,17 @@ var StreamChat = /*#__PURE__*/function () {
10842
11203
  });
10843
11204
 
10844
11205
  case 3:
10845
- return _context66.abrupt("return", _context66.sent);
11206
+ return _context69.abrupt("return", _context69.sent);
10846
11207
 
10847
11208
  case 4:
10848
11209
  case "end":
10849
- return _context66.stop();
11210
+ return _context69.stop();
10850
11211
  }
10851
11212
  }
10852
- }, _callee66, this);
11213
+ }, _callee69, this);
10853
11214
  }));
10854
11215
 
10855
- function querySegments(_x96) {
11216
+ function querySegments(_x100) {
10856
11217
  return _querySegments.apply(this, arguments);
10857
11218
  }
10858
11219
 
@@ -10869,26 +11230,26 @@ var StreamChat = /*#__PURE__*/function () {
10869
11230
  }, {
10870
11231
  key: "deleteSegment",
10871
11232
  value: function () {
10872
- var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id) {
10873
- return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
11233
+ var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(id) {
11234
+ return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
10874
11235
  while (1) {
10875
- switch (_context67.prev = _context67.next) {
11236
+ switch (_context70.prev = _context70.next) {
10876
11237
  case 0:
10877
- _context67.next = 2;
11238
+ _context70.next = 2;
10878
11239
  return this.delete(this.baseURL + "/segments/".concat(id));
10879
11240
 
10880
11241
  case 2:
10881
- return _context67.abrupt("return", _context67.sent);
11242
+ return _context70.abrupt("return", _context70.sent);
10882
11243
 
10883
11244
  case 3:
10884
11245
  case "end":
10885
- return _context67.stop();
11246
+ return _context70.stop();
10886
11247
  }
10887
11248
  }
10888
- }, _callee67, this);
11249
+ }, _callee70, this);
10889
11250
  }));
10890
11251
 
10891
- function deleteSegment(_x97) {
11252
+ function deleteSegment(_x101) {
10892
11253
  return _deleteSegment.apply(this, arguments);
10893
11254
  }
10894
11255
 
@@ -10906,26 +11267,26 @@ var StreamChat = /*#__PURE__*/function () {
10906
11267
  }, {
10907
11268
  key: "segmentTargetExists",
10908
11269
  value: function () {
10909
- var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(segmentId, targetId) {
10910
- return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
11270
+ var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(segmentId, targetId) {
11271
+ return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
10911
11272
  while (1) {
10912
- switch (_context68.prev = _context68.next) {
11273
+ switch (_context71.prev = _context71.next) {
10913
11274
  case 0:
10914
- _context68.next = 2;
11275
+ _context71.next = 2;
10915
11276
  return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
10916
11277
 
10917
11278
  case 2:
10918
- return _context68.abrupt("return", _context68.sent);
11279
+ return _context71.abrupt("return", _context71.sent);
10919
11280
 
10920
11281
  case 3:
10921
11282
  case "end":
10922
- return _context68.stop();
11283
+ return _context71.stop();
10923
11284
  }
10924
11285
  }
10925
- }, _callee68, this);
11286
+ }, _callee71, this);
10926
11287
  }));
10927
11288
 
10928
- function segmentTargetExists(_x98, _x99) {
11289
+ function segmentTargetExists(_x102, _x103) {
10929
11290
  return _segmentTargetExists.apply(this, arguments);
10930
11291
  }
10931
11292
 
@@ -10942,32 +11303,32 @@ var StreamChat = /*#__PURE__*/function () {
10942
11303
  }, {
10943
11304
  key: "createCampaign",
10944
11305
  value: function () {
10945
- var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(params) {
11306
+ var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(params) {
10946
11307
  var _yield$this$post2, campaign;
10947
11308
 
10948
- return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
11309
+ return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
10949
11310
  while (1) {
10950
- switch (_context69.prev = _context69.next) {
11311
+ switch (_context72.prev = _context72.next) {
10951
11312
  case 0:
10952
- _context69.next = 2;
11313
+ _context72.next = 2;
10953
11314
  return this.post(this.baseURL + "/campaigns", {
10954
11315
  campaign: params
10955
11316
  });
10956
11317
 
10957
11318
  case 2:
10958
- _yield$this$post2 = _context69.sent;
11319
+ _yield$this$post2 = _context72.sent;
10959
11320
  campaign = _yield$this$post2.campaign;
10960
- return _context69.abrupt("return", campaign);
11321
+ return _context72.abrupt("return", campaign);
10961
11322
 
10962
11323
  case 5:
10963
11324
  case "end":
10964
- return _context69.stop();
11325
+ return _context72.stop();
10965
11326
  }
10966
11327
  }
10967
- }, _callee69, this);
11328
+ }, _callee72, this);
10968
11329
  }));
10969
11330
 
10970
- function createCampaign(_x100) {
11331
+ function createCampaign(_x104) {
10971
11332
  return _createCampaign.apply(this, arguments);
10972
11333
  }
10973
11334
 
@@ -10983,15 +11344,15 @@ var StreamChat = /*#__PURE__*/function () {
10983
11344
  }, {
10984
11345
  key: "queryCampaigns",
10985
11346
  value: function () {
10986
- var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(filters) {
11347
+ var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(filters) {
10987
11348
  var options,
10988
- _args70 = arguments;
10989
- return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
11349
+ _args73 = arguments;
11350
+ return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
10990
11351
  while (1) {
10991
- switch (_context70.prev = _context70.next) {
11352
+ switch (_context73.prev = _context73.next) {
10992
11353
  case 0:
10993
- options = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {};
10994
- _context70.next = 3;
11354
+ options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11355
+ _context73.next = 3;
10995
11356
  return this.get(this.baseURL + "/campaigns", {
10996
11357
  payload: _objectSpread({
10997
11358
  filter_conditions: filters
@@ -10999,17 +11360,17 @@ var StreamChat = /*#__PURE__*/function () {
10999
11360
  });
11000
11361
 
11001
11362
  case 3:
11002
- return _context70.abrupt("return", _context70.sent);
11363
+ return _context73.abrupt("return", _context73.sent);
11003
11364
 
11004
11365
  case 4:
11005
11366
  case "end":
11006
- return _context70.stop();
11367
+ return _context73.stop();
11007
11368
  }
11008
11369
  }
11009
- }, _callee70, this);
11370
+ }, _callee73, this);
11010
11371
  }));
11011
11372
 
11012
- function queryCampaigns(_x101) {
11373
+ function queryCampaigns(_x105) {
11013
11374
  return _queryCampaigns.apply(this, arguments);
11014
11375
  }
11015
11376
 
@@ -11027,32 +11388,32 @@ var StreamChat = /*#__PURE__*/function () {
11027
11388
  }, {
11028
11389
  key: "updateCampaign",
11029
11390
  value: function () {
11030
- var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(id, params) {
11391
+ var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id, params) {
11031
11392
  var _yield$this$put2, campaign;
11032
11393
 
11033
- return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
11394
+ return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11034
11395
  while (1) {
11035
- switch (_context71.prev = _context71.next) {
11396
+ switch (_context74.prev = _context74.next) {
11036
11397
  case 0:
11037
- _context71.next = 2;
11398
+ _context74.next = 2;
11038
11399
  return this.put(this.baseURL + "/campaigns/".concat(id), {
11039
11400
  campaign: params
11040
11401
  });
11041
11402
 
11042
11403
  case 2:
11043
- _yield$this$put2 = _context71.sent;
11404
+ _yield$this$put2 = _context74.sent;
11044
11405
  campaign = _yield$this$put2.campaign;
11045
- return _context71.abrupt("return", campaign);
11406
+ return _context74.abrupt("return", campaign);
11046
11407
 
11047
11408
  case 5:
11048
11409
  case "end":
11049
- return _context71.stop();
11410
+ return _context74.stop();
11050
11411
  }
11051
11412
  }
11052
- }, _callee71, this);
11413
+ }, _callee74, this);
11053
11414
  }));
11054
11415
 
11055
- function updateCampaign(_x102, _x103) {
11416
+ function updateCampaign(_x106, _x107) {
11056
11417
  return _updateCampaign.apply(this, arguments);
11057
11418
  }
11058
11419
 
@@ -11069,25 +11430,25 @@ var StreamChat = /*#__PURE__*/function () {
11069
11430
  }, {
11070
11431
  key: "deleteCampaign",
11071
11432
  value: function () {
11072
- var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(id) {
11433
+ var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11073
11434
  var params,
11074
- _args72 = arguments;
11075
- return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
11435
+ _args75 = arguments;
11436
+ return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11076
11437
  while (1) {
11077
- switch (_context72.prev = _context72.next) {
11438
+ switch (_context75.prev = _context75.next) {
11078
11439
  case 0:
11079
- params = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {};
11080
- return _context72.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11440
+ params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11441
+ return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11081
11442
 
11082
11443
  case 2:
11083
11444
  case "end":
11084
- return _context72.stop();
11445
+ return _context75.stop();
11085
11446
  }
11086
11447
  }
11087
- }, _callee72, this);
11448
+ }, _callee75, this);
11088
11449
  }));
11089
11450
 
11090
- function deleteCampaign(_x104) {
11451
+ function deleteCampaign(_x108) {
11091
11452
  return _deleteCampaign.apply(this, arguments);
11092
11453
  }
11093
11454
 
@@ -11105,33 +11466,33 @@ var StreamChat = /*#__PURE__*/function () {
11105
11466
  }, {
11106
11467
  key: "scheduleCampaign",
11107
11468
  value: function () {
11108
- var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(id, params) {
11469
+ var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11109
11470
  var scheduledFor, _yield$this$patch, campaign;
11110
11471
 
11111
- return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
11472
+ return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11112
11473
  while (1) {
11113
- switch (_context73.prev = _context73.next) {
11474
+ switch (_context76.prev = _context76.next) {
11114
11475
  case 0:
11115
11476
  scheduledFor = params.scheduledFor;
11116
- _context73.next = 3;
11477
+ _context76.next = 3;
11117
11478
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
11118
11479
  scheduled_for: scheduledFor
11119
11480
  });
11120
11481
 
11121
11482
  case 3:
11122
- _yield$this$patch = _context73.sent;
11483
+ _yield$this$patch = _context76.sent;
11123
11484
  campaign = _yield$this$patch.campaign;
11124
- return _context73.abrupt("return", campaign);
11485
+ return _context76.abrupt("return", campaign);
11125
11486
 
11126
11487
  case 6:
11127
11488
  case "end":
11128
- return _context73.stop();
11489
+ return _context76.stop();
11129
11490
  }
11130
11491
  }
11131
- }, _callee73, this);
11492
+ }, _callee76, this);
11132
11493
  }));
11133
11494
 
11134
- function scheduleCampaign(_x105, _x106) {
11495
+ function scheduleCampaign(_x109, _x110) {
11135
11496
  return _scheduleCampaign.apply(this, arguments);
11136
11497
  }
11137
11498
 
@@ -11148,30 +11509,30 @@ var StreamChat = /*#__PURE__*/function () {
11148
11509
  }, {
11149
11510
  key: "stopCampaign",
11150
11511
  value: function () {
11151
- var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id) {
11512
+ var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(id) {
11152
11513
  var _yield$this$patch2, campaign;
11153
11514
 
11154
- return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11515
+ return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11155
11516
  while (1) {
11156
- switch (_context74.prev = _context74.next) {
11517
+ switch (_context77.prev = _context77.next) {
11157
11518
  case 0:
11158
- _context74.next = 2;
11519
+ _context77.next = 2;
11159
11520
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
11160
11521
 
11161
11522
  case 2:
11162
- _yield$this$patch2 = _context74.sent;
11523
+ _yield$this$patch2 = _context77.sent;
11163
11524
  campaign = _yield$this$patch2.campaign;
11164
- return _context74.abrupt("return", campaign);
11525
+ return _context77.abrupt("return", campaign);
11165
11526
 
11166
11527
  case 5:
11167
11528
  case "end":
11168
- return _context74.stop();
11529
+ return _context77.stop();
11169
11530
  }
11170
11531
  }
11171
- }, _callee74, this);
11532
+ }, _callee77, this);
11172
11533
  }));
11173
11534
 
11174
- function stopCampaign(_x107) {
11535
+ function stopCampaign(_x111) {
11175
11536
  return _stopCampaign.apply(this, arguments);
11176
11537
  }
11177
11538
 
@@ -11188,30 +11549,30 @@ var StreamChat = /*#__PURE__*/function () {
11188
11549
  }, {
11189
11550
  key: "resumeCampaign",
11190
11551
  value: function () {
11191
- var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11552
+ var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11192
11553
  var _yield$this$patch3, campaign;
11193
11554
 
11194
- return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11555
+ return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11195
11556
  while (1) {
11196
- switch (_context75.prev = _context75.next) {
11557
+ switch (_context78.prev = _context78.next) {
11197
11558
  case 0:
11198
- _context75.next = 2;
11559
+ _context78.next = 2;
11199
11560
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
11200
11561
 
11201
11562
  case 2:
11202
- _yield$this$patch3 = _context75.sent;
11563
+ _yield$this$patch3 = _context78.sent;
11203
11564
  campaign = _yield$this$patch3.campaign;
11204
- return _context75.abrupt("return", campaign);
11565
+ return _context78.abrupt("return", campaign);
11205
11566
 
11206
11567
  case 5:
11207
11568
  case "end":
11208
- return _context75.stop();
11569
+ return _context78.stop();
11209
11570
  }
11210
11571
  }
11211
- }, _callee75, this);
11572
+ }, _callee78, this);
11212
11573
  }));
11213
11574
 
11214
- function resumeCampaign(_x108) {
11575
+ function resumeCampaign(_x112) {
11215
11576
  return _resumeCampaign.apply(this, arguments);
11216
11577
  }
11217
11578
 
@@ -11229,30 +11590,30 @@ var StreamChat = /*#__PURE__*/function () {
11229
11590
  }, {
11230
11591
  key: "testCampaign",
11231
11592
  value: function () {
11232
- var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11593
+ var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(id, params) {
11233
11594
  var users;
11234
- return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11595
+ return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11235
11596
  while (1) {
11236
- switch (_context76.prev = _context76.next) {
11597
+ switch (_context79.prev = _context79.next) {
11237
11598
  case 0:
11238
11599
  users = params.users;
11239
- _context76.next = 3;
11600
+ _context79.next = 3;
11240
11601
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
11241
11602
  users: users
11242
11603
  });
11243
11604
 
11244
11605
  case 3:
11245
- return _context76.abrupt("return", _context76.sent);
11606
+ return _context79.abrupt("return", _context79.sent);
11246
11607
 
11247
11608
  case 4:
11248
11609
  case "end":
11249
- return _context76.stop();
11610
+ return _context79.stop();
11250
11611
  }
11251
11612
  }
11252
- }, _callee76, this);
11613
+ }, _callee79, this);
11253
11614
  }));
11254
11615
 
11255
- function testCampaign(_x109, _x110) {
11616
+ function testCampaign(_x113, _x114) {
11256
11617
  return _testCampaign.apply(this, arguments);
11257
11618
  }
11258
11619
 
@@ -11268,24 +11629,24 @@ var StreamChat = /*#__PURE__*/function () {
11268
11629
  }, {
11269
11630
  key: "enrichURL",
11270
11631
  value: function () {
11271
- var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(url) {
11272
- return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11632
+ var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(url) {
11633
+ return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11273
11634
  while (1) {
11274
- switch (_context77.prev = _context77.next) {
11635
+ switch (_context80.prev = _context80.next) {
11275
11636
  case 0:
11276
- return _context77.abrupt("return", this.get(this.baseURL + "/og", {
11637
+ return _context80.abrupt("return", this.get(this.baseURL + "/og", {
11277
11638
  url: url
11278
11639
  }));
11279
11640
 
11280
11641
  case 1:
11281
11642
  case "end":
11282
- return _context77.stop();
11643
+ return _context80.stop();
11283
11644
  }
11284
11645
  }
11285
- }, _callee77, this);
11646
+ }, _callee80, this);
11286
11647
  }));
11287
11648
 
11288
- function enrichURL(_x111) {
11649
+ function enrichURL(_x115) {
11289
11650
  return _enrichURL.apply(this, arguments);
11290
11651
  }
11291
11652
 
@@ -11302,22 +11663,22 @@ var StreamChat = /*#__PURE__*/function () {
11302
11663
  }, {
11303
11664
  key: "getTask",
11304
11665
  value: function () {
11305
- var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11306
- return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11666
+ var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
11667
+ return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11307
11668
  while (1) {
11308
- switch (_context78.prev = _context78.next) {
11669
+ switch (_context81.prev = _context81.next) {
11309
11670
  case 0:
11310
- return _context78.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11671
+ return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11311
11672
 
11312
11673
  case 1:
11313
11674
  case "end":
11314
- return _context78.stop();
11675
+ return _context81.stop();
11315
11676
  }
11316
11677
  }
11317
- }, _callee78, this);
11678
+ }, _callee81, this);
11318
11679
  }));
11319
11680
 
11320
- function getTask(_x112) {
11681
+ function getTask(_x116) {
11321
11682
  return _getTask.apply(this, arguments);
11322
11683
  }
11323
11684
 
@@ -11335,31 +11696,31 @@ var StreamChat = /*#__PURE__*/function () {
11335
11696
  }, {
11336
11697
  key: "deleteChannels",
11337
11698
  value: function () {
11338
- var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(cids) {
11699
+ var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(cids) {
11339
11700
  var options,
11340
- _args79 = arguments;
11341
- return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11701
+ _args82 = arguments;
11702
+ return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11342
11703
  while (1) {
11343
- switch (_context79.prev = _context79.next) {
11704
+ switch (_context82.prev = _context82.next) {
11344
11705
  case 0:
11345
- options = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {};
11346
- _context79.next = 3;
11706
+ options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11707
+ _context82.next = 3;
11347
11708
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11348
11709
  cids: cids
11349
11710
  }, options));
11350
11711
 
11351
11712
  case 3:
11352
- return _context79.abrupt("return", _context79.sent);
11713
+ return _context82.abrupt("return", _context82.sent);
11353
11714
 
11354
11715
  case 4:
11355
11716
  case "end":
11356
- return _context79.stop();
11717
+ return _context82.stop();
11357
11718
  }
11358
11719
  }
11359
- }, _callee79, this);
11720
+ }, _callee82, this);
11360
11721
  }));
11361
11722
 
11362
- function deleteChannels(_x113) {
11723
+ function deleteChannels(_x117) {
11363
11724
  return _deleteChannels.apply(this, arguments);
11364
11725
  }
11365
11726
 
@@ -11377,17 +11738,17 @@ var StreamChat = /*#__PURE__*/function () {
11377
11738
  }, {
11378
11739
  key: "deleteUsers",
11379
11740
  value: function () {
11380
- var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(user_ids) {
11741
+ var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(user_ids) {
11381
11742
  var options,
11382
- _args80 = arguments;
11383
- return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11743
+ _args83 = arguments;
11744
+ return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11384
11745
  while (1) {
11385
- switch (_context80.prev = _context80.next) {
11746
+ switch (_context83.prev = _context83.next) {
11386
11747
  case 0:
11387
- options = _args80.length > 1 && _args80[1] !== undefined ? _args80[1] : {};
11748
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
11388
11749
 
11389
11750
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11390
- _context80.next = 3;
11751
+ _context83.next = 3;
11391
11752
  break;
11392
11753
  }
11393
11754
 
@@ -11395,7 +11756,7 @@ var StreamChat = /*#__PURE__*/function () {
11395
11756
 
11396
11757
  case 3:
11397
11758
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11398
- _context80.next = 5;
11759
+ _context83.next = 5;
11399
11760
  break;
11400
11761
  }
11401
11762
 
@@ -11403,30 +11764,30 @@ var StreamChat = /*#__PURE__*/function () {
11403
11764
 
11404
11765
  case 5:
11405
11766
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11406
- _context80.next = 7;
11767
+ _context83.next = 7;
11407
11768
  break;
11408
11769
  }
11409
11770
 
11410
11771
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11411
11772
 
11412
11773
  case 7:
11413
- _context80.next = 9;
11774
+ _context83.next = 9;
11414
11775
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11415
11776
  user_ids: user_ids
11416
11777
  }, options));
11417
11778
 
11418
11779
  case 9:
11419
- return _context80.abrupt("return", _context80.sent);
11780
+ return _context83.abrupt("return", _context83.sent);
11420
11781
 
11421
11782
  case 10:
11422
11783
  case "end":
11423
- return _context80.stop();
11784
+ return _context83.stop();
11424
11785
  }
11425
11786
  }
11426
- }, _callee80, this);
11787
+ }, _callee83, this);
11427
11788
  }));
11428
11789
 
11429
- function deleteUsers(_x114) {
11790
+ function deleteUsers(_x118) {
11430
11791
  return _deleteUsers.apply(this, arguments);
11431
11792
  }
11432
11793
 
@@ -11447,28 +11808,28 @@ var StreamChat = /*#__PURE__*/function () {
11447
11808
  }, {
11448
11809
  key: "_createImportURL",
11449
11810
  value: function () {
11450
- var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(filename) {
11451
- return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11811
+ var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(filename) {
11812
+ return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11452
11813
  while (1) {
11453
- switch (_context81.prev = _context81.next) {
11814
+ switch (_context84.prev = _context84.next) {
11454
11815
  case 0:
11455
- _context81.next = 2;
11816
+ _context84.next = 2;
11456
11817
  return this.post(this.baseURL + "/import_urls", {
11457
11818
  filename: filename
11458
11819
  });
11459
11820
 
11460
11821
  case 2:
11461
- return _context81.abrupt("return", _context81.sent);
11822
+ return _context84.abrupt("return", _context84.sent);
11462
11823
 
11463
11824
  case 3:
11464
11825
  case "end":
11465
- return _context81.stop();
11826
+ return _context84.stop();
11466
11827
  }
11467
11828
  }
11468
- }, _callee81, this);
11829
+ }, _callee84, this);
11469
11830
  }));
11470
11831
 
11471
- function _createImportURL(_x115) {
11832
+ function _createImportURL(_x119) {
11472
11833
  return _createImportURL2.apply(this, arguments);
11473
11834
  }
11474
11835
 
@@ -11490,33 +11851,33 @@ var StreamChat = /*#__PURE__*/function () {
11490
11851
  }, {
11491
11852
  key: "_createImport",
11492
11853
  value: function () {
11493
- var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(path) {
11854
+ var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(path) {
11494
11855
  var options,
11495
- _args82 = arguments;
11496
- return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11856
+ _args85 = arguments;
11857
+ return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11497
11858
  while (1) {
11498
- switch (_context82.prev = _context82.next) {
11859
+ switch (_context85.prev = _context85.next) {
11499
11860
  case 0:
11500
- options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {
11861
+ options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
11501
11862
  mode: 'upsert'
11502
11863
  };
11503
- _context82.next = 3;
11864
+ _context85.next = 3;
11504
11865
  return this.post(this.baseURL + "/imports", _objectSpread({
11505
11866
  path: path
11506
11867
  }, options));
11507
11868
 
11508
11869
  case 3:
11509
- return _context82.abrupt("return", _context82.sent);
11870
+ return _context85.abrupt("return", _context85.sent);
11510
11871
 
11511
11872
  case 4:
11512
11873
  case "end":
11513
- return _context82.stop();
11874
+ return _context85.stop();
11514
11875
  }
11515
11876
  }
11516
- }, _callee82, this);
11877
+ }, _callee85, this);
11517
11878
  }));
11518
11879
 
11519
- function _createImport(_x116) {
11880
+ function _createImport(_x120) {
11520
11881
  return _createImport2.apply(this, arguments);
11521
11882
  }
11522
11883
 
@@ -11538,26 +11899,26 @@ var StreamChat = /*#__PURE__*/function () {
11538
11899
  }, {
11539
11900
  key: "_getImport",
11540
11901
  value: function () {
11541
- var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(id) {
11542
- return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11902
+ var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(id) {
11903
+ return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
11543
11904
  while (1) {
11544
- switch (_context83.prev = _context83.next) {
11905
+ switch (_context86.prev = _context86.next) {
11545
11906
  case 0:
11546
- _context83.next = 2;
11907
+ _context86.next = 2;
11547
11908
  return this.get(this.baseURL + "/imports/".concat(id));
11548
11909
 
11549
11910
  case 2:
11550
- return _context83.abrupt("return", _context83.sent);
11911
+ return _context86.abrupt("return", _context86.sent);
11551
11912
 
11552
11913
  case 3:
11553
11914
  case "end":
11554
- return _context83.stop();
11915
+ return _context86.stop();
11555
11916
  }
11556
11917
  }
11557
- }, _callee83, this);
11918
+ }, _callee86, this);
11558
11919
  }));
11559
11920
 
11560
- function _getImport(_x117) {
11921
+ function _getImport(_x121) {
11561
11922
  return _getImport2.apply(this, arguments);
11562
11923
  }
11563
11924
 
@@ -11579,26 +11940,26 @@ var StreamChat = /*#__PURE__*/function () {
11579
11940
  }, {
11580
11941
  key: "_listImports",
11581
11942
  value: function () {
11582
- var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(options) {
11583
- return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11943
+ var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87(options) {
11944
+ return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
11584
11945
  while (1) {
11585
- switch (_context84.prev = _context84.next) {
11946
+ switch (_context87.prev = _context87.next) {
11586
11947
  case 0:
11587
- _context84.next = 2;
11948
+ _context87.next = 2;
11588
11949
  return this.get(this.baseURL + "/imports", options);
11589
11950
 
11590
11951
  case 2:
11591
- return _context84.abrupt("return", _context84.sent);
11952
+ return _context87.abrupt("return", _context87.sent);
11592
11953
 
11593
11954
  case 3:
11594
11955
  case "end":
11595
- return _context84.stop();
11956
+ return _context87.stop();
11596
11957
  }
11597
11958
  }
11598
- }, _callee84, this);
11959
+ }, _callee87, this);
11599
11960
  }));
11600
11961
 
11601
- function _listImports(_x118) {
11962
+ function _listImports(_x122) {
11602
11963
  return _listImports2.apply(this, arguments);
11603
11964
  }
11604
11965
 
@@ -11617,28 +11978,28 @@ var StreamChat = /*#__PURE__*/function () {
11617
11978
  }, {
11618
11979
  key: "upsertPushProvider",
11619
11980
  value: function () {
11620
- var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(pushProvider) {
11621
- return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11981
+ var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(pushProvider) {
11982
+ return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
11622
11983
  while (1) {
11623
- switch (_context85.prev = _context85.next) {
11984
+ switch (_context88.prev = _context88.next) {
11624
11985
  case 0:
11625
- _context85.next = 2;
11986
+ _context88.next = 2;
11626
11987
  return this.post(this.baseURL + "/push_providers", {
11627
11988
  push_provider: pushProvider
11628
11989
  });
11629
11990
 
11630
11991
  case 2:
11631
- return _context85.abrupt("return", _context85.sent);
11992
+ return _context88.abrupt("return", _context88.sent);
11632
11993
 
11633
11994
  case 3:
11634
11995
  case "end":
11635
- return _context85.stop();
11996
+ return _context88.stop();
11636
11997
  }
11637
11998
  }
11638
- }, _callee85, this);
11999
+ }, _callee88, this);
11639
12000
  }));
11640
12001
 
11641
- function upsertPushProvider(_x119) {
12002
+ function upsertPushProvider(_x123) {
11642
12003
  return _upsertPushProvider.apply(this, arguments);
11643
12004
  }
11644
12005
 
@@ -11657,28 +12018,28 @@ var StreamChat = /*#__PURE__*/function () {
11657
12018
  }, {
11658
12019
  key: "deletePushProvider",
11659
12020
  value: function () {
11660
- var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(_ref10) {
12021
+ var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee89(_ref10) {
11661
12022
  var type, name;
11662
- return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
12023
+ return _regeneratorRuntime__default['default'].wrap(function _callee89$(_context89) {
11663
12024
  while (1) {
11664
- switch (_context86.prev = _context86.next) {
12025
+ switch (_context89.prev = _context89.next) {
11665
12026
  case 0:
11666
12027
  type = _ref10.type, name = _ref10.name;
11667
- _context86.next = 3;
12028
+ _context89.next = 3;
11668
12029
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11669
12030
 
11670
12031
  case 3:
11671
- return _context86.abrupt("return", _context86.sent);
12032
+ return _context89.abrupt("return", _context89.sent);
11672
12033
 
11673
12034
  case 4:
11674
12035
  case "end":
11675
- return _context86.stop();
12036
+ return _context89.stop();
11676
12037
  }
11677
12038
  }
11678
- }, _callee86, this);
12039
+ }, _callee89, this);
11679
12040
  }));
11680
12041
 
11681
- function deletePushProvider(_x120) {
12042
+ function deletePushProvider(_x124) {
11682
12043
  return _deletePushProvider.apply(this, arguments);
11683
12044
  }
11684
12045
 
@@ -11695,23 +12056,23 @@ var StreamChat = /*#__PURE__*/function () {
11695
12056
  }, {
11696
12057
  key: "listPushProviders",
11697
12058
  value: function () {
11698
- var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87() {
11699
- return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
12059
+ var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee90() {
12060
+ return _regeneratorRuntime__default['default'].wrap(function _callee90$(_context90) {
11700
12061
  while (1) {
11701
- switch (_context87.prev = _context87.next) {
12062
+ switch (_context90.prev = _context90.next) {
11702
12063
  case 0:
11703
- _context87.next = 2;
12064
+ _context90.next = 2;
11704
12065
  return this.get(this.baseURL + "/push_providers");
11705
12066
 
11706
12067
  case 2:
11707
- return _context87.abrupt("return", _context87.sent);
12068
+ return _context90.abrupt("return", _context90.sent);
11708
12069
 
11709
12070
  case 3:
11710
12071
  case "end":
11711
- return _context87.stop();
12072
+ return _context90.stop();
11712
12073
  }
11713
12074
  }
11714
- }, _callee87, this);
12075
+ }, _callee90, this);
11715
12076
  }));
11716
12077
 
11717
12078
  function listPushProviders() {
@@ -11739,26 +12100,26 @@ var StreamChat = /*#__PURE__*/function () {
11739
12100
  }, {
11740
12101
  key: "commitMessage",
11741
12102
  value: function () {
11742
- var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(id) {
11743
- return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
12103
+ var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee91(id) {
12104
+ return _regeneratorRuntime__default['default'].wrap(function _callee91$(_context91) {
11744
12105
  while (1) {
11745
- switch (_context88.prev = _context88.next) {
12106
+ switch (_context91.prev = _context91.next) {
11746
12107
  case 0:
11747
- _context88.next = 2;
12108
+ _context91.next = 2;
11748
12109
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
11749
12110
 
11750
12111
  case 2:
11751
- return _context88.abrupt("return", _context88.sent);
12112
+ return _context91.abrupt("return", _context91.sent);
11752
12113
 
11753
12114
  case 3:
11754
12115
  case "end":
11755
- return _context88.stop();
12116
+ return _context91.stop();
11756
12117
  }
11757
12118
  }
11758
- }, _callee88, this);
12119
+ }, _callee91, this);
11759
12120
  }));
11760
12121
 
11761
- function commitMessage(_x121) {
12122
+ function commitMessage(_x125) {
11762
12123
  return _commitMessage.apply(this, arguments);
11763
12124
  }
11764
12125
 
@@ -11814,6 +12175,7 @@ var EVENT_MAP = {
11814
12175
  'notification.message_new': true,
11815
12176
  'notification.mutes_updated': true,
11816
12177
  'notification.removed_from_channel': true,
12178
+ 'notification.thread_message_new': true,
11817
12179
  'reaction.deleted': true,
11818
12180
  'reaction.new': true,
11819
12181
  'reaction.updated': true,
@@ -11932,6 +12294,7 @@ exports.MinPriority = MinPriority;
11932
12294
  exports.Permission = Permission;
11933
12295
  exports.StableWSConnection = StableWSConnection;
11934
12296
  exports.StreamChat = StreamChat;
12297
+ exports.Thread = Thread;
11935
12298
  exports.TokenManager = TokenManager;
11936
12299
  exports.UserFromToken = UserFromToken;
11937
12300
  exports.buildWsFatalInsight = buildWsFatalInsight;
@@ -11939,6 +12302,7 @@ exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
11939
12302
  exports.chatCodes = chatCodes;
11940
12303
  exports.decodeBase64 = decodeBase64;
11941
12304
  exports.encodeBase64 = encodeBase64;
12305
+ exports.formatMessage = formatMessage;
11942
12306
  exports.isOwnUser = isOwnUser;
11943
12307
  exports.logChatPromiseExecution = logChatPromiseExecution;
11944
12308
  exports.postInsights = postInsights;