stream-chat 8.15.0 → 8.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -122,9 +122,347 @@ var decodeBase64 = function decodeBase64(s) {
122
122
  return r;
123
123
  };
124
124
 
125
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
125
+ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
126
126
 
127
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
127
+ function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
128
+
129
+ function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
130
+
131
+ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
132
+
133
+ function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
134
+
135
+ /**
136
+ * logChatPromiseExecution - utility function for logging the execution of a promise..
137
+ * use this when you want to run the promise and handle errors by logging a warning
138
+ *
139
+ * @param {Promise<T>} promise The promise you want to run and log
140
+ * @param {string} name A descriptive name of what the promise does for log output
141
+ *
142
+ */
143
+ function logChatPromiseExecution(promise, name) {
144
+ promise.then().catch(function (error) {
145
+ console.warn("failed to do ".concat(name, ", ran into error: "), error);
146
+ });
147
+ }
148
+ var sleep = function sleep(m) {
149
+ return new Promise(function (r) {
150
+ return setTimeout(r, m);
151
+ });
152
+ };
153
+ function isFunction(value) {
154
+ return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
155
+ }
156
+ var chatCodes = {
157
+ TOKEN_EXPIRED: 40,
158
+ WS_CLOSED_SUCCESS: 1000
159
+ };
160
+
161
+ function isReadableStream(obj) {
162
+ return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
163
+ }
164
+
165
+ function isBuffer(obj) {
166
+ return obj != null && obj.constructor != null && // @ts-expect-error
167
+ typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
168
+ obj.constructor.isBuffer(obj);
169
+ }
170
+
171
+ function isFileWebAPI(uri) {
172
+ return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
173
+ }
174
+
175
+ function isOwnUser(user) {
176
+ return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
177
+ }
178
+
179
+ function isBlobWebAPI(uri) {
180
+ return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
181
+ }
182
+
183
+ function isOwnUserBaseProperty(property) {
184
+ var ownUserBaseProperties = {
185
+ channel_mutes: true,
186
+ devices: true,
187
+ mutes: true,
188
+ total_unread_count: true,
189
+ unread_channels: true,
190
+ unread_count: true,
191
+ invisible: true,
192
+ roles: true
193
+ };
194
+ return ownUserBaseProperties[property];
195
+ }
196
+ function addFileToFormData(uri, name, contentType) {
197
+ var data = new FormData__default['default']();
198
+
199
+ if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
200
+ if (name) data.append('file', uri, name);else data.append('file', uri);
201
+ } else {
202
+ data.append('file', {
203
+ uri: uri,
204
+ name: name || uri.split('/').reverse()[0],
205
+ contentType: contentType || undefined,
206
+ type: contentType || undefined
207
+ });
208
+ }
209
+
210
+ return data;
211
+ }
212
+ function normalizeQuerySort(sort) {
213
+ var sortFields = [];
214
+ var sortArr = Array.isArray(sort) ? sort : [sort];
215
+
216
+ var _iterator = _createForOfIteratorHelper$4(sortArr),
217
+ _step;
218
+
219
+ try {
220
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
221
+ var item = _step.value;
222
+ var entries = Object.entries(item);
223
+
224
+ if (entries.length > 1) {
225
+ console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
226
+ }
227
+
228
+ for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
229
+ var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
230
+ field = _entries$_i[0],
231
+ direction = _entries$_i[1];
232
+
233
+ sortFields.push({
234
+ field: field,
235
+ direction: direction
236
+ });
237
+ }
238
+ }
239
+ } catch (err) {
240
+ _iterator.e(err);
241
+ } finally {
242
+ _iterator.f();
243
+ }
244
+
245
+ return sortFields;
246
+ }
247
+ /**
248
+ * retryInterval - A retry interval which increases acc to number of failures
249
+ *
250
+ * @return {number} Duration to wait in milliseconds
251
+ */
252
+
253
+ function retryInterval(numberOfFailures) {
254
+ // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
255
+ var max = Math.min(500 + numberOfFailures * 2000, 25000);
256
+ var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
257
+ return Math.floor(Math.random() * (max - min) + min);
258
+ }
259
+ function randomId() {
260
+ return generateUUIDv4();
261
+ }
262
+
263
+ function hex(bytes) {
264
+ var s = '';
265
+
266
+ for (var i = 0; i < bytes.length; i++) {
267
+ s += bytes[i].toString(16).padStart(2, '0');
268
+ }
269
+
270
+ return s;
271
+ } // https://tools.ietf.org/html/rfc4122
272
+
273
+
274
+ function generateUUIDv4() {
275
+ var bytes = getRandomBytes(16);
276
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
277
+
278
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
279
+
280
+ return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
281
+ }
282
+
283
+ function getRandomValuesWithMathRandom(bytes) {
284
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
285
+
286
+ for (var i = 0; i < bytes.length; i++) {
287
+ bytes[i] = Math.random() * max;
288
+ }
289
+ }
290
+
291
+ var getRandomValues = function () {
292
+ var _crypto;
293
+
294
+ if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
295
+ return crypto.getRandomValues.bind(crypto);
296
+ } else if (typeof msCrypto !== 'undefined') {
297
+ return msCrypto.getRandomValues.bind(msCrypto);
298
+ } else {
299
+ return getRandomValuesWithMathRandom;
300
+ }
301
+ }();
302
+
303
+ function getRandomBytes(length) {
304
+ var bytes = new Uint8Array(length);
305
+ getRandomValues(bytes);
306
+ return bytes;
307
+ }
308
+
309
+ function convertErrorToJson(err) {
310
+ var jsonObj = {};
311
+ if (!err) return jsonObj;
312
+
313
+ try {
314
+ Object.getOwnPropertyNames(err).forEach(function (key) {
315
+ jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
316
+ });
317
+ } catch (_) {
318
+ return {
319
+ error: 'failed to serialize the error'
320
+ };
321
+ }
322
+
323
+ return jsonObj;
324
+ }
325
+ /**
326
+ * isOnline safely return the navigator.online value for browser env
327
+ * if navigator is not in global object, it always return true
328
+ */
329
+
330
+ function isOnline() {
331
+ var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
332
+
333
+ if (!nav) {
334
+ console.warn('isOnline failed to access window.navigator and assume browser is online');
335
+ return true;
336
+ } // RN navigator has undefined for onLine
337
+
338
+
339
+ if (typeof nav.onLine !== 'boolean') {
340
+ return true;
341
+ }
342
+
343
+ return nav.onLine;
344
+ }
345
+ /**
346
+ * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
347
+ */
348
+
349
+ function addConnectionEventListeners(cb) {
350
+ if (typeof window !== 'undefined' && window.addEventListener) {
351
+ window.addEventListener('offline', cb);
352
+ window.addEventListener('online', cb);
353
+ }
354
+ }
355
+ function removeConnectionEventListeners(cb) {
356
+ if (typeof window !== 'undefined' && window.removeEventListener) {
357
+ window.removeEventListener('offline', cb);
358
+ window.removeEventListener('online', cb);
359
+ }
360
+ }
361
+ var axiosParamsSerializer = function axiosParamsSerializer(params) {
362
+ var newParams = [];
363
+
364
+ for (var k in params) {
365
+ // Stream backend doesn't treat "undefined" value same as value not being present.
366
+ // So, we need to skip the undefined values.
367
+ if (params[k] === undefined) continue;
368
+
369
+ if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
370
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
371
+ } else {
372
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
373
+ }
374
+ }
375
+
376
+ return newParams.join('&');
377
+ };
378
+ /**
379
+ * formatMessage - Takes the message object. Parses the dates, sets __html
380
+ * and sets the status to received if missing. Returns a message object
381
+ *
382
+ * @param {MessageResponse<StreamChatGenerics>} message a message object
383
+ *
384
+ */
385
+
386
+ function formatMessage(message) {
387
+ return _objectSpread$8(_objectSpread$8({}, message), {}, {
388
+ /**
389
+ * @deprecated please use `html`
390
+ */
391
+ __html: message.html,
392
+ // parse the date..
393
+ pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
394
+ created_at: message.created_at ? new Date(message.created_at) : new Date(),
395
+ updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
396
+ status: message.status || 'received'
397
+ });
398
+ }
399
+ function addToMessageList(messages, message) {
400
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
401
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
402
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
403
+ var addMessageToList = addIfDoesNotExist || timestampChanged;
404
+ var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
405
+ // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
406
+
407
+ if (timestampChanged) {
408
+ messageArr = messageArr.filter(function (msg) {
409
+ return !(msg.id && message.id === msg.id);
410
+ });
411
+ } // Get array length after filtering
412
+
413
+
414
+ var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
415
+
416
+ if (messageArrayLength === 0 && addMessageToList) {
417
+ return messageArr.concat(message);
418
+ } else if (messageArrayLength === 0) {
419
+ return _toConsumableArray__default['default'](messageArr);
420
+ }
421
+
422
+ var messageTime = message[sortBy].getTime();
423
+ var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
424
+
425
+ if (messageIsNewest && addMessageToList) {
426
+ return messageArr.concat(message);
427
+ } else if (messageIsNewest) {
428
+ return _toConsumableArray__default['default'](messageArr);
429
+ } // find the closest index to push the new message
430
+
431
+
432
+ var left = 0;
433
+ var middle = 0;
434
+ var right = messageArrayLength - 1;
435
+
436
+ while (left <= right) {
437
+ middle = Math.floor((right + left) / 2);
438
+ if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
439
+ } // message already exists and not filtered due to timestampChanged, update and return
440
+
441
+
442
+ if (!timestampChanged && message.id) {
443
+ if (messageArr[left] && message.id === messageArr[left].id) {
444
+ messageArr[left] = message;
445
+ return _toConsumableArray__default['default'](messageArr);
446
+ }
447
+
448
+ if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
449
+ messageArr[left - 1] = message;
450
+ return _toConsumableArray__default['default'](messageArr);
451
+ }
452
+ } // Do not add updated or deleted messages to the list if they do not already exist
453
+ // or have a timestamp change.
454
+
455
+
456
+ if (addMessageToList) {
457
+ messageArr.splice(left, 0, message);
458
+ }
459
+
460
+ return _toConsumableArray__default['default'](messageArr);
461
+ }
462
+
463
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
464
+
465
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
128
466
 
129
467
  /**
130
468
  * ChannelState - A container class for the channel state.
@@ -201,7 +539,7 @@ var ChannelState = /*#__PURE__*/function () {
201
539
  var m = messages[i];
202
540
 
203
541
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
204
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
542
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
205
543
  user: user
206
544
  });
207
545
  }
@@ -256,7 +594,7 @@ var ChannelState = /*#__PURE__*/function () {
256
594
  user: m.user
257
595
  };
258
596
  } else {
259
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
597
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
260
598
  type: 'deleted',
261
599
  deleted_at: user.deleted_at
262
600
  });
@@ -363,7 +701,7 @@ var ChannelState = /*#__PURE__*/function () {
363
701
  }, {
364
702
  key: "formatMessage",
365
703
  value: function formatMessage(message) {
366
- return _objectSpread$6(_objectSpread$6({}, message), {}, {
704
+ return _objectSpread$7(_objectSpread$7({}, message), {}, {
367
705
  /**
368
706
  * @deprecated please use `html`
369
707
  */
@@ -581,7 +919,7 @@ var ChannelState = /*#__PURE__*/function () {
581
919
  var parseMessage = function parseMessage(m) {
582
920
  var _m$pinned_at, _m$updated_at;
583
921
 
584
- return _objectSpread$6(_objectSpread$6({}, m), {}, {
922
+ return _objectSpread$7(_objectSpread$7({}, m), {}, {
585
923
  created_at: m.created_at.toISOString(),
586
924
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
587
925
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
@@ -592,8 +930,8 @@ var ChannelState = /*#__PURE__*/function () {
592
930
  var updatedMessages = set.messages.filter(function (msg) {
593
931
  return msg.quoted_message_id === message.id;
594
932
  }).map(parseMessage).map(function (msg) {
595
- return _objectSpread$6(_objectSpread$6({}, msg), {}, {
596
- quoted_message: _objectSpread$6(_objectSpread$6({}, message), {}, {
933
+ return _objectSpread$7(_objectSpread$7({}, msg), {}, {
934
+ quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
597
935
  attachments: []
598
936
  })
599
937
  });
@@ -669,71 +1007,14 @@ var ChannelState = /*#__PURE__*/function () {
669
1007
  * @param {Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>} messages A list of messages
670
1008
  * @param message
671
1009
  * @param {boolean} timestampChanged Whether updating a message with changed created_at value.
672
- * @param {string} sortBy field name to use to sort the messages by
673
- * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
674
- */
675
- function _addToMessageList(messages, message) {
676
- var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
677
- var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
678
- var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
679
- var addMessageToList = addIfDoesNotExist || timestampChanged;
680
- var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
681
- // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
682
-
683
- if (timestampChanged) {
684
- messageArr = messageArr.filter(function (msg) {
685
- return !(msg.id && message.id === msg.id);
686
- });
687
- } // Get array length after filtering
688
-
689
-
690
- var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
691
-
692
- if (messageArrayLength === 0 && addMessageToList) {
693
- return messageArr.concat(message);
694
- } else if (messageArrayLength === 0) {
695
- return _toConsumableArray__default['default'](messageArr);
696
- }
697
-
698
- var messageTime = message[sortBy].getTime();
699
- var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
700
-
701
- if (messageIsNewest && addMessageToList) {
702
- return messageArr.concat(message);
703
- } else if (messageIsNewest) {
704
- return _toConsumableArray__default['default'](messageArr);
705
- } // find the closest index to push the new message
706
-
707
-
708
- var left = 0;
709
- var middle = 0;
710
- var right = messageArrayLength - 1;
711
-
712
- while (left <= right) {
713
- middle = Math.floor((right + left) / 2);
714
- if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
715
- } // message already exists and not filtered due to timestampChanged, update and return
716
-
717
-
718
- if (!timestampChanged && message.id) {
719
- if (messageArr[left] && message.id === messageArr[left].id) {
720
- messageArr[left] = message;
721
- return _toConsumableArray__default['default'](messageArr);
722
- }
723
-
724
- if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
725
- messageArr[left - 1] = message;
726
- return _toConsumableArray__default['default'](messageArr);
727
- }
728
- } // Do not add updated or deleted messages to the list if they do not already exist
729
- // or have a timestamp change.
730
-
731
-
732
- if (addMessageToList) {
733
- messageArr.splice(left, 0, message);
734
- }
735
-
736
- return _toConsumableArray__default['default'](messageArr);
1010
+ * @param {string} sortBy field name to use to sort the messages by
1011
+ * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
1012
+ */
1013
+ function _addToMessageList(messages, message) {
1014
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1015
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
1016
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1017
+ return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
737
1018
  }
738
1019
  /**
739
1020
  * removeMessage - Description
@@ -1096,277 +1377,27 @@ var ChannelState = /*#__PURE__*/function () {
1096
1377
  } else {
1097
1378
  // assumes that all new messages belong to the same set
1098
1379
  targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
1099
- }
1100
-
1101
- return {
1102
- targetMessageSetIndex: targetMessageSetIndex,
1103
- messagesToAdd: messagesToAdd
1104
- };
1105
- }
1106
- }]);
1107
-
1108
- return ChannelState;
1109
- }();
1110
-
1111
- function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1112
-
1113
- function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1114
-
1115
- function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1116
-
1117
- /**
1118
- * logChatPromiseExecution - utility function for logging the execution of a promise..
1119
- * use this when you want to run the promise and handle errors by logging a warning
1120
- *
1121
- * @param {Promise<T>} promise The promise you want to run and log
1122
- * @param {string} name A descriptive name of what the promise does for log output
1123
- *
1124
- */
1125
- function logChatPromiseExecution(promise, name) {
1126
- promise.then().catch(function (error) {
1127
- console.warn("failed to do ".concat(name, ", ran into error: "), error);
1128
- });
1129
- }
1130
- var sleep = function sleep(m) {
1131
- return new Promise(function (r) {
1132
- return setTimeout(r, m);
1133
- });
1134
- };
1135
- function isFunction(value) {
1136
- return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
1137
- }
1138
- var chatCodes = {
1139
- TOKEN_EXPIRED: 40,
1140
- WS_CLOSED_SUCCESS: 1000
1141
- };
1142
-
1143
- function isReadableStream(obj) {
1144
- return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
1145
- }
1146
-
1147
- function isBuffer(obj) {
1148
- return obj != null && obj.constructor != null && // @ts-expect-error
1149
- typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
1150
- obj.constructor.isBuffer(obj);
1151
- }
1152
-
1153
- function isFileWebAPI(uri) {
1154
- return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
1155
- }
1156
-
1157
- function isOwnUser(user) {
1158
- return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
1159
- }
1160
-
1161
- function isBlobWebAPI(uri) {
1162
- return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
1163
- }
1164
-
1165
- function isOwnUserBaseProperty(property) {
1166
- var ownUserBaseProperties = {
1167
- channel_mutes: true,
1168
- devices: true,
1169
- mutes: true,
1170
- total_unread_count: true,
1171
- unread_channels: true,
1172
- unread_count: true,
1173
- invisible: true,
1174
- roles: true
1175
- };
1176
- return ownUserBaseProperties[property];
1177
- }
1178
- function addFileToFormData(uri, name, contentType) {
1179
- var data = new FormData__default['default']();
1180
-
1181
- if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
1182
- if (name) data.append('file', uri, name);else data.append('file', uri);
1183
- } else {
1184
- data.append('file', {
1185
- uri: uri,
1186
- name: name || uri.split('/').reverse()[0],
1187
- contentType: contentType || undefined,
1188
- type: contentType || undefined
1189
- });
1190
- }
1191
-
1192
- return data;
1193
- }
1194
- function normalizeQuerySort(sort) {
1195
- var sortFields = [];
1196
- var sortArr = Array.isArray(sort) ? sort : [sort];
1197
-
1198
- var _iterator = _createForOfIteratorHelper$3(sortArr),
1199
- _step;
1200
-
1201
- try {
1202
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1203
- var item = _step.value;
1204
- var entries = Object.entries(item);
1205
-
1206
- if (entries.length > 1) {
1207
- console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
1208
- }
1209
-
1210
- for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
1211
- var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
1212
- field = _entries$_i[0],
1213
- direction = _entries$_i[1];
1214
-
1215
- sortFields.push({
1216
- field: field,
1217
- direction: direction
1218
- });
1219
- }
1220
- }
1221
- } catch (err) {
1222
- _iterator.e(err);
1223
- } finally {
1224
- _iterator.f();
1225
- }
1226
-
1227
- return sortFields;
1228
- }
1229
- /**
1230
- * retryInterval - A retry interval which increases acc to number of failures
1231
- *
1232
- * @return {number} Duration to wait in milliseconds
1233
- */
1234
-
1235
- function retryInterval(numberOfFailures) {
1236
- // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
1237
- var max = Math.min(500 + numberOfFailures * 2000, 25000);
1238
- var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
1239
- return Math.floor(Math.random() * (max - min) + min);
1240
- }
1241
- function randomId() {
1242
- return generateUUIDv4();
1243
- }
1244
-
1245
- function hex(bytes) {
1246
- var s = '';
1247
-
1248
- for (var i = 0; i < bytes.length; i++) {
1249
- s += bytes[i].toString(16).padStart(2, '0');
1250
- }
1251
-
1252
- return s;
1253
- } // https://tools.ietf.org/html/rfc4122
1254
-
1255
-
1256
- function generateUUIDv4() {
1257
- var bytes = getRandomBytes(16);
1258
- bytes[6] = bytes[6] & 0x0f | 0x40; // version
1259
-
1260
- bytes[8] = bytes[8] & 0xbf | 0x80; // variant
1261
-
1262
- return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
1263
- }
1264
-
1265
- function getRandomValuesWithMathRandom(bytes) {
1266
- var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
1267
-
1268
- for (var i = 0; i < bytes.length; i++) {
1269
- bytes[i] = Math.random() * max;
1270
- }
1271
- }
1272
-
1273
- var getRandomValues = function () {
1274
- var _crypto;
1275
-
1276
- if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
1277
- return crypto.getRandomValues.bind(crypto);
1278
- } else if (typeof msCrypto !== 'undefined') {
1279
- return msCrypto.getRandomValues.bind(msCrypto);
1280
- } else {
1281
- return getRandomValuesWithMathRandom;
1282
- }
1283
- }();
1284
-
1285
- function getRandomBytes(length) {
1286
- var bytes = new Uint8Array(length);
1287
- getRandomValues(bytes);
1288
- return bytes;
1289
- }
1290
-
1291
- function convertErrorToJson(err) {
1292
- var jsonObj = {};
1293
- if (!err) return jsonObj;
1294
-
1295
- try {
1296
- Object.getOwnPropertyNames(err).forEach(function (key) {
1297
- jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
1298
- });
1299
- } catch (_) {
1300
- return {
1301
- error: 'failed to serialize the error'
1302
- };
1303
- }
1304
-
1305
- return jsonObj;
1306
- }
1307
- /**
1308
- * isOnline safely return the navigator.online value for browser env
1309
- * if navigator is not in global object, it always return true
1310
- */
1311
-
1312
- function isOnline() {
1313
- var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
1314
-
1315
- if (!nav) {
1316
- console.warn('isOnline failed to access window.navigator and assume browser is online');
1317
- return true;
1318
- } // RN navigator has undefined for onLine
1319
-
1320
-
1321
- if (typeof nav.onLine !== 'boolean') {
1322
- return true;
1323
- }
1324
-
1325
- return nav.onLine;
1326
- }
1327
- /**
1328
- * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
1329
- */
1330
-
1331
- function addConnectionEventListeners(cb) {
1332
- if (typeof window !== 'undefined' && window.addEventListener) {
1333
- window.addEventListener('offline', cb);
1334
- window.addEventListener('online', cb);
1335
- }
1336
- }
1337
- function removeConnectionEventListeners(cb) {
1338
- if (typeof window !== 'undefined' && window.removeEventListener) {
1339
- window.removeEventListener('offline', cb);
1340
- window.removeEventListener('online', cb);
1341
- }
1342
- }
1343
- var axiosParamsSerializer = function axiosParamsSerializer(params) {
1344
- var newParams = [];
1345
-
1346
- for (var k in params) {
1347
- // Stream backend doesn't treat "undefined" value same as value not being present.
1348
- // So, we need to skip the undefined values.
1349
- if (params[k] === undefined) continue;
1380
+ }
1350
1381
 
1351
- if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
1352
- newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1353
- } else {
1354
- newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
1382
+ return {
1383
+ targetMessageSetIndex: targetMessageSetIndex,
1384
+ messagesToAdd: messagesToAdd
1385
+ };
1355
1386
  }
1356
- }
1387
+ }]);
1357
1388
 
1358
- return newParams.join('&');
1359
- };
1389
+ return ChannelState;
1390
+ }();
1360
1391
 
1361
- function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1392
+ function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1362
1393
 
1363
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
1394
+ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1364
1395
 
1365
- function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1396
+ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1366
1397
 
1367
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1398
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1368
1399
 
1369
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1400
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1370
1401
 
1371
1402
  /**
1372
1403
  * Channel - The Channel class manages it's own state.
@@ -1439,7 +1470,7 @@ var Channel = /*#__PURE__*/function () {
1439
1470
  while (1) {
1440
1471
  switch (_context.prev = _context.next) {
1441
1472
  case 0:
1442
- defaultOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
1473
+ defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
1443
1474
  watch: false,
1444
1475
  state: false,
1445
1476
  presence: false
@@ -1511,7 +1542,7 @@ var Channel = /*#__PURE__*/function () {
1511
1542
 
1512
1543
  this.data = data; // this._data is used for the requests...
1513
1544
 
1514
- this._data = _objectSpread$5({}, data);
1545
+ this._data = _objectSpread$6({}, data);
1515
1546
  this.cid = "".concat(type, ":").concat(id);
1516
1547
  this.listeners = {}; // perhaps the state variable should be private
1517
1548
 
@@ -1573,7 +1604,7 @@ var Channel = /*#__PURE__*/function () {
1573
1604
  switch (_context2.prev = _context2.next) {
1574
1605
  case 0:
1575
1606
  _context2.next = 2;
1576
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1607
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
1577
1608
  message: message
1578
1609
  }, options));
1579
1610
 
@@ -1689,7 +1720,7 @@ var Channel = /*#__PURE__*/function () {
1689
1720
 
1690
1721
  case 3:
1691
1722
  // Return a list of channels
1692
- payload = _objectSpread$5(_objectSpread$5({
1723
+ payload = _objectSpread$6(_objectSpread$6({
1693
1724
  filter_conditions: {
1694
1725
  cid: this.cid
1695
1726
  }
@@ -1786,7 +1817,7 @@ var Channel = /*#__PURE__*/function () {
1786
1817
 
1787
1818
  _context5.next = 6;
1788
1819
  return this.getClient().get(this.getClient().baseURL + '/members', {
1789
- payload: _objectSpread$5({
1820
+ payload: _objectSpread$6({
1790
1821
  type: type,
1791
1822
  id: id,
1792
1823
  members: members,
@@ -1847,7 +1878,7 @@ var Channel = /*#__PURE__*/function () {
1847
1878
 
1848
1879
  case 4:
1849
1880
  _context6.next = 6;
1850
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$5({
1881
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
1851
1882
  reaction: reaction
1852
1883
  }, options));
1853
1884
 
@@ -1928,7 +1959,7 @@ var Channel = /*#__PURE__*/function () {
1928
1959
  delete channelData[key];
1929
1960
  });
1930
1961
  _context7.next = 7;
1931
- return this._update(_objectSpread$5({
1962
+ return this._update(_objectSpread$6({
1932
1963
  message: updateMessage,
1933
1964
  data: channelData
1934
1965
  }, options));
@@ -2088,7 +2119,7 @@ var Channel = /*#__PURE__*/function () {
2088
2119
  case 0:
2089
2120
  options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
2090
2121
  _context11.next = 3;
2091
- return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
2122
+ return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
2092
2123
 
2093
2124
  case 3:
2094
2125
  return _context11.abrupt("return", _context11.sent);
@@ -2164,7 +2195,7 @@ var Channel = /*#__PURE__*/function () {
2164
2195
  case 0:
2165
2196
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2166
2197
  _context13.next = 3;
2167
- return this._update(_objectSpread$5({
2198
+ return this._update(_objectSpread$6({
2168
2199
  accept_invite: true
2169
2200
  }, options));
2170
2201
 
@@ -2205,7 +2236,7 @@ var Channel = /*#__PURE__*/function () {
2205
2236
  case 0:
2206
2237
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2207
2238
  _context14.next = 3;
2208
- return this._update(_objectSpread$5({
2239
+ return this._update(_objectSpread$6({
2209
2240
  reject_invite: true
2210
2241
  }, options));
2211
2242
 
@@ -2247,7 +2278,7 @@ var Channel = /*#__PURE__*/function () {
2247
2278
  case 0:
2248
2279
  options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
2249
2280
  _context15.next = 3;
2250
- return this._update(_objectSpread$5({
2281
+ return this._update(_objectSpread$6({
2251
2282
  add_members: members,
2252
2283
  message: message
2253
2284
  }, options));
@@ -2290,7 +2321,7 @@ var Channel = /*#__PURE__*/function () {
2290
2321
  case 0:
2291
2322
  options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
2292
2323
  _context16.next = 3;
2293
- return this._update(_objectSpread$5({
2324
+ return this._update(_objectSpread$6({
2294
2325
  add_moderators: members,
2295
2326
  message: message
2296
2327
  }, options));
@@ -2333,7 +2364,7 @@ var Channel = /*#__PURE__*/function () {
2333
2364
  case 0:
2334
2365
  options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
2335
2366
  _context17.next = 3;
2336
- return this._update(_objectSpread$5({
2367
+ return this._update(_objectSpread$6({
2337
2368
  assign_roles: roles,
2338
2369
  message: message
2339
2370
  }, options));
@@ -2376,7 +2407,7 @@ var Channel = /*#__PURE__*/function () {
2376
2407
  case 0:
2377
2408
  options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
2378
2409
  _context18.next = 3;
2379
- return this._update(_objectSpread$5({
2410
+ return this._update(_objectSpread$6({
2380
2411
  invites: members,
2381
2412
  message: message
2382
2413
  }, options));
@@ -2419,7 +2450,7 @@ var Channel = /*#__PURE__*/function () {
2419
2450
  case 0:
2420
2451
  options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
2421
2452
  _context19.next = 3;
2422
- return this._update(_objectSpread$5({
2453
+ return this._update(_objectSpread$6({
2423
2454
  remove_members: members,
2424
2455
  message: message
2425
2456
  }, options));
@@ -2462,7 +2493,7 @@ var Channel = /*#__PURE__*/function () {
2462
2493
  case 0:
2463
2494
  options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
2464
2495
  _context20.next = 3;
2465
- return this._update(_objectSpread$5({
2496
+ return this._update(_objectSpread$6({
2466
2497
  demote_moderators: members,
2467
2498
  message: message
2468
2499
  }, options));
@@ -2547,7 +2578,7 @@ var Channel = /*#__PURE__*/function () {
2547
2578
  case 0:
2548
2579
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2549
2580
  _context22.next = 3;
2550
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$5({
2581
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
2551
2582
  channel_cid: this.cid
2552
2583
  }, opts));
2553
2584
 
@@ -2589,7 +2620,7 @@ var Channel = /*#__PURE__*/function () {
2589
2620
  case 0:
2590
2621
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2591
2622
  _context23.next = 3;
2592
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$5({
2623
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
2593
2624
  channel_cid: this.cid
2594
2625
  }, opts));
2595
2626
 
@@ -2648,7 +2679,7 @@ var Channel = /*#__PURE__*/function () {
2648
2679
  }, {
2649
2680
  key: "keystroke",
2650
2681
  value: function () {
2651
- var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id) {
2682
+ var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
2652
2683
  var _this$getConfig;
2653
2684
 
2654
2685
  var now, diff;
@@ -2676,10 +2707,10 @@ var Channel = /*#__PURE__*/function () {
2676
2707
 
2677
2708
  this.lastTypingEvent = new Date();
2678
2709
  _context24.next = 10;
2679
- return this.sendEvent({
2710
+ return this.sendEvent(_objectSpread$6({
2680
2711
  type: 'typing.start',
2681
2712
  parent_id: parent_id
2682
- });
2713
+ }, options || {}));
2683
2714
 
2684
2715
  case 10:
2685
2716
  case "end":
@@ -2689,7 +2720,7 @@ var Channel = /*#__PURE__*/function () {
2689
2720
  }, _callee24, this);
2690
2721
  }));
2691
2722
 
2692
- function keystroke(_x25) {
2723
+ function keystroke(_x25, _x26) {
2693
2724
  return _keystroke.apply(this, arguments);
2694
2725
  }
2695
2726
 
@@ -2704,7 +2735,7 @@ var Channel = /*#__PURE__*/function () {
2704
2735
  }, {
2705
2736
  key: "stopTyping",
2706
2737
  value: function () {
2707
- var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id) {
2738
+ var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
2708
2739
  var _this$getConfig2;
2709
2740
 
2710
2741
  return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
@@ -2722,10 +2753,10 @@ var Channel = /*#__PURE__*/function () {
2722
2753
  this.lastTypingEvent = null;
2723
2754
  this.isTyping = false;
2724
2755
  _context25.next = 6;
2725
- return this.sendEvent({
2756
+ return this.sendEvent(_objectSpread$6({
2726
2757
  type: 'typing.stop',
2727
2758
  parent_id: parent_id
2728
- });
2759
+ }, options || {}));
2729
2760
 
2730
2761
  case 6:
2731
2762
  case "end":
@@ -2735,7 +2766,7 @@ var Channel = /*#__PURE__*/function () {
2735
2766
  }, _callee25, this);
2736
2767
  }));
2737
2768
 
2738
- function stopTyping(_x26) {
2769
+ function stopTyping(_x27, _x28) {
2739
2770
  return _stopTyping.apply(this, arguments);
2740
2771
  }
2741
2772
 
@@ -2798,7 +2829,7 @@ var Channel = /*#__PURE__*/function () {
2798
2829
 
2799
2830
  case 4:
2800
2831
  _context26.next = 6;
2801
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$5({}, data));
2832
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
2802
2833
 
2803
2834
  case 6:
2804
2835
  return _context26.abrupt("return", _context26.sent);
@@ -2845,7 +2876,7 @@ var Channel = /*#__PURE__*/function () {
2845
2876
 
2846
2877
  case 3:
2847
2878
  _context27.next = 5;
2848
- return this.getClient().post(this._channelURL() + '/unread', _objectSpread$5({}, data));
2879
+ return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
2849
2880
 
2850
2881
  case 5:
2851
2882
  return _context27.abrupt("return", _context27.sent);
@@ -2858,7 +2889,7 @@ var Channel = /*#__PURE__*/function () {
2858
2889
  }, _callee27, this);
2859
2890
  }));
2860
2891
 
2861
- function markUnread(_x27) {
2892
+ function markUnread(_x29) {
2862
2893
  return _markUnread.apply(this, arguments);
2863
2894
  }
2864
2895
 
@@ -2913,7 +2944,7 @@ var Channel = /*#__PURE__*/function () {
2913
2944
  defaultOptions.watch = false;
2914
2945
  }
2915
2946
 
2916
- combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
2947
+ combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
2917
2948
  _context28.next = 7;
2918
2949
  return this.query(combined, 'latest');
2919
2950
 
@@ -2937,7 +2968,7 @@ var Channel = /*#__PURE__*/function () {
2937
2968
  }, _callee28, this);
2938
2969
  }));
2939
2970
 
2940
- function watch(_x28) {
2971
+ function watch(_x30) {
2941
2972
  return _watch.apply(this, arguments);
2942
2973
  }
2943
2974
 
@@ -3004,7 +3035,7 @@ var Channel = /*#__PURE__*/function () {
3004
3035
  switch (_context30.prev = _context30.next) {
3005
3036
  case 0:
3006
3037
  _context30.next = 2;
3007
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$5({}, options));
3038
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
3008
3039
 
3009
3040
  case 2:
3010
3041
  data = _context30.sent;
@@ -3024,7 +3055,7 @@ var Channel = /*#__PURE__*/function () {
3024
3055
  }, _callee30, this);
3025
3056
  }));
3026
3057
 
3027
- function getReplies(_x29, _x30) {
3058
+ function getReplies(_x31, _x32) {
3028
3059
  return _getReplies.apply(this, arguments);
3029
3060
  }
3030
3061
 
@@ -3052,7 +3083,7 @@ var Channel = /*#__PURE__*/function () {
3052
3083
  sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
3053
3084
  _context31.next = 3;
3054
3085
  return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
3055
- payload: _objectSpread$5(_objectSpread$5({}, options), {}, {
3086
+ payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
3056
3087
  sort: normalizeQuerySort(sort)
3057
3088
  })
3058
3089
  });
@@ -3068,7 +3099,7 @@ var Channel = /*#__PURE__*/function () {
3068
3099
  }, _callee31, this);
3069
3100
  }));
3070
3101
 
3071
- function getPinnedMessages(_x31) {
3102
+ function getPinnedMessages(_x33) {
3072
3103
  return _getPinnedMessages.apply(this, arguments);
3073
3104
  }
3074
3105
 
@@ -3086,7 +3117,7 @@ var Channel = /*#__PURE__*/function () {
3086
3117
  }, {
3087
3118
  key: "getReactions",
3088
3119
  value: function getReactions(message_id, options) {
3089
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$5({}, options));
3120
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
3090
3121
  }
3091
3122
  /**
3092
3123
  * getMessagesById - Retrieves a list of messages by ID
@@ -3233,7 +3264,7 @@ var Channel = /*#__PURE__*/function () {
3233
3264
  }
3234
3265
 
3235
3266
  _context32.next = 7;
3236
- return this.getClient().post(queryURL + '/query', _objectSpread$5({
3267
+ return this.getClient().post(queryURL + '/query', _objectSpread$6({
3237
3268
  data: this._data,
3238
3269
  state: true
3239
3270
  }, options));
@@ -3297,7 +3328,7 @@ var Channel = /*#__PURE__*/function () {
3297
3328
  }, _callee32, this);
3298
3329
  }));
3299
3330
 
3300
- function query(_x32) {
3331
+ function query(_x34) {
3301
3332
  return _query.apply(this, arguments);
3302
3333
  }
3303
3334
 
@@ -3322,7 +3353,7 @@ var Channel = /*#__PURE__*/function () {
3322
3353
  this._checkInitialized();
3323
3354
 
3324
3355
  _context33.next = 3;
3325
- return this.getClient().banUser(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3356
+ return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3326
3357
  type: this.type,
3327
3358
  id: this.id
3328
3359
  }));
@@ -3338,7 +3369,7 @@ var Channel = /*#__PURE__*/function () {
3338
3369
  }, _callee33, this);
3339
3370
  }));
3340
3371
 
3341
- function banUser(_x33, _x34) {
3372
+ function banUser(_x35, _x36) {
3342
3373
  return _banUser.apply(this, arguments);
3343
3374
  }
3344
3375
 
@@ -3469,7 +3500,7 @@ var Channel = /*#__PURE__*/function () {
3469
3500
  }, _callee36, this);
3470
3501
  }));
3471
3502
 
3472
- function unbanUser(_x35) {
3503
+ function unbanUser(_x37) {
3473
3504
  return _unbanUser.apply(this, arguments);
3474
3505
  }
3475
3506
 
@@ -3494,7 +3525,7 @@ var Channel = /*#__PURE__*/function () {
3494
3525
  this._checkInitialized();
3495
3526
 
3496
3527
  _context37.next = 3;
3497
- return this.getClient().shadowBan(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3528
+ return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3498
3529
  type: this.type,
3499
3530
  id: this.id
3500
3531
  }));
@@ -3510,7 +3541,7 @@ var Channel = /*#__PURE__*/function () {
3510
3541
  }, _callee37, this);
3511
3542
  }));
3512
3543
 
3513
- function shadowBan(_x36, _x37) {
3544
+ function shadowBan(_x38, _x39) {
3514
3545
  return _shadowBan.apply(this, arguments);
3515
3546
  }
3516
3547
 
@@ -3550,7 +3581,7 @@ var Channel = /*#__PURE__*/function () {
3550
3581
  }, _callee38, this);
3551
3582
  }));
3552
3583
 
3553
- function removeShadowBan(_x38) {
3584
+ function removeShadowBan(_x40) {
3554
3585
  return _removeShadowBan.apply(this, arguments);
3555
3586
  }
3556
3587
 
@@ -3585,7 +3616,7 @@ var Channel = /*#__PURE__*/function () {
3585
3616
  }, _callee39, this);
3586
3617
  }));
3587
3618
 
3588
- function createCall(_x39) {
3619
+ function createCall(_x41) {
3589
3620
  return _createCall.apply(this, arguments);
3590
3621
  }
3591
3622
 
@@ -3880,7 +3911,7 @@ var Channel = /*#__PURE__*/function () {
3880
3911
  });
3881
3912
  }
3882
3913
 
3883
- channel.data = _objectSpread$5(_objectSpread$5({}, event.channel), {}, {
3914
+ channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
3884
3915
  hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
3885
3916
  own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
3886
3917
  });
@@ -3911,7 +3942,7 @@ var Channel = /*#__PURE__*/function () {
3911
3942
  break;
3912
3943
 
3913
3944
  case 'channel.hidden':
3914
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3945
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3915
3946
  hidden: true
3916
3947
  });
3917
3948
 
@@ -3922,26 +3953,26 @@ var Channel = /*#__PURE__*/function () {
3922
3953
  break;
3923
3954
 
3924
3955
  case 'channel.visible':
3925
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3956
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3926
3957
  hidden: false
3927
3958
  });
3928
3959
  break;
3929
3960
 
3930
3961
  case 'user.banned':
3931
3962
  if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3932
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3963
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3933
3964
  shadow_banned: !!event.shadow,
3934
3965
  banned: !event.shadow,
3935
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3966
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3936
3967
  });
3937
3968
  break;
3938
3969
 
3939
3970
  case 'user.unbanned':
3940
3971
  if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
3941
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3972
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3942
3973
  shadow_banned: false,
3943
3974
  banned: false,
3944
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3975
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3945
3976
  });
3946
3977
  break;
3947
3978
  } // any event can send over the online count
@@ -3971,7 +4002,7 @@ var Channel = /*#__PURE__*/function () {
3971
4002
 
3972
4003
 
3973
4004
  if (state.members) {
3974
- var _iterator = _createForOfIteratorHelper$2(state.members),
4005
+ var _iterator = _createForOfIteratorHelper$3(state.members),
3975
4006
  _step;
3976
4007
 
3977
4008
  try {
@@ -4015,7 +4046,7 @@ var Channel = /*#__PURE__*/function () {
4015
4046
 
4016
4047
 
4017
4048
  if (state.watchers) {
4018
- var _iterator2 = _createForOfIteratorHelper$2(state.watchers),
4049
+ var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
4019
4050
  _step2;
4020
4051
 
4021
4052
  try {
@@ -4051,7 +4082,7 @@ var Channel = /*#__PURE__*/function () {
4051
4082
 
4052
4083
 
4053
4084
  if (state.read) {
4054
- var _iterator3 = _createForOfIteratorHelper$2(state.read),
4085
+ var _iterator3 = _createForOfIteratorHelper$3(state.read),
4055
4086
  _step3;
4056
4087
 
4057
4088
  try {
@@ -4120,11 +4151,11 @@ var Channel = /*#__PURE__*/function () {
4120
4151
  return Channel;
4121
4152
  }();
4122
4153
 
4123
- function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4154
+ function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4124
4155
 
4125
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
4156
+ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
4126
4157
 
4127
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4158
+ function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4128
4159
 
4129
4160
  /**
4130
4161
  * ClientState - A container class for the client state.
@@ -4147,7 +4178,7 @@ var ClientState = /*#__PURE__*/function () {
4147
4178
  _createClass__default['default'](ClientState, [{
4148
4179
  key: "updateUsers",
4149
4180
  value: function updateUsers(users) {
4150
- var _iterator = _createForOfIteratorHelper$1(users),
4181
+ var _iterator = _createForOfIteratorHelper$2(users),
4151
4182
  _step;
4152
4183
 
4153
4184
  try {
@@ -4195,9 +4226,9 @@ var ClientState = /*#__PURE__*/function () {
4195
4226
  return ClientState;
4196
4227
  }();
4197
4228
 
4198
- function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4229
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4199
4230
 
4200
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4231
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4201
4232
  var InsightMetrics = function InsightMetrics() {
4202
4233
  _classCallCheck__default['default'](this, InsightMetrics);
4203
4234
 
@@ -4276,7 +4307,7 @@ var postInsights = /*#__PURE__*/function () {
4276
4307
  };
4277
4308
  }();
4278
4309
  function buildWsFatalInsight(connection, event) {
4279
- return _objectSpread$4(_objectSpread$4({}, event), buildWsBaseInsight(connection));
4310
+ return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
4280
4311
  }
4281
4312
 
4282
4313
  function buildWsBaseInsight(connection) {
@@ -4309,9 +4340,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
4309
4340
  return buildWsBaseInsight(connection);
4310
4341
  }
4311
4342
 
4312
- function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4343
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4313
4344
 
4314
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4345
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4315
4346
 
4316
4347
  // Type guards to check WebSocket error type
4317
4348
  var isCloseEvent = function isCloseEvent(res) {
@@ -4675,7 +4706,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4675
4706
  value: function _log(msg) {
4676
4707
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4677
4708
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
4678
- this.client.logger(level, 'connection:' + msg, _objectSpread$3({
4709
+ this.client.logger(level, 'connection:' + msg, _objectSpread$4({
4679
4710
  tags: ['connection']
4680
4711
  }, extra));
4681
4712
  }
@@ -5266,9 +5297,9 @@ var StableWSConnection = /*#__PURE__*/function () {
5266
5297
  return StableWSConnection;
5267
5298
  }();
5268
5299
 
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; }
5300
+ 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
5301
 
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; }
5302
+ 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
5303
 
5273
5304
  /**
5274
5305
  * Creates the JWT token that can be used for a UserSession
@@ -5289,7 +5320,7 @@ function JWTUserToken(apiSecret, userId) {
5289
5320
  throw new TypeError('userId should be a string');
5290
5321
  }
5291
5322
 
5292
- var payload = _objectSpread$2({
5323
+ var payload = _objectSpread$3({
5293
5324
  user_id: userId
5294
5325
  }, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
5295
5326
 
@@ -5699,9 +5730,9 @@ function isErrorResponse(res) {
5699
5730
  return !res.status || res.status < 200 || 300 <= res.status;
5700
5731
  }
5701
5732
 
5702
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5733
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5703
5734
 
5704
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5735
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5705
5736
  var ConnectionState;
5706
5737
 
5707
5738
  (function (ConnectionState) {
@@ -5764,7 +5795,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5764
5795
  _context.next = 4;
5765
5796
  return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
5766
5797
  undefined, {
5767
- config: _objectSpread$1(_objectSpread$1({}, config), {}, {
5798
+ config: _objectSpread$2(_objectSpread$2({}, config), {}, {
5768
5799
  cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
5769
5800
  }),
5770
5801
  params: params
@@ -6042,7 +6073,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6042
6073
  value: function _log(msg) {
6043
6074
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6044
6075
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
6045
- this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$1({
6076
+ this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
6046
6077
  tags: ['connection_fallback', 'connection']
6047
6078
  }, extra));
6048
6079
  }
@@ -6089,6 +6120,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
6089
6120
  /**
6090
6121
  * Response Types
6091
6122
  */
6123
+ // TODO: Figure out a way to strongly type set and unset.
6092
6124
  // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6093
6125
 
6094
6126
  /**
@@ -6160,6 +6192,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6160
6192
  return ErrorFromResponse;
6161
6193
  }( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
6162
6194
 
6195
+ 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; }
6196
+
6197
+ 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; }
6198
+
6199
+ 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; } } }; }
6200
+
6201
+ 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); }
6202
+
6203
+ 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; }
6204
+ var Thread = /*#__PURE__*/function () {
6205
+ function Thread(client, t) {
6206
+ _classCallCheck__default['default'](this, Thread);
6207
+
6208
+ _defineProperty__default['default'](this, "id", void 0);
6209
+
6210
+ _defineProperty__default['default'](this, "latestReplies", []);
6211
+
6212
+ _defineProperty__default['default'](this, "participants", []);
6213
+
6214
+ _defineProperty__default['default'](this, "message", void 0);
6215
+
6216
+ _defineProperty__default['default'](this, "channel", void 0);
6217
+
6218
+ _defineProperty__default['default'](this, "_channel", void 0);
6219
+
6220
+ _defineProperty__default['default'](this, "replyCount", 0);
6221
+
6222
+ _defineProperty__default['default'](this, "_client", void 0);
6223
+
6224
+ _defineProperty__default['default'](this, "read", {});
6225
+
6226
+ this.id = t.parent_message.id;
6227
+ this.message = formatMessage(t.parent_message);
6228
+ this.latestReplies = t.latest_replies.map(formatMessage);
6229
+ this.participants = t.thread_participants;
6230
+ this.replyCount = t.reply_count;
6231
+ this.channel = t.channel;
6232
+ this._channel = client.channel(t.channel.type, t.channel.id);
6233
+ this._client = client;
6234
+
6235
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6236
+ _step;
6237
+
6238
+ try {
6239
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6240
+ var r = _step.value;
6241
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6242
+ last_read: new Date(r.last_read)
6243
+ });
6244
+ }
6245
+ } catch (err) {
6246
+ _iterator.e(err);
6247
+ } finally {
6248
+ _iterator.f();
6249
+ }
6250
+ }
6251
+
6252
+ _createClass__default['default'](Thread, [{
6253
+ key: "getClient",
6254
+ value: function getClient() {
6255
+ return this._client;
6256
+ }
6257
+ }, {
6258
+ key: "addReply",
6259
+ value: function addReply(message) {
6260
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6261
+ }
6262
+ }, {
6263
+ key: "updateReply",
6264
+ value: function updateReply(message) {
6265
+ this.latestReplies = this.latestReplies.map(function (m) {
6266
+ if (m.id === message.id) {
6267
+ return formatMessage(message);
6268
+ }
6269
+
6270
+ return m;
6271
+ });
6272
+ }
6273
+ }, {
6274
+ key: "updateMessageOrReplyIfExists",
6275
+ value: function updateMessageOrReplyIfExists(message) {
6276
+ if (!message.parent_id && message.id !== this.message.id) {
6277
+ return;
6278
+ }
6279
+
6280
+ if (message.parent_id && message.parent_id !== this.message.id) {
6281
+ return;
6282
+ }
6283
+
6284
+ if (message.parent_id && message.parent_id === this.message.id) {
6285
+ this.updateReply(message);
6286
+ }
6287
+
6288
+ if (!message.parent_id && message.id === this.message.id) {
6289
+ this.message = formatMessage(message);
6290
+ }
6291
+ }
6292
+ }, {
6293
+ key: "addReaction",
6294
+ value: function addReaction(reaction, message, enforce_unique) {
6295
+ var _this = this;
6296
+
6297
+ if (!message) return;
6298
+ this.latestReplies = this.latestReplies.map(function (m) {
6299
+ if (m.id === message.id) {
6300
+ return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
6301
+ }
6302
+
6303
+ return m;
6304
+ });
6305
+ }
6306
+ }, {
6307
+ key: "removeReaction",
6308
+ value: function removeReaction(reaction, message) {
6309
+ var _this2 = this;
6310
+
6311
+ if (!message) return;
6312
+ this.latestReplies = this.latestReplies.map(function (m) {
6313
+ if (m.id === message.id) {
6314
+ return formatMessage(_this2._channel.state.removeReaction(reaction, message));
6315
+ }
6316
+
6317
+ return m;
6318
+ });
6319
+ }
6320
+ }]);
6321
+
6322
+ return Thread;
6323
+ }();
6324
+
6163
6325
  var _excluded = ["created_at", "updated_at", "last_active", "online"],
6164
6326
  _excluded2 = ["params", "headers"];
6165
6327
 
@@ -10271,10 +10433,197 @@ var StreamChat = /*#__PURE__*/function () {
10271
10433
 
10272
10434
  return getMessage;
10273
10435
  }()
10436
+ /**
10437
+ * queryThreads - returns the list of threads of current user.
10438
+ *
10439
+ * @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
10440
+ * @param {number} options.limit Limits the number of threads to be returned.
10441
+ * @param {boolean} options.watch Subscribes the user to the channels of the threads.
10442
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10443
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10444
+ *
10445
+ * @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
10446
+ */
10447
+
10448
+ }, {
10449
+ key: "queryThreads",
10450
+ value: function () {
10451
+ var _queryThreads = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(options) {
10452
+ var _this5 = this;
10453
+
10454
+ var opts, res;
10455
+ return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10456
+ while (1) {
10457
+ switch (_context59.prev = _context59.next) {
10458
+ case 0:
10459
+ opts = _objectSpread({
10460
+ limit: 10,
10461
+ participant_limit: 10,
10462
+ reply_limit: 3,
10463
+ watch: true
10464
+ }, options);
10465
+ _context59.next = 3;
10466
+ return this.post(this.baseURL + "/threads", opts);
10467
+
10468
+ case 3:
10469
+ res = _context59.sent;
10470
+ return _context59.abrupt("return", {
10471
+ threads: res.threads.map(function (thread) {
10472
+ return new Thread(_this5, thread);
10473
+ }),
10474
+ next: res.next
10475
+ });
10476
+
10477
+ case 5:
10478
+ case "end":
10479
+ return _context59.stop();
10480
+ }
10481
+ }
10482
+ }, _callee59, this);
10483
+ }));
10484
+
10485
+ function queryThreads(_x78) {
10486
+ return _queryThreads.apply(this, arguments);
10487
+ }
10488
+
10489
+ return queryThreads;
10490
+ }()
10491
+ /**
10492
+ * getThread - returns the thread of a message by its id.
10493
+ *
10494
+ * @param {string} messageId The message id
10495
+ * @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
10496
+ * @param {boolean} options.watch Subscribes the user to the channel of the thread.
10497
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10498
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10499
+ *
10500
+ * @returns {Thread<StreamChatGenerics>} Returns the thread.
10501
+ */
10502
+
10503
+ }, {
10504
+ key: "getThread",
10505
+ value: function () {
10506
+ var _getThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(messageId) {
10507
+ var options,
10508
+ opts,
10509
+ res,
10510
+ _args60 = arguments;
10511
+ return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10512
+ while (1) {
10513
+ switch (_context60.prev = _context60.next) {
10514
+ case 0:
10515
+ options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
10516
+
10517
+ if (messageId) {
10518
+ _context60.next = 3;
10519
+ break;
10520
+ }
10521
+
10522
+ throw Error('Please specify the message id when calling partialUpdateThread');
10523
+
10524
+ case 3:
10525
+ opts = _objectSpread({
10526
+ participant_limit: 100,
10527
+ reply_limit: 3,
10528
+ watch: true
10529
+ }, options);
10530
+ _context60.next = 6;
10531
+ return this.get(this.baseURL + "/threads/".concat(messageId), opts);
10532
+
10533
+ case 6:
10534
+ res = _context60.sent;
10535
+ return _context60.abrupt("return", new Thread(this, res.thread));
10536
+
10537
+ case 8:
10538
+ case "end":
10539
+ return _context60.stop();
10540
+ }
10541
+ }
10542
+ }, _callee60, this);
10543
+ }));
10544
+
10545
+ function getThread(_x79) {
10546
+ return _getThread.apply(this, arguments);
10547
+ }
10548
+
10549
+ return getThread;
10550
+ }()
10551
+ /**
10552
+ * partialUpdateThread - updates the given thread
10553
+ *
10554
+ * @param {string} messageId The id of the thread message which needs to be updated.
10555
+ * @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
10556
+ *
10557
+ * @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
10558
+ */
10559
+
10560
+ }, {
10561
+ key: "partialUpdateThread",
10562
+ value: function () {
10563
+ var _partialUpdateThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(messageId, partialThreadObject) {
10564
+ var reservedThreadFields, _key5;
10565
+
10566
+ return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10567
+ while (1) {
10568
+ switch (_context61.prev = _context61.next) {
10569
+ case 0:
10570
+ if (messageId) {
10571
+ _context61.next = 2;
10572
+ break;
10573
+ }
10574
+
10575
+ throw Error('Please specify the message id when calling partialUpdateThread');
10576
+
10577
+ case 2:
10578
+ // check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
10579
+ // Throw error if any of the reserved field is found.
10580
+ reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
10581
+ _context61.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
10582
+
10583
+ case 4:
10584
+ if ((_context61.t1 = _context61.t0()).done) {
10585
+ _context61.next = 10;
10586
+ break;
10587
+ }
10588
+
10589
+ _key5 = _context61.t1.value;
10590
+
10591
+ if (!reservedThreadFields.includes(_key5)) {
10592
+ _context61.next = 8;
10593
+ break;
10594
+ }
10595
+
10596
+ 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."));
10597
+
10598
+ case 8:
10599
+ _context61.next = 4;
10600
+ break;
10601
+
10602
+ case 10:
10603
+ _context61.next = 12;
10604
+ return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
10605
+
10606
+ case 12:
10607
+ return _context61.abrupt("return", _context61.sent);
10608
+
10609
+ case 13:
10610
+ case "end":
10611
+ return _context61.stop();
10612
+ }
10613
+ }
10614
+ }, _callee61, this);
10615
+ }));
10616
+
10617
+ function partialUpdateThread(_x80, _x81) {
10618
+ return _partialUpdateThread.apply(this, arguments);
10619
+ }
10620
+
10621
+ return partialUpdateThread;
10622
+ }()
10274
10623
  }, {
10275
10624
  key: "getUserAgent",
10276
10625
  value: function getUserAgent() {
10277
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.15.0");
10626
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
10278
10627
  }
10279
10628
  }, {
10280
10629
  key: "setUserAgent",
@@ -10493,28 +10842,28 @@ var StreamChat = /*#__PURE__*/function () {
10493
10842
  }, {
10494
10843
  key: "sendUserCustomEvent",
10495
10844
  value: function () {
10496
- var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(targetUserID, event) {
10497
- return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10845
+ var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(targetUserID, event) {
10846
+ return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
10498
10847
  while (1) {
10499
- switch (_context59.prev = _context59.next) {
10848
+ switch (_context62.prev = _context62.next) {
10500
10849
  case 0:
10501
- _context59.next = 2;
10850
+ _context62.next = 2;
10502
10851
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
10503
10852
  event: event
10504
10853
  });
10505
10854
 
10506
10855
  case 2:
10507
- return _context59.abrupt("return", _context59.sent);
10856
+ return _context62.abrupt("return", _context62.sent);
10508
10857
 
10509
10858
  case 3:
10510
10859
  case "end":
10511
- return _context59.stop();
10860
+ return _context62.stop();
10512
10861
  }
10513
10862
  }
10514
- }, _callee59, this);
10863
+ }, _callee62, this);
10515
10864
  }));
10516
10865
 
10517
- function sendUserCustomEvent(_x78, _x79) {
10866
+ function sendUserCustomEvent(_x82, _x83) {
10518
10867
  return _sendUserCustomEvent.apply(this, arguments);
10519
10868
  }
10520
10869
 
@@ -10586,12 +10935,12 @@ var StreamChat = /*#__PURE__*/function () {
10586
10935
  }, {
10587
10936
  key: "createSegment",
10588
10937
  value: function () {
10589
- var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(type, id, name, data) {
10938
+ var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(type, id, name, data) {
10590
10939
  var body, _yield$this$post, segment;
10591
10940
 
10592
- return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10941
+ return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
10593
10942
  while (1) {
10594
- switch (_context60.prev = _context60.next) {
10943
+ switch (_context63.prev = _context63.next) {
10595
10944
  case 0:
10596
10945
  body = {
10597
10946
  id: id,
@@ -10599,23 +10948,23 @@ var StreamChat = /*#__PURE__*/function () {
10599
10948
  name: name,
10600
10949
  data: data
10601
10950
  };
10602
- _context60.next = 3;
10951
+ _context63.next = 3;
10603
10952
  return this.post(this.baseURL + "/segments", body);
10604
10953
 
10605
10954
  case 3:
10606
- _yield$this$post = _context60.sent;
10955
+ _yield$this$post = _context63.sent;
10607
10956
  segment = _yield$this$post.segment;
10608
- return _context60.abrupt("return", segment);
10957
+ return _context63.abrupt("return", segment);
10609
10958
 
10610
10959
  case 6:
10611
10960
  case "end":
10612
- return _context60.stop();
10961
+ return _context63.stop();
10613
10962
  }
10614
10963
  }
10615
- }, _callee60, this);
10964
+ }, _callee63, this);
10616
10965
  }));
10617
10966
 
10618
- function createSegment(_x80, _x81, _x82, _x83) {
10967
+ function createSegment(_x84, _x85, _x86, _x87) {
10619
10968
  return _createSegment.apply(this, arguments);
10620
10969
  }
10621
10970
 
@@ -10634,26 +10983,26 @@ var StreamChat = /*#__PURE__*/function () {
10634
10983
  }, {
10635
10984
  key: "createUserSegment",
10636
10985
  value: function () {
10637
- var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(id, name, data) {
10638
- return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10986
+ var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, name, data) {
10987
+ return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
10639
10988
  while (1) {
10640
- switch (_context61.prev = _context61.next) {
10989
+ switch (_context64.prev = _context64.next) {
10641
10990
  case 0:
10642
- _context61.next = 2;
10991
+ _context64.next = 2;
10643
10992
  return this.createSegment('user', id, name, data);
10644
10993
 
10645
10994
  case 2:
10646
- return _context61.abrupt("return", _context61.sent);
10995
+ return _context64.abrupt("return", _context64.sent);
10647
10996
 
10648
10997
  case 3:
10649
10998
  case "end":
10650
- return _context61.stop();
10999
+ return _context64.stop();
10651
11000
  }
10652
11001
  }
10653
- }, _callee61, this);
11002
+ }, _callee64, this);
10654
11003
  }));
10655
11004
 
10656
- function createUserSegment(_x84, _x85, _x86) {
11005
+ function createUserSegment(_x88, _x89, _x90) {
10657
11006
  return _createUserSegment.apply(this, arguments);
10658
11007
  }
10659
11008
 
@@ -10672,26 +11021,26 @@ var StreamChat = /*#__PURE__*/function () {
10672
11021
  }, {
10673
11022
  key: "createChannelSegment",
10674
11023
  value: function () {
10675
- var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(id, name, data) {
10676
- return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
11024
+ var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
11025
+ return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
10677
11026
  while (1) {
10678
- switch (_context62.prev = _context62.next) {
11027
+ switch (_context65.prev = _context65.next) {
10679
11028
  case 0:
10680
- _context62.next = 2;
11029
+ _context65.next = 2;
10681
11030
  return this.createSegment('channel', id, name, data);
10682
11031
 
10683
11032
  case 2:
10684
- return _context62.abrupt("return", _context62.sent);
11033
+ return _context65.abrupt("return", _context65.sent);
10685
11034
 
10686
11035
  case 3:
10687
11036
  case "end":
10688
- return _context62.stop();
11037
+ return _context65.stop();
10689
11038
  }
10690
11039
  }
10691
- }, _callee62, this);
11040
+ }, _callee65, this);
10692
11041
  }));
10693
11042
 
10694
- function createChannelSegment(_x87, _x88, _x89) {
11043
+ function createChannelSegment(_x91, _x92, _x93) {
10695
11044
  return _createChannelSegment.apply(this, arguments);
10696
11045
  }
10697
11046
 
@@ -10709,30 +11058,30 @@ var StreamChat = /*#__PURE__*/function () {
10709
11058
  }, {
10710
11059
  key: "updateSegment",
10711
11060
  value: function () {
10712
- var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(id, data) {
11061
+ var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
10713
11062
  var _yield$this$put, segment;
10714
11063
 
10715
- return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
11064
+ return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
10716
11065
  while (1) {
10717
- switch (_context63.prev = _context63.next) {
11066
+ switch (_context66.prev = _context66.next) {
10718
11067
  case 0:
10719
- _context63.next = 2;
11068
+ _context66.next = 2;
10720
11069
  return this.put(this.baseURL + "/segments/".concat(id), data);
10721
11070
 
10722
11071
  case 2:
10723
- _yield$this$put = _context63.sent;
11072
+ _yield$this$put = _context66.sent;
10724
11073
  segment = _yield$this$put.segment;
10725
- return _context63.abrupt("return", segment);
11074
+ return _context66.abrupt("return", segment);
10726
11075
 
10727
11076
  case 5:
10728
11077
  case "end":
10729
- return _context63.stop();
11078
+ return _context66.stop();
10730
11079
  }
10731
11080
  }
10732
- }, _callee63, this);
11081
+ }, _callee66, this);
10733
11082
  }));
10734
11083
 
10735
- function updateSegment(_x90, _x91) {
11084
+ function updateSegment(_x94, _x95) {
10736
11085
  return _updateSegment.apply(this, arguments);
10737
11086
  }
10738
11087
 
@@ -10750,30 +11099,30 @@ var StreamChat = /*#__PURE__*/function () {
10750
11099
  }, {
10751
11100
  key: "addSegmentTargets",
10752
11101
  value: function () {
10753
- var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, targets) {
11102
+ var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id, targets) {
10754
11103
  var body;
10755
- return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
11104
+ return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
10756
11105
  while (1) {
10757
- switch (_context64.prev = _context64.next) {
11106
+ switch (_context67.prev = _context67.next) {
10758
11107
  case 0:
10759
11108
  body = {
10760
11109
  targets: targets
10761
11110
  };
10762
- _context64.next = 3;
11111
+ _context67.next = 3;
10763
11112
  return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
10764
11113
 
10765
11114
  case 3:
10766
- return _context64.abrupt("return", _context64.sent);
11115
+ return _context67.abrupt("return", _context67.sent);
10767
11116
 
10768
11117
  case 4:
10769
11118
  case "end":
10770
- return _context64.stop();
11119
+ return _context67.stop();
10771
11120
  }
10772
11121
  }
10773
- }, _callee64, this);
11122
+ }, _callee67, this);
10774
11123
  }));
10775
11124
 
10776
- function addSegmentTargets(_x92, _x93) {
11125
+ function addSegmentTargets(_x96, _x97) {
10777
11126
  return _addSegmentTargets.apply(this, arguments);
10778
11127
  }
10779
11128
 
@@ -10791,30 +11140,30 @@ var StreamChat = /*#__PURE__*/function () {
10791
11140
  }, {
10792
11141
  key: "deleteSegmentTargets",
10793
11142
  value: function () {
10794
- var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, targets) {
11143
+ var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(id, targets) {
10795
11144
  var body;
10796
- return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
11145
+ return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
10797
11146
  while (1) {
10798
- switch (_context65.prev = _context65.next) {
11147
+ switch (_context68.prev = _context68.next) {
10799
11148
  case 0:
10800
11149
  body = {
10801
11150
  targets: targets
10802
11151
  };
10803
- _context65.next = 3;
11152
+ _context68.next = 3;
10804
11153
  return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
10805
11154
 
10806
11155
  case 3:
10807
- return _context65.abrupt("return", _context65.sent);
11156
+ return _context68.abrupt("return", _context68.sent);
10808
11157
 
10809
11158
  case 4:
10810
11159
  case "end":
10811
- return _context65.stop();
11160
+ return _context68.stop();
10812
11161
  }
10813
11162
  }
10814
- }, _callee65, this);
11163
+ }, _callee68, this);
10815
11164
  }));
10816
11165
 
10817
- function deleteSegmentTargets(_x94, _x95) {
11166
+ function deleteSegmentTargets(_x98, _x99) {
10818
11167
  return _deleteSegmentTargets.apply(this, arguments);
10819
11168
  }
10820
11169
 
@@ -10832,15 +11181,15 @@ var StreamChat = /*#__PURE__*/function () {
10832
11181
  }, {
10833
11182
  key: "querySegments",
10834
11183
  value: function () {
10835
- var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(filter) {
11184
+ var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(filter) {
10836
11185
  var options,
10837
- _args66 = arguments;
10838
- return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
11186
+ _args69 = arguments;
11187
+ return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
10839
11188
  while (1) {
10840
- switch (_context66.prev = _context66.next) {
11189
+ switch (_context69.prev = _context69.next) {
10841
11190
  case 0:
10842
- options = _args66.length > 1 && _args66[1] !== undefined ? _args66[1] : {};
10843
- _context66.next = 3;
11191
+ options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11192
+ _context69.next = 3;
10844
11193
  return this.get(this.baseURL + "/segments", {
10845
11194
  payload: _objectSpread({
10846
11195
  filter: filter
@@ -10848,17 +11197,17 @@ var StreamChat = /*#__PURE__*/function () {
10848
11197
  });
10849
11198
 
10850
11199
  case 3:
10851
- return _context66.abrupt("return", _context66.sent);
11200
+ return _context69.abrupt("return", _context69.sent);
10852
11201
 
10853
11202
  case 4:
10854
11203
  case "end":
10855
- return _context66.stop();
11204
+ return _context69.stop();
10856
11205
  }
10857
11206
  }
10858
- }, _callee66, this);
11207
+ }, _callee69, this);
10859
11208
  }));
10860
11209
 
10861
- function querySegments(_x96) {
11210
+ function querySegments(_x100) {
10862
11211
  return _querySegments.apply(this, arguments);
10863
11212
  }
10864
11213
 
@@ -10875,26 +11224,26 @@ var StreamChat = /*#__PURE__*/function () {
10875
11224
  }, {
10876
11225
  key: "deleteSegment",
10877
11226
  value: function () {
10878
- var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id) {
10879
- return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
11227
+ var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(id) {
11228
+ return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
10880
11229
  while (1) {
10881
- switch (_context67.prev = _context67.next) {
11230
+ switch (_context70.prev = _context70.next) {
10882
11231
  case 0:
10883
- _context67.next = 2;
11232
+ _context70.next = 2;
10884
11233
  return this.delete(this.baseURL + "/segments/".concat(id));
10885
11234
 
10886
11235
  case 2:
10887
- return _context67.abrupt("return", _context67.sent);
11236
+ return _context70.abrupt("return", _context70.sent);
10888
11237
 
10889
11238
  case 3:
10890
11239
  case "end":
10891
- return _context67.stop();
11240
+ return _context70.stop();
10892
11241
  }
10893
11242
  }
10894
- }, _callee67, this);
11243
+ }, _callee70, this);
10895
11244
  }));
10896
11245
 
10897
- function deleteSegment(_x97) {
11246
+ function deleteSegment(_x101) {
10898
11247
  return _deleteSegment.apply(this, arguments);
10899
11248
  }
10900
11249
 
@@ -10912,26 +11261,26 @@ var StreamChat = /*#__PURE__*/function () {
10912
11261
  }, {
10913
11262
  key: "segmentTargetExists",
10914
11263
  value: function () {
10915
- var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(segmentId, targetId) {
10916
- return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
11264
+ var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(segmentId, targetId) {
11265
+ return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
10917
11266
  while (1) {
10918
- switch (_context68.prev = _context68.next) {
11267
+ switch (_context71.prev = _context71.next) {
10919
11268
  case 0:
10920
- _context68.next = 2;
11269
+ _context71.next = 2;
10921
11270
  return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
10922
11271
 
10923
11272
  case 2:
10924
- return _context68.abrupt("return", _context68.sent);
11273
+ return _context71.abrupt("return", _context71.sent);
10925
11274
 
10926
11275
  case 3:
10927
11276
  case "end":
10928
- return _context68.stop();
11277
+ return _context71.stop();
10929
11278
  }
10930
11279
  }
10931
- }, _callee68, this);
11280
+ }, _callee71, this);
10932
11281
  }));
10933
11282
 
10934
- function segmentTargetExists(_x98, _x99) {
11283
+ function segmentTargetExists(_x102, _x103) {
10935
11284
  return _segmentTargetExists.apply(this, arguments);
10936
11285
  }
10937
11286
 
@@ -10948,32 +11297,32 @@ var StreamChat = /*#__PURE__*/function () {
10948
11297
  }, {
10949
11298
  key: "createCampaign",
10950
11299
  value: function () {
10951
- var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(params) {
11300
+ var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(params) {
10952
11301
  var _yield$this$post2, campaign;
10953
11302
 
10954
- return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
11303
+ return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
10955
11304
  while (1) {
10956
- switch (_context69.prev = _context69.next) {
11305
+ switch (_context72.prev = _context72.next) {
10957
11306
  case 0:
10958
- _context69.next = 2;
11307
+ _context72.next = 2;
10959
11308
  return this.post(this.baseURL + "/campaigns", {
10960
11309
  campaign: params
10961
11310
  });
10962
11311
 
10963
11312
  case 2:
10964
- _yield$this$post2 = _context69.sent;
11313
+ _yield$this$post2 = _context72.sent;
10965
11314
  campaign = _yield$this$post2.campaign;
10966
- return _context69.abrupt("return", campaign);
11315
+ return _context72.abrupt("return", campaign);
10967
11316
 
10968
11317
  case 5:
10969
11318
  case "end":
10970
- return _context69.stop();
11319
+ return _context72.stop();
10971
11320
  }
10972
11321
  }
10973
- }, _callee69, this);
11322
+ }, _callee72, this);
10974
11323
  }));
10975
11324
 
10976
- function createCampaign(_x100) {
11325
+ function createCampaign(_x104) {
10977
11326
  return _createCampaign.apply(this, arguments);
10978
11327
  }
10979
11328
 
@@ -10989,15 +11338,15 @@ var StreamChat = /*#__PURE__*/function () {
10989
11338
  }, {
10990
11339
  key: "queryCampaigns",
10991
11340
  value: function () {
10992
- var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(filters) {
11341
+ var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(filters) {
10993
11342
  var options,
10994
- _args70 = arguments;
10995
- return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
11343
+ _args73 = arguments;
11344
+ return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
10996
11345
  while (1) {
10997
- switch (_context70.prev = _context70.next) {
11346
+ switch (_context73.prev = _context73.next) {
10998
11347
  case 0:
10999
- options = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {};
11000
- _context70.next = 3;
11348
+ options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11349
+ _context73.next = 3;
11001
11350
  return this.get(this.baseURL + "/campaigns", {
11002
11351
  payload: _objectSpread({
11003
11352
  filter_conditions: filters
@@ -11005,17 +11354,17 @@ var StreamChat = /*#__PURE__*/function () {
11005
11354
  });
11006
11355
 
11007
11356
  case 3:
11008
- return _context70.abrupt("return", _context70.sent);
11357
+ return _context73.abrupt("return", _context73.sent);
11009
11358
 
11010
11359
  case 4:
11011
11360
  case "end":
11012
- return _context70.stop();
11361
+ return _context73.stop();
11013
11362
  }
11014
11363
  }
11015
- }, _callee70, this);
11364
+ }, _callee73, this);
11016
11365
  }));
11017
11366
 
11018
- function queryCampaigns(_x101) {
11367
+ function queryCampaigns(_x105) {
11019
11368
  return _queryCampaigns.apply(this, arguments);
11020
11369
  }
11021
11370
 
@@ -11033,32 +11382,32 @@ var StreamChat = /*#__PURE__*/function () {
11033
11382
  }, {
11034
11383
  key: "updateCampaign",
11035
11384
  value: function () {
11036
- var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(id, params) {
11385
+ var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id, params) {
11037
11386
  var _yield$this$put2, campaign;
11038
11387
 
11039
- return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
11388
+ return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11040
11389
  while (1) {
11041
- switch (_context71.prev = _context71.next) {
11390
+ switch (_context74.prev = _context74.next) {
11042
11391
  case 0:
11043
- _context71.next = 2;
11392
+ _context74.next = 2;
11044
11393
  return this.put(this.baseURL + "/campaigns/".concat(id), {
11045
11394
  campaign: params
11046
11395
  });
11047
11396
 
11048
11397
  case 2:
11049
- _yield$this$put2 = _context71.sent;
11398
+ _yield$this$put2 = _context74.sent;
11050
11399
  campaign = _yield$this$put2.campaign;
11051
- return _context71.abrupt("return", campaign);
11400
+ return _context74.abrupt("return", campaign);
11052
11401
 
11053
11402
  case 5:
11054
11403
  case "end":
11055
- return _context71.stop();
11404
+ return _context74.stop();
11056
11405
  }
11057
11406
  }
11058
- }, _callee71, this);
11407
+ }, _callee74, this);
11059
11408
  }));
11060
11409
 
11061
- function updateCampaign(_x102, _x103) {
11410
+ function updateCampaign(_x106, _x107) {
11062
11411
  return _updateCampaign.apply(this, arguments);
11063
11412
  }
11064
11413
 
@@ -11075,25 +11424,25 @@ var StreamChat = /*#__PURE__*/function () {
11075
11424
  }, {
11076
11425
  key: "deleteCampaign",
11077
11426
  value: function () {
11078
- var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(id) {
11427
+ var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11079
11428
  var params,
11080
- _args72 = arguments;
11081
- return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
11429
+ _args75 = arguments;
11430
+ return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11082
11431
  while (1) {
11083
- switch (_context72.prev = _context72.next) {
11432
+ switch (_context75.prev = _context75.next) {
11084
11433
  case 0:
11085
- params = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {};
11086
- return _context72.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11434
+ params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11435
+ return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11087
11436
 
11088
11437
  case 2:
11089
11438
  case "end":
11090
- return _context72.stop();
11439
+ return _context75.stop();
11091
11440
  }
11092
11441
  }
11093
- }, _callee72, this);
11442
+ }, _callee75, this);
11094
11443
  }));
11095
11444
 
11096
- function deleteCampaign(_x104) {
11445
+ function deleteCampaign(_x108) {
11097
11446
  return _deleteCampaign.apply(this, arguments);
11098
11447
  }
11099
11448
 
@@ -11111,33 +11460,33 @@ var StreamChat = /*#__PURE__*/function () {
11111
11460
  }, {
11112
11461
  key: "scheduleCampaign",
11113
11462
  value: function () {
11114
- var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(id, params) {
11463
+ var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11115
11464
  var scheduledFor, _yield$this$patch, campaign;
11116
11465
 
11117
- return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
11466
+ return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11118
11467
  while (1) {
11119
- switch (_context73.prev = _context73.next) {
11468
+ switch (_context76.prev = _context76.next) {
11120
11469
  case 0:
11121
11470
  scheduledFor = params.scheduledFor;
11122
- _context73.next = 3;
11471
+ _context76.next = 3;
11123
11472
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
11124
11473
  scheduled_for: scheduledFor
11125
11474
  });
11126
11475
 
11127
11476
  case 3:
11128
- _yield$this$patch = _context73.sent;
11477
+ _yield$this$patch = _context76.sent;
11129
11478
  campaign = _yield$this$patch.campaign;
11130
- return _context73.abrupt("return", campaign);
11479
+ return _context76.abrupt("return", campaign);
11131
11480
 
11132
11481
  case 6:
11133
11482
  case "end":
11134
- return _context73.stop();
11483
+ return _context76.stop();
11135
11484
  }
11136
11485
  }
11137
- }, _callee73, this);
11486
+ }, _callee76, this);
11138
11487
  }));
11139
11488
 
11140
- function scheduleCampaign(_x105, _x106) {
11489
+ function scheduleCampaign(_x109, _x110) {
11141
11490
  return _scheduleCampaign.apply(this, arguments);
11142
11491
  }
11143
11492
 
@@ -11154,30 +11503,30 @@ var StreamChat = /*#__PURE__*/function () {
11154
11503
  }, {
11155
11504
  key: "stopCampaign",
11156
11505
  value: function () {
11157
- var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id) {
11506
+ var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(id) {
11158
11507
  var _yield$this$patch2, campaign;
11159
11508
 
11160
- return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11509
+ return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11161
11510
  while (1) {
11162
- switch (_context74.prev = _context74.next) {
11511
+ switch (_context77.prev = _context77.next) {
11163
11512
  case 0:
11164
- _context74.next = 2;
11513
+ _context77.next = 2;
11165
11514
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
11166
11515
 
11167
11516
  case 2:
11168
- _yield$this$patch2 = _context74.sent;
11517
+ _yield$this$patch2 = _context77.sent;
11169
11518
  campaign = _yield$this$patch2.campaign;
11170
- return _context74.abrupt("return", campaign);
11519
+ return _context77.abrupt("return", campaign);
11171
11520
 
11172
11521
  case 5:
11173
11522
  case "end":
11174
- return _context74.stop();
11523
+ return _context77.stop();
11175
11524
  }
11176
11525
  }
11177
- }, _callee74, this);
11526
+ }, _callee77, this);
11178
11527
  }));
11179
11528
 
11180
- function stopCampaign(_x107) {
11529
+ function stopCampaign(_x111) {
11181
11530
  return _stopCampaign.apply(this, arguments);
11182
11531
  }
11183
11532
 
@@ -11194,30 +11543,30 @@ var StreamChat = /*#__PURE__*/function () {
11194
11543
  }, {
11195
11544
  key: "resumeCampaign",
11196
11545
  value: function () {
11197
- var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11546
+ var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11198
11547
  var _yield$this$patch3, campaign;
11199
11548
 
11200
- return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11549
+ return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11201
11550
  while (1) {
11202
- switch (_context75.prev = _context75.next) {
11551
+ switch (_context78.prev = _context78.next) {
11203
11552
  case 0:
11204
- _context75.next = 2;
11553
+ _context78.next = 2;
11205
11554
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
11206
11555
 
11207
11556
  case 2:
11208
- _yield$this$patch3 = _context75.sent;
11557
+ _yield$this$patch3 = _context78.sent;
11209
11558
  campaign = _yield$this$patch3.campaign;
11210
- return _context75.abrupt("return", campaign);
11559
+ return _context78.abrupt("return", campaign);
11211
11560
 
11212
11561
  case 5:
11213
11562
  case "end":
11214
- return _context75.stop();
11563
+ return _context78.stop();
11215
11564
  }
11216
11565
  }
11217
- }, _callee75, this);
11566
+ }, _callee78, this);
11218
11567
  }));
11219
11568
 
11220
- function resumeCampaign(_x108) {
11569
+ function resumeCampaign(_x112) {
11221
11570
  return _resumeCampaign.apply(this, arguments);
11222
11571
  }
11223
11572
 
@@ -11235,30 +11584,30 @@ var StreamChat = /*#__PURE__*/function () {
11235
11584
  }, {
11236
11585
  key: "testCampaign",
11237
11586
  value: function () {
11238
- var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11587
+ var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(id, params) {
11239
11588
  var users;
11240
- return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11589
+ return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11241
11590
  while (1) {
11242
- switch (_context76.prev = _context76.next) {
11591
+ switch (_context79.prev = _context79.next) {
11243
11592
  case 0:
11244
11593
  users = params.users;
11245
- _context76.next = 3;
11594
+ _context79.next = 3;
11246
11595
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
11247
11596
  users: users
11248
11597
  });
11249
11598
 
11250
11599
  case 3:
11251
- return _context76.abrupt("return", _context76.sent);
11600
+ return _context79.abrupt("return", _context79.sent);
11252
11601
 
11253
11602
  case 4:
11254
11603
  case "end":
11255
- return _context76.stop();
11604
+ return _context79.stop();
11256
11605
  }
11257
11606
  }
11258
- }, _callee76, this);
11607
+ }, _callee79, this);
11259
11608
  }));
11260
11609
 
11261
- function testCampaign(_x109, _x110) {
11610
+ function testCampaign(_x113, _x114) {
11262
11611
  return _testCampaign.apply(this, arguments);
11263
11612
  }
11264
11613
 
@@ -11274,24 +11623,24 @@ var StreamChat = /*#__PURE__*/function () {
11274
11623
  }, {
11275
11624
  key: "enrichURL",
11276
11625
  value: function () {
11277
- var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(url) {
11278
- return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11626
+ var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(url) {
11627
+ return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11279
11628
  while (1) {
11280
- switch (_context77.prev = _context77.next) {
11629
+ switch (_context80.prev = _context80.next) {
11281
11630
  case 0:
11282
- return _context77.abrupt("return", this.get(this.baseURL + "/og", {
11631
+ return _context80.abrupt("return", this.get(this.baseURL + "/og", {
11283
11632
  url: url
11284
11633
  }));
11285
11634
 
11286
11635
  case 1:
11287
11636
  case "end":
11288
- return _context77.stop();
11637
+ return _context80.stop();
11289
11638
  }
11290
11639
  }
11291
- }, _callee77, this);
11640
+ }, _callee80, this);
11292
11641
  }));
11293
11642
 
11294
- function enrichURL(_x111) {
11643
+ function enrichURL(_x115) {
11295
11644
  return _enrichURL.apply(this, arguments);
11296
11645
  }
11297
11646
 
@@ -11308,22 +11657,22 @@ var StreamChat = /*#__PURE__*/function () {
11308
11657
  }, {
11309
11658
  key: "getTask",
11310
11659
  value: function () {
11311
- var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11312
- return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11660
+ var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
11661
+ return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11313
11662
  while (1) {
11314
- switch (_context78.prev = _context78.next) {
11663
+ switch (_context81.prev = _context81.next) {
11315
11664
  case 0:
11316
- return _context78.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11665
+ return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11317
11666
 
11318
11667
  case 1:
11319
11668
  case "end":
11320
- return _context78.stop();
11669
+ return _context81.stop();
11321
11670
  }
11322
11671
  }
11323
- }, _callee78, this);
11672
+ }, _callee81, this);
11324
11673
  }));
11325
11674
 
11326
- function getTask(_x112) {
11675
+ function getTask(_x116) {
11327
11676
  return _getTask.apply(this, arguments);
11328
11677
  }
11329
11678
 
@@ -11341,31 +11690,31 @@ var StreamChat = /*#__PURE__*/function () {
11341
11690
  }, {
11342
11691
  key: "deleteChannels",
11343
11692
  value: function () {
11344
- var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(cids) {
11693
+ var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(cids) {
11345
11694
  var options,
11346
- _args79 = arguments;
11347
- return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11695
+ _args82 = arguments;
11696
+ return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11348
11697
  while (1) {
11349
- switch (_context79.prev = _context79.next) {
11698
+ switch (_context82.prev = _context82.next) {
11350
11699
  case 0:
11351
- options = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {};
11352
- _context79.next = 3;
11700
+ options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11701
+ _context82.next = 3;
11353
11702
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11354
11703
  cids: cids
11355
11704
  }, options));
11356
11705
 
11357
11706
  case 3:
11358
- return _context79.abrupt("return", _context79.sent);
11707
+ return _context82.abrupt("return", _context82.sent);
11359
11708
 
11360
11709
  case 4:
11361
11710
  case "end":
11362
- return _context79.stop();
11711
+ return _context82.stop();
11363
11712
  }
11364
11713
  }
11365
- }, _callee79, this);
11714
+ }, _callee82, this);
11366
11715
  }));
11367
11716
 
11368
- function deleteChannels(_x113) {
11717
+ function deleteChannels(_x117) {
11369
11718
  return _deleteChannels.apply(this, arguments);
11370
11719
  }
11371
11720
 
@@ -11383,17 +11732,17 @@ var StreamChat = /*#__PURE__*/function () {
11383
11732
  }, {
11384
11733
  key: "deleteUsers",
11385
11734
  value: function () {
11386
- var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(user_ids) {
11735
+ var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(user_ids) {
11387
11736
  var options,
11388
- _args80 = arguments;
11389
- return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11737
+ _args83 = arguments;
11738
+ return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11390
11739
  while (1) {
11391
- switch (_context80.prev = _context80.next) {
11740
+ switch (_context83.prev = _context83.next) {
11392
11741
  case 0:
11393
- options = _args80.length > 1 && _args80[1] !== undefined ? _args80[1] : {};
11742
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
11394
11743
 
11395
11744
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11396
- _context80.next = 3;
11745
+ _context83.next = 3;
11397
11746
  break;
11398
11747
  }
11399
11748
 
@@ -11401,7 +11750,7 @@ var StreamChat = /*#__PURE__*/function () {
11401
11750
 
11402
11751
  case 3:
11403
11752
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11404
- _context80.next = 5;
11753
+ _context83.next = 5;
11405
11754
  break;
11406
11755
  }
11407
11756
 
@@ -11409,30 +11758,30 @@ var StreamChat = /*#__PURE__*/function () {
11409
11758
 
11410
11759
  case 5:
11411
11760
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11412
- _context80.next = 7;
11761
+ _context83.next = 7;
11413
11762
  break;
11414
11763
  }
11415
11764
 
11416
11765
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11417
11766
 
11418
11767
  case 7:
11419
- _context80.next = 9;
11768
+ _context83.next = 9;
11420
11769
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11421
11770
  user_ids: user_ids
11422
11771
  }, options));
11423
11772
 
11424
11773
  case 9:
11425
- return _context80.abrupt("return", _context80.sent);
11774
+ return _context83.abrupt("return", _context83.sent);
11426
11775
 
11427
11776
  case 10:
11428
11777
  case "end":
11429
- return _context80.stop();
11778
+ return _context83.stop();
11430
11779
  }
11431
11780
  }
11432
- }, _callee80, this);
11781
+ }, _callee83, this);
11433
11782
  }));
11434
11783
 
11435
- function deleteUsers(_x114) {
11784
+ function deleteUsers(_x118) {
11436
11785
  return _deleteUsers.apply(this, arguments);
11437
11786
  }
11438
11787
 
@@ -11453,28 +11802,28 @@ var StreamChat = /*#__PURE__*/function () {
11453
11802
  }, {
11454
11803
  key: "_createImportURL",
11455
11804
  value: function () {
11456
- var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(filename) {
11457
- return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11805
+ var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(filename) {
11806
+ return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11458
11807
  while (1) {
11459
- switch (_context81.prev = _context81.next) {
11808
+ switch (_context84.prev = _context84.next) {
11460
11809
  case 0:
11461
- _context81.next = 2;
11810
+ _context84.next = 2;
11462
11811
  return this.post(this.baseURL + "/import_urls", {
11463
11812
  filename: filename
11464
11813
  });
11465
11814
 
11466
11815
  case 2:
11467
- return _context81.abrupt("return", _context81.sent);
11816
+ return _context84.abrupt("return", _context84.sent);
11468
11817
 
11469
11818
  case 3:
11470
11819
  case "end":
11471
- return _context81.stop();
11820
+ return _context84.stop();
11472
11821
  }
11473
11822
  }
11474
- }, _callee81, this);
11823
+ }, _callee84, this);
11475
11824
  }));
11476
11825
 
11477
- function _createImportURL(_x115) {
11826
+ function _createImportURL(_x119) {
11478
11827
  return _createImportURL2.apply(this, arguments);
11479
11828
  }
11480
11829
 
@@ -11496,33 +11845,33 @@ var StreamChat = /*#__PURE__*/function () {
11496
11845
  }, {
11497
11846
  key: "_createImport",
11498
11847
  value: function () {
11499
- var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(path) {
11848
+ var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(path) {
11500
11849
  var options,
11501
- _args82 = arguments;
11502
- return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11850
+ _args85 = arguments;
11851
+ return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11503
11852
  while (1) {
11504
- switch (_context82.prev = _context82.next) {
11853
+ switch (_context85.prev = _context85.next) {
11505
11854
  case 0:
11506
- options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {
11855
+ options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
11507
11856
  mode: 'upsert'
11508
11857
  };
11509
- _context82.next = 3;
11858
+ _context85.next = 3;
11510
11859
  return this.post(this.baseURL + "/imports", _objectSpread({
11511
11860
  path: path
11512
11861
  }, options));
11513
11862
 
11514
11863
  case 3:
11515
- return _context82.abrupt("return", _context82.sent);
11864
+ return _context85.abrupt("return", _context85.sent);
11516
11865
 
11517
11866
  case 4:
11518
11867
  case "end":
11519
- return _context82.stop();
11868
+ return _context85.stop();
11520
11869
  }
11521
11870
  }
11522
- }, _callee82, this);
11871
+ }, _callee85, this);
11523
11872
  }));
11524
11873
 
11525
- function _createImport(_x116) {
11874
+ function _createImport(_x120) {
11526
11875
  return _createImport2.apply(this, arguments);
11527
11876
  }
11528
11877
 
@@ -11544,26 +11893,26 @@ var StreamChat = /*#__PURE__*/function () {
11544
11893
  }, {
11545
11894
  key: "_getImport",
11546
11895
  value: function () {
11547
- var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(id) {
11548
- return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11896
+ var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(id) {
11897
+ return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
11549
11898
  while (1) {
11550
- switch (_context83.prev = _context83.next) {
11899
+ switch (_context86.prev = _context86.next) {
11551
11900
  case 0:
11552
- _context83.next = 2;
11901
+ _context86.next = 2;
11553
11902
  return this.get(this.baseURL + "/imports/".concat(id));
11554
11903
 
11555
11904
  case 2:
11556
- return _context83.abrupt("return", _context83.sent);
11905
+ return _context86.abrupt("return", _context86.sent);
11557
11906
 
11558
11907
  case 3:
11559
11908
  case "end":
11560
- return _context83.stop();
11909
+ return _context86.stop();
11561
11910
  }
11562
11911
  }
11563
- }, _callee83, this);
11912
+ }, _callee86, this);
11564
11913
  }));
11565
11914
 
11566
- function _getImport(_x117) {
11915
+ function _getImport(_x121) {
11567
11916
  return _getImport2.apply(this, arguments);
11568
11917
  }
11569
11918
 
@@ -11585,26 +11934,26 @@ var StreamChat = /*#__PURE__*/function () {
11585
11934
  }, {
11586
11935
  key: "_listImports",
11587
11936
  value: function () {
11588
- var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(options) {
11589
- return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11937
+ var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87(options) {
11938
+ return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
11590
11939
  while (1) {
11591
- switch (_context84.prev = _context84.next) {
11940
+ switch (_context87.prev = _context87.next) {
11592
11941
  case 0:
11593
- _context84.next = 2;
11942
+ _context87.next = 2;
11594
11943
  return this.get(this.baseURL + "/imports", options);
11595
11944
 
11596
11945
  case 2:
11597
- return _context84.abrupt("return", _context84.sent);
11946
+ return _context87.abrupt("return", _context87.sent);
11598
11947
 
11599
11948
  case 3:
11600
11949
  case "end":
11601
- return _context84.stop();
11950
+ return _context87.stop();
11602
11951
  }
11603
11952
  }
11604
- }, _callee84, this);
11953
+ }, _callee87, this);
11605
11954
  }));
11606
11955
 
11607
- function _listImports(_x118) {
11956
+ function _listImports(_x122) {
11608
11957
  return _listImports2.apply(this, arguments);
11609
11958
  }
11610
11959
 
@@ -11623,28 +11972,28 @@ var StreamChat = /*#__PURE__*/function () {
11623
11972
  }, {
11624
11973
  key: "upsertPushProvider",
11625
11974
  value: function () {
11626
- var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(pushProvider) {
11627
- return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11975
+ var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(pushProvider) {
11976
+ return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
11628
11977
  while (1) {
11629
- switch (_context85.prev = _context85.next) {
11978
+ switch (_context88.prev = _context88.next) {
11630
11979
  case 0:
11631
- _context85.next = 2;
11980
+ _context88.next = 2;
11632
11981
  return this.post(this.baseURL + "/push_providers", {
11633
11982
  push_provider: pushProvider
11634
11983
  });
11635
11984
 
11636
11985
  case 2:
11637
- return _context85.abrupt("return", _context85.sent);
11986
+ return _context88.abrupt("return", _context88.sent);
11638
11987
 
11639
11988
  case 3:
11640
11989
  case "end":
11641
- return _context85.stop();
11990
+ return _context88.stop();
11642
11991
  }
11643
11992
  }
11644
- }, _callee85, this);
11993
+ }, _callee88, this);
11645
11994
  }));
11646
11995
 
11647
- function upsertPushProvider(_x119) {
11996
+ function upsertPushProvider(_x123) {
11648
11997
  return _upsertPushProvider.apply(this, arguments);
11649
11998
  }
11650
11999
 
@@ -11663,28 +12012,28 @@ var StreamChat = /*#__PURE__*/function () {
11663
12012
  }, {
11664
12013
  key: "deletePushProvider",
11665
12014
  value: function () {
11666
- var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(_ref10) {
12015
+ var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee89(_ref10) {
11667
12016
  var type, name;
11668
- return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
12017
+ return _regeneratorRuntime__default['default'].wrap(function _callee89$(_context89) {
11669
12018
  while (1) {
11670
- switch (_context86.prev = _context86.next) {
12019
+ switch (_context89.prev = _context89.next) {
11671
12020
  case 0:
11672
12021
  type = _ref10.type, name = _ref10.name;
11673
- _context86.next = 3;
12022
+ _context89.next = 3;
11674
12023
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11675
12024
 
11676
12025
  case 3:
11677
- return _context86.abrupt("return", _context86.sent);
12026
+ return _context89.abrupt("return", _context89.sent);
11678
12027
 
11679
12028
  case 4:
11680
12029
  case "end":
11681
- return _context86.stop();
12030
+ return _context89.stop();
11682
12031
  }
11683
12032
  }
11684
- }, _callee86, this);
12033
+ }, _callee89, this);
11685
12034
  }));
11686
12035
 
11687
- function deletePushProvider(_x120) {
12036
+ function deletePushProvider(_x124) {
11688
12037
  return _deletePushProvider.apply(this, arguments);
11689
12038
  }
11690
12039
 
@@ -11701,23 +12050,23 @@ var StreamChat = /*#__PURE__*/function () {
11701
12050
  }, {
11702
12051
  key: "listPushProviders",
11703
12052
  value: function () {
11704
- var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87() {
11705
- return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
12053
+ var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee90() {
12054
+ return _regeneratorRuntime__default['default'].wrap(function _callee90$(_context90) {
11706
12055
  while (1) {
11707
- switch (_context87.prev = _context87.next) {
12056
+ switch (_context90.prev = _context90.next) {
11708
12057
  case 0:
11709
- _context87.next = 2;
12058
+ _context90.next = 2;
11710
12059
  return this.get(this.baseURL + "/push_providers");
11711
12060
 
11712
12061
  case 2:
11713
- return _context87.abrupt("return", _context87.sent);
12062
+ return _context90.abrupt("return", _context90.sent);
11714
12063
 
11715
12064
  case 3:
11716
12065
  case "end":
11717
- return _context87.stop();
12066
+ return _context90.stop();
11718
12067
  }
11719
12068
  }
11720
- }, _callee87, this);
12069
+ }, _callee90, this);
11721
12070
  }));
11722
12071
 
11723
12072
  function listPushProviders() {
@@ -11745,26 +12094,26 @@ var StreamChat = /*#__PURE__*/function () {
11745
12094
  }, {
11746
12095
  key: "commitMessage",
11747
12096
  value: function () {
11748
- var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(id) {
11749
- return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
12097
+ var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee91(id) {
12098
+ return _regeneratorRuntime__default['default'].wrap(function _callee91$(_context91) {
11750
12099
  while (1) {
11751
- switch (_context88.prev = _context88.next) {
12100
+ switch (_context91.prev = _context91.next) {
11752
12101
  case 0:
11753
- _context88.next = 2;
12102
+ _context91.next = 2;
11754
12103
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
11755
12104
 
11756
12105
  case 2:
11757
- return _context88.abrupt("return", _context88.sent);
12106
+ return _context91.abrupt("return", _context91.sent);
11758
12107
 
11759
12108
  case 3:
11760
12109
  case "end":
11761
- return _context88.stop();
12110
+ return _context91.stop();
11762
12111
  }
11763
12112
  }
11764
- }, _callee88, this);
12113
+ }, _callee91, this);
11765
12114
  }));
11766
12115
 
11767
- function commitMessage(_x121) {
12116
+ function commitMessage(_x125) {
11768
12117
  return _commitMessage.apply(this, arguments);
11769
12118
  }
11770
12119
 
@@ -11820,6 +12169,7 @@ var EVENT_MAP = {
11820
12169
  'notification.message_new': true,
11821
12170
  'notification.mutes_updated': true,
11822
12171
  'notification.removed_from_channel': true,
12172
+ 'notification.thread_message_new': true,
11823
12173
  'reaction.deleted': true,
11824
12174
  'reaction.new': true,
11825
12175
  'reaction.updated': true,
@@ -11938,6 +12288,7 @@ exports.MinPriority = MinPriority;
11938
12288
  exports.Permission = Permission;
11939
12289
  exports.StableWSConnection = StableWSConnection;
11940
12290
  exports.StreamChat = StreamChat;
12291
+ exports.Thread = Thread;
11941
12292
  exports.TokenManager = TokenManager;
11942
12293
  exports.UserFromToken = UserFromToken;
11943
12294
  exports.buildWsFatalInsight = buildWsFatalInsight;
@@ -11945,6 +12296,7 @@ exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
11945
12296
  exports.chatCodes = chatCodes;
11946
12297
  exports.decodeBase64 = decodeBase64;
11947
12298
  exports.encodeBase64 = encodeBase64;
12299
+ exports.formatMessage = formatMessage;
11948
12300
  exports.isOwnUser = isOwnUser;
11949
12301
  exports.logChatPromiseExecution = logChatPromiseExecution;
11950
12302
  exports.postInsights = postInsights;