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/browser.js CHANGED
@@ -118,9 +118,347 @@ var decodeBase64 = function decodeBase64(s) {
118
118
 
119
119
  var https = null;
120
120
 
121
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
121
+ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
122
122
 
123
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
123
+ function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
124
+
125
+ function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
126
+
127
+ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
128
+
129
+ function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
130
+
131
+ /**
132
+ * logChatPromiseExecution - utility function for logging the execution of a promise..
133
+ * use this when you want to run the promise and handle errors by logging a warning
134
+ *
135
+ * @param {Promise<T>} promise The promise you want to run and log
136
+ * @param {string} name A descriptive name of what the promise does for log output
137
+ *
138
+ */
139
+ function logChatPromiseExecution(promise, name) {
140
+ promise.then().catch(function (error) {
141
+ console.warn("failed to do ".concat(name, ", ran into error: "), error);
142
+ });
143
+ }
144
+ var sleep = function sleep(m) {
145
+ return new Promise(function (r) {
146
+ return setTimeout(r, m);
147
+ });
148
+ };
149
+ function isFunction(value) {
150
+ return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
151
+ }
152
+ var chatCodes = {
153
+ TOKEN_EXPIRED: 40,
154
+ WS_CLOSED_SUCCESS: 1000
155
+ };
156
+
157
+ function isReadableStream(obj) {
158
+ return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
159
+ }
160
+
161
+ function isBuffer(obj) {
162
+ return obj != null && obj.constructor != null && // @ts-expect-error
163
+ typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
164
+ obj.constructor.isBuffer(obj);
165
+ }
166
+
167
+ function isFileWebAPI(uri) {
168
+ return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
169
+ }
170
+
171
+ function isOwnUser(user) {
172
+ return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
173
+ }
174
+
175
+ function isBlobWebAPI(uri) {
176
+ return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
177
+ }
178
+
179
+ function isOwnUserBaseProperty(property) {
180
+ var ownUserBaseProperties = {
181
+ channel_mutes: true,
182
+ devices: true,
183
+ mutes: true,
184
+ total_unread_count: true,
185
+ unread_channels: true,
186
+ unread_count: true,
187
+ invisible: true,
188
+ roles: true
189
+ };
190
+ return ownUserBaseProperties[property];
191
+ }
192
+ function addFileToFormData(uri, name, contentType) {
193
+ var data = new FormData__default['default']();
194
+
195
+ if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
196
+ if (name) data.append('file', uri, name);else data.append('file', uri);
197
+ } else {
198
+ data.append('file', {
199
+ uri: uri,
200
+ name: name || uri.split('/').reverse()[0],
201
+ contentType: contentType || undefined,
202
+ type: contentType || undefined
203
+ });
204
+ }
205
+
206
+ return data;
207
+ }
208
+ function normalizeQuerySort(sort) {
209
+ var sortFields = [];
210
+ var sortArr = Array.isArray(sort) ? sort : [sort];
211
+
212
+ var _iterator = _createForOfIteratorHelper$4(sortArr),
213
+ _step;
214
+
215
+ try {
216
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
217
+ var item = _step.value;
218
+ var entries = Object.entries(item);
219
+
220
+ if (entries.length > 1) {
221
+ console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
222
+ }
223
+
224
+ for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
225
+ var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
226
+ field = _entries$_i[0],
227
+ direction = _entries$_i[1];
228
+
229
+ sortFields.push({
230
+ field: field,
231
+ direction: direction
232
+ });
233
+ }
234
+ }
235
+ } catch (err) {
236
+ _iterator.e(err);
237
+ } finally {
238
+ _iterator.f();
239
+ }
240
+
241
+ return sortFields;
242
+ }
243
+ /**
244
+ * retryInterval - A retry interval which increases acc to number of failures
245
+ *
246
+ * @return {number} Duration to wait in milliseconds
247
+ */
248
+
249
+ function retryInterval(numberOfFailures) {
250
+ // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
251
+ var max = Math.min(500 + numberOfFailures * 2000, 25000);
252
+ var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
253
+ return Math.floor(Math.random() * (max - min) + min);
254
+ }
255
+ function randomId() {
256
+ return generateUUIDv4();
257
+ }
258
+
259
+ function hex(bytes) {
260
+ var s = '';
261
+
262
+ for (var i = 0; i < bytes.length; i++) {
263
+ s += bytes[i].toString(16).padStart(2, '0');
264
+ }
265
+
266
+ return s;
267
+ } // https://tools.ietf.org/html/rfc4122
268
+
269
+
270
+ function generateUUIDv4() {
271
+ var bytes = getRandomBytes(16);
272
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
273
+
274
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
275
+
276
+ return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
277
+ }
278
+
279
+ function getRandomValuesWithMathRandom(bytes) {
280
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
281
+
282
+ for (var i = 0; i < bytes.length; i++) {
283
+ bytes[i] = Math.random() * max;
284
+ }
285
+ }
286
+
287
+ var getRandomValues = function () {
288
+ var _crypto;
289
+
290
+ if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
291
+ return crypto.getRandomValues.bind(crypto);
292
+ } else if (typeof msCrypto !== 'undefined') {
293
+ return msCrypto.getRandomValues.bind(msCrypto);
294
+ } else {
295
+ return getRandomValuesWithMathRandom;
296
+ }
297
+ }();
298
+
299
+ function getRandomBytes(length) {
300
+ var bytes = new Uint8Array(length);
301
+ getRandomValues(bytes);
302
+ return bytes;
303
+ }
304
+
305
+ function convertErrorToJson(err) {
306
+ var jsonObj = {};
307
+ if (!err) return jsonObj;
308
+
309
+ try {
310
+ Object.getOwnPropertyNames(err).forEach(function (key) {
311
+ jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
312
+ });
313
+ } catch (_) {
314
+ return {
315
+ error: 'failed to serialize the error'
316
+ };
317
+ }
318
+
319
+ return jsonObj;
320
+ }
321
+ /**
322
+ * isOnline safely return the navigator.online value for browser env
323
+ * if navigator is not in global object, it always return true
324
+ */
325
+
326
+ function isOnline() {
327
+ var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
328
+
329
+ if (!nav) {
330
+ console.warn('isOnline failed to access window.navigator and assume browser is online');
331
+ return true;
332
+ } // RN navigator has undefined for onLine
333
+
334
+
335
+ if (typeof nav.onLine !== 'boolean') {
336
+ return true;
337
+ }
338
+
339
+ return nav.onLine;
340
+ }
341
+ /**
342
+ * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
343
+ */
344
+
345
+ function addConnectionEventListeners(cb) {
346
+ if (typeof window !== 'undefined' && window.addEventListener) {
347
+ window.addEventListener('offline', cb);
348
+ window.addEventListener('online', cb);
349
+ }
350
+ }
351
+ function removeConnectionEventListeners(cb) {
352
+ if (typeof window !== 'undefined' && window.removeEventListener) {
353
+ window.removeEventListener('offline', cb);
354
+ window.removeEventListener('online', cb);
355
+ }
356
+ }
357
+ var axiosParamsSerializer = function axiosParamsSerializer(params) {
358
+ var newParams = [];
359
+
360
+ for (var k in params) {
361
+ // Stream backend doesn't treat "undefined" value same as value not being present.
362
+ // So, we need to skip the undefined values.
363
+ if (params[k] === undefined) continue;
364
+
365
+ if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
366
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
367
+ } else {
368
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
369
+ }
370
+ }
371
+
372
+ return newParams.join('&');
373
+ };
374
+ /**
375
+ * formatMessage - Takes the message object. Parses the dates, sets __html
376
+ * and sets the status to received if missing. Returns a message object
377
+ *
378
+ * @param {MessageResponse<StreamChatGenerics>} message a message object
379
+ *
380
+ */
381
+
382
+ function formatMessage(message) {
383
+ return _objectSpread$8(_objectSpread$8({}, message), {}, {
384
+ /**
385
+ * @deprecated please use `html`
386
+ */
387
+ __html: message.html,
388
+ // parse the date..
389
+ pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
390
+ created_at: message.created_at ? new Date(message.created_at) : new Date(),
391
+ updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
392
+ status: message.status || 'received'
393
+ });
394
+ }
395
+ function addToMessageList(messages, message) {
396
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
397
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
398
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
399
+ var addMessageToList = addIfDoesNotExist || timestampChanged;
400
+ var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
401
+ // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
402
+
403
+ if (timestampChanged) {
404
+ messageArr = messageArr.filter(function (msg) {
405
+ return !(msg.id && message.id === msg.id);
406
+ });
407
+ } // Get array length after filtering
408
+
409
+
410
+ var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
411
+
412
+ if (messageArrayLength === 0 && addMessageToList) {
413
+ return messageArr.concat(message);
414
+ } else if (messageArrayLength === 0) {
415
+ return _toConsumableArray__default['default'](messageArr);
416
+ }
417
+
418
+ var messageTime = message[sortBy].getTime();
419
+ var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
420
+
421
+ if (messageIsNewest && addMessageToList) {
422
+ return messageArr.concat(message);
423
+ } else if (messageIsNewest) {
424
+ return _toConsumableArray__default['default'](messageArr);
425
+ } // find the closest index to push the new message
426
+
427
+
428
+ var left = 0;
429
+ var middle = 0;
430
+ var right = messageArrayLength - 1;
431
+
432
+ while (left <= right) {
433
+ middle = Math.floor((right + left) / 2);
434
+ if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
435
+ } // message already exists and not filtered due to timestampChanged, update and return
436
+
437
+
438
+ if (!timestampChanged && message.id) {
439
+ if (messageArr[left] && message.id === messageArr[left].id) {
440
+ messageArr[left] = message;
441
+ return _toConsumableArray__default['default'](messageArr);
442
+ }
443
+
444
+ if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
445
+ messageArr[left - 1] = message;
446
+ return _toConsumableArray__default['default'](messageArr);
447
+ }
448
+ } // Do not add updated or deleted messages to the list if they do not already exist
449
+ // or have a timestamp change.
450
+
451
+
452
+ if (addMessageToList) {
453
+ messageArr.splice(left, 0, message);
454
+ }
455
+
456
+ return _toConsumableArray__default['default'](messageArr);
457
+ }
458
+
459
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
460
+
461
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
124
462
 
125
463
  /**
126
464
  * ChannelState - A container class for the channel state.
@@ -197,7 +535,7 @@ var ChannelState = /*#__PURE__*/function () {
197
535
  var m = messages[i];
198
536
 
199
537
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
200
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
538
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
201
539
  user: user
202
540
  });
203
541
  }
@@ -252,7 +590,7 @@ var ChannelState = /*#__PURE__*/function () {
252
590
  user: m.user
253
591
  };
254
592
  } else {
255
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
593
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
256
594
  type: 'deleted',
257
595
  deleted_at: user.deleted_at
258
596
  });
@@ -359,7 +697,7 @@ var ChannelState = /*#__PURE__*/function () {
359
697
  }, {
360
698
  key: "formatMessage",
361
699
  value: function formatMessage(message) {
362
- return _objectSpread$6(_objectSpread$6({}, message), {}, {
700
+ return _objectSpread$7(_objectSpread$7({}, message), {}, {
363
701
  /**
364
702
  * @deprecated please use `html`
365
703
  */
@@ -577,7 +915,7 @@ var ChannelState = /*#__PURE__*/function () {
577
915
  var parseMessage = function parseMessage(m) {
578
916
  var _m$pinned_at, _m$updated_at;
579
917
 
580
- return _objectSpread$6(_objectSpread$6({}, m), {}, {
918
+ return _objectSpread$7(_objectSpread$7({}, m), {}, {
581
919
  created_at: m.created_at.toISOString(),
582
920
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
583
921
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
@@ -588,8 +926,8 @@ var ChannelState = /*#__PURE__*/function () {
588
926
  var updatedMessages = set.messages.filter(function (msg) {
589
927
  return msg.quoted_message_id === message.id;
590
928
  }).map(parseMessage).map(function (msg) {
591
- return _objectSpread$6(_objectSpread$6({}, msg), {}, {
592
- quoted_message: _objectSpread$6(_objectSpread$6({}, message), {}, {
929
+ return _objectSpread$7(_objectSpread$7({}, msg), {}, {
930
+ quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
593
931
  attachments: []
594
932
  })
595
933
  });
@@ -665,71 +1003,14 @@ var ChannelState = /*#__PURE__*/function () {
665
1003
  * @param {Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>} messages A list of messages
666
1004
  * @param message
667
1005
  * @param {boolean} timestampChanged Whether updating a message with changed created_at value.
668
- * @param {string} sortBy field name to use to sort the messages by
669
- * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
670
- */
671
- function _addToMessageList(messages, message) {
672
- var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
673
- var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
674
- var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
675
- var addMessageToList = addIfDoesNotExist || timestampChanged;
676
- var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
677
- // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
678
-
679
- if (timestampChanged) {
680
- messageArr = messageArr.filter(function (msg) {
681
- return !(msg.id && message.id === msg.id);
682
- });
683
- } // Get array length after filtering
684
-
685
-
686
- var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
687
-
688
- if (messageArrayLength === 0 && addMessageToList) {
689
- return messageArr.concat(message);
690
- } else if (messageArrayLength === 0) {
691
- return _toConsumableArray__default['default'](messageArr);
692
- }
693
-
694
- var messageTime = message[sortBy].getTime();
695
- var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
696
-
697
- if (messageIsNewest && addMessageToList) {
698
- return messageArr.concat(message);
699
- } else if (messageIsNewest) {
700
- return _toConsumableArray__default['default'](messageArr);
701
- } // find the closest index to push the new message
702
-
703
-
704
- var left = 0;
705
- var middle = 0;
706
- var right = messageArrayLength - 1;
707
-
708
- while (left <= right) {
709
- middle = Math.floor((right + left) / 2);
710
- if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
711
- } // message already exists and not filtered due to timestampChanged, update and return
712
-
713
-
714
- if (!timestampChanged && message.id) {
715
- if (messageArr[left] && message.id === messageArr[left].id) {
716
- messageArr[left] = message;
717
- return _toConsumableArray__default['default'](messageArr);
718
- }
719
-
720
- if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
721
- messageArr[left - 1] = message;
722
- return _toConsumableArray__default['default'](messageArr);
723
- }
724
- } // Do not add updated or deleted messages to the list if they do not already exist
725
- // or have a timestamp change.
726
-
727
-
728
- if (addMessageToList) {
729
- messageArr.splice(left, 0, message);
730
- }
731
-
732
- return _toConsumableArray__default['default'](messageArr);
1006
+ * @param {string} sortBy field name to use to sort the messages by
1007
+ * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
1008
+ */
1009
+ function _addToMessageList(messages, message) {
1010
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1011
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
1012
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1013
+ return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
733
1014
  }
734
1015
  /**
735
1016
  * removeMessage - Description
@@ -1092,277 +1373,27 @@ var ChannelState = /*#__PURE__*/function () {
1092
1373
  } else {
1093
1374
  // assumes that all new messages belong to the same set
1094
1375
  targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
1095
- }
1096
-
1097
- return {
1098
- targetMessageSetIndex: targetMessageSetIndex,
1099
- messagesToAdd: messagesToAdd
1100
- };
1101
- }
1102
- }]);
1103
-
1104
- return ChannelState;
1105
- }();
1106
-
1107
- function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1108
-
1109
- function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1110
-
1111
- function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1112
-
1113
- /**
1114
- * logChatPromiseExecution - utility function for logging the execution of a promise..
1115
- * use this when you want to run the promise and handle errors by logging a warning
1116
- *
1117
- * @param {Promise<T>} promise The promise you want to run and log
1118
- * @param {string} name A descriptive name of what the promise does for log output
1119
- *
1120
- */
1121
- function logChatPromiseExecution(promise, name) {
1122
- promise.then().catch(function (error) {
1123
- console.warn("failed to do ".concat(name, ", ran into error: "), error);
1124
- });
1125
- }
1126
- var sleep = function sleep(m) {
1127
- return new Promise(function (r) {
1128
- return setTimeout(r, m);
1129
- });
1130
- };
1131
- function isFunction(value) {
1132
- return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
1133
- }
1134
- var chatCodes = {
1135
- TOKEN_EXPIRED: 40,
1136
- WS_CLOSED_SUCCESS: 1000
1137
- };
1138
-
1139
- function isReadableStream(obj) {
1140
- return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
1141
- }
1142
-
1143
- function isBuffer(obj) {
1144
- return obj != null && obj.constructor != null && // @ts-expect-error
1145
- typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
1146
- obj.constructor.isBuffer(obj);
1147
- }
1148
-
1149
- function isFileWebAPI(uri) {
1150
- return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
1151
- }
1152
-
1153
- function isOwnUser(user) {
1154
- return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
1155
- }
1156
-
1157
- function isBlobWebAPI(uri) {
1158
- return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
1159
- }
1160
-
1161
- function isOwnUserBaseProperty(property) {
1162
- var ownUserBaseProperties = {
1163
- channel_mutes: true,
1164
- devices: true,
1165
- mutes: true,
1166
- total_unread_count: true,
1167
- unread_channels: true,
1168
- unread_count: true,
1169
- invisible: true,
1170
- roles: true
1171
- };
1172
- return ownUserBaseProperties[property];
1173
- }
1174
- function addFileToFormData(uri, name, contentType) {
1175
- var data = new FormData__default['default']();
1176
-
1177
- if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
1178
- if (name) data.append('file', uri, name);else data.append('file', uri);
1179
- } else {
1180
- data.append('file', {
1181
- uri: uri,
1182
- name: name || uri.split('/').reverse()[0],
1183
- contentType: contentType || undefined,
1184
- type: contentType || undefined
1185
- });
1186
- }
1187
-
1188
- return data;
1189
- }
1190
- function normalizeQuerySort(sort) {
1191
- var sortFields = [];
1192
- var sortArr = Array.isArray(sort) ? sort : [sort];
1193
-
1194
- var _iterator = _createForOfIteratorHelper$3(sortArr),
1195
- _step;
1196
-
1197
- try {
1198
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1199
- var item = _step.value;
1200
- var entries = Object.entries(item);
1201
-
1202
- if (entries.length > 1) {
1203
- console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
1204
- }
1205
-
1206
- for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
1207
- var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
1208
- field = _entries$_i[0],
1209
- direction = _entries$_i[1];
1210
-
1211
- sortFields.push({
1212
- field: field,
1213
- direction: direction
1214
- });
1215
- }
1216
- }
1217
- } catch (err) {
1218
- _iterator.e(err);
1219
- } finally {
1220
- _iterator.f();
1221
- }
1222
-
1223
- return sortFields;
1224
- }
1225
- /**
1226
- * retryInterval - A retry interval which increases acc to number of failures
1227
- *
1228
- * @return {number} Duration to wait in milliseconds
1229
- */
1230
-
1231
- function retryInterval(numberOfFailures) {
1232
- // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
1233
- var max = Math.min(500 + numberOfFailures * 2000, 25000);
1234
- var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
1235
- return Math.floor(Math.random() * (max - min) + min);
1236
- }
1237
- function randomId() {
1238
- return generateUUIDv4();
1239
- }
1240
-
1241
- function hex(bytes) {
1242
- var s = '';
1243
-
1244
- for (var i = 0; i < bytes.length; i++) {
1245
- s += bytes[i].toString(16).padStart(2, '0');
1246
- }
1247
-
1248
- return s;
1249
- } // https://tools.ietf.org/html/rfc4122
1250
-
1251
-
1252
- function generateUUIDv4() {
1253
- var bytes = getRandomBytes(16);
1254
- bytes[6] = bytes[6] & 0x0f | 0x40; // version
1255
-
1256
- bytes[8] = bytes[8] & 0xbf | 0x80; // variant
1257
-
1258
- return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
1259
- }
1260
-
1261
- function getRandomValuesWithMathRandom(bytes) {
1262
- var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
1263
-
1264
- for (var i = 0; i < bytes.length; i++) {
1265
- bytes[i] = Math.random() * max;
1266
- }
1267
- }
1268
-
1269
- var getRandomValues = function () {
1270
- var _crypto;
1271
-
1272
- if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
1273
- return crypto.getRandomValues.bind(crypto);
1274
- } else if (typeof msCrypto !== 'undefined') {
1275
- return msCrypto.getRandomValues.bind(msCrypto);
1276
- } else {
1277
- return getRandomValuesWithMathRandom;
1278
- }
1279
- }();
1280
-
1281
- function getRandomBytes(length) {
1282
- var bytes = new Uint8Array(length);
1283
- getRandomValues(bytes);
1284
- return bytes;
1285
- }
1286
-
1287
- function convertErrorToJson(err) {
1288
- var jsonObj = {};
1289
- if (!err) return jsonObj;
1290
-
1291
- try {
1292
- Object.getOwnPropertyNames(err).forEach(function (key) {
1293
- jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
1294
- });
1295
- } catch (_) {
1296
- return {
1297
- error: 'failed to serialize the error'
1298
- };
1299
- }
1300
-
1301
- return jsonObj;
1302
- }
1303
- /**
1304
- * isOnline safely return the navigator.online value for browser env
1305
- * if navigator is not in global object, it always return true
1306
- */
1307
-
1308
- function isOnline() {
1309
- var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
1310
-
1311
- if (!nav) {
1312
- console.warn('isOnline failed to access window.navigator and assume browser is online');
1313
- return true;
1314
- } // RN navigator has undefined for onLine
1315
-
1316
-
1317
- if (typeof nav.onLine !== 'boolean') {
1318
- return true;
1319
- }
1320
-
1321
- return nav.onLine;
1322
- }
1323
- /**
1324
- * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
1325
- */
1326
-
1327
- function addConnectionEventListeners(cb) {
1328
- if (typeof window !== 'undefined' && window.addEventListener) {
1329
- window.addEventListener('offline', cb);
1330
- window.addEventListener('online', cb);
1331
- }
1332
- }
1333
- function removeConnectionEventListeners(cb) {
1334
- if (typeof window !== 'undefined' && window.removeEventListener) {
1335
- window.removeEventListener('offline', cb);
1336
- window.removeEventListener('online', cb);
1337
- }
1338
- }
1339
- var axiosParamsSerializer = function axiosParamsSerializer(params) {
1340
- var newParams = [];
1341
-
1342
- for (var k in params) {
1343
- // Stream backend doesn't treat "undefined" value same as value not being present.
1344
- // So, we need to skip the undefined values.
1345
- if (params[k] === undefined) continue;
1376
+ }
1346
1377
 
1347
- if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
1348
- newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1349
- } else {
1350
- newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
1378
+ return {
1379
+ targetMessageSetIndex: targetMessageSetIndex,
1380
+ messagesToAdd: messagesToAdd
1381
+ };
1351
1382
  }
1352
- }
1383
+ }]);
1353
1384
 
1354
- return newParams.join('&');
1355
- };
1385
+ return ChannelState;
1386
+ }();
1356
1387
 
1357
- function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1388
+ function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1358
1389
 
1359
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
1390
+ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1360
1391
 
1361
- function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1392
+ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1362
1393
 
1363
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1394
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1364
1395
 
1365
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1396
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1366
1397
 
1367
1398
  /**
1368
1399
  * Channel - The Channel class manages it's own state.
@@ -1435,7 +1466,7 @@ var Channel = /*#__PURE__*/function () {
1435
1466
  while (1) {
1436
1467
  switch (_context.prev = _context.next) {
1437
1468
  case 0:
1438
- defaultOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
1469
+ defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
1439
1470
  watch: false,
1440
1471
  state: false,
1441
1472
  presence: false
@@ -1507,7 +1538,7 @@ var Channel = /*#__PURE__*/function () {
1507
1538
 
1508
1539
  this.data = data; // this._data is used for the requests...
1509
1540
 
1510
- this._data = _objectSpread$5({}, data);
1541
+ this._data = _objectSpread$6({}, data);
1511
1542
  this.cid = "".concat(type, ":").concat(id);
1512
1543
  this.listeners = {}; // perhaps the state variable should be private
1513
1544
 
@@ -1569,7 +1600,7 @@ var Channel = /*#__PURE__*/function () {
1569
1600
  switch (_context2.prev = _context2.next) {
1570
1601
  case 0:
1571
1602
  _context2.next = 2;
1572
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1603
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
1573
1604
  message: message
1574
1605
  }, options));
1575
1606
 
@@ -1685,7 +1716,7 @@ var Channel = /*#__PURE__*/function () {
1685
1716
 
1686
1717
  case 3:
1687
1718
  // Return a list of channels
1688
- payload = _objectSpread$5(_objectSpread$5({
1719
+ payload = _objectSpread$6(_objectSpread$6({
1689
1720
  filter_conditions: {
1690
1721
  cid: this.cid
1691
1722
  }
@@ -1782,7 +1813,7 @@ var Channel = /*#__PURE__*/function () {
1782
1813
 
1783
1814
  _context5.next = 6;
1784
1815
  return this.getClient().get(this.getClient().baseURL + '/members', {
1785
- payload: _objectSpread$5({
1816
+ payload: _objectSpread$6({
1786
1817
  type: type,
1787
1818
  id: id,
1788
1819
  members: members,
@@ -1843,7 +1874,7 @@ var Channel = /*#__PURE__*/function () {
1843
1874
 
1844
1875
  case 4:
1845
1876
  _context6.next = 6;
1846
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$5({
1877
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
1847
1878
  reaction: reaction
1848
1879
  }, options));
1849
1880
 
@@ -1924,7 +1955,7 @@ var Channel = /*#__PURE__*/function () {
1924
1955
  delete channelData[key];
1925
1956
  });
1926
1957
  _context7.next = 7;
1927
- return this._update(_objectSpread$5({
1958
+ return this._update(_objectSpread$6({
1928
1959
  message: updateMessage,
1929
1960
  data: channelData
1930
1961
  }, options));
@@ -2084,7 +2115,7 @@ var Channel = /*#__PURE__*/function () {
2084
2115
  case 0:
2085
2116
  options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
2086
2117
  _context11.next = 3;
2087
- return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
2118
+ return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
2088
2119
 
2089
2120
  case 3:
2090
2121
  return _context11.abrupt("return", _context11.sent);
@@ -2160,7 +2191,7 @@ var Channel = /*#__PURE__*/function () {
2160
2191
  case 0:
2161
2192
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2162
2193
  _context13.next = 3;
2163
- return this._update(_objectSpread$5({
2194
+ return this._update(_objectSpread$6({
2164
2195
  accept_invite: true
2165
2196
  }, options));
2166
2197
 
@@ -2201,7 +2232,7 @@ var Channel = /*#__PURE__*/function () {
2201
2232
  case 0:
2202
2233
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2203
2234
  _context14.next = 3;
2204
- return this._update(_objectSpread$5({
2235
+ return this._update(_objectSpread$6({
2205
2236
  reject_invite: true
2206
2237
  }, options));
2207
2238
 
@@ -2243,7 +2274,7 @@ var Channel = /*#__PURE__*/function () {
2243
2274
  case 0:
2244
2275
  options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
2245
2276
  _context15.next = 3;
2246
- return this._update(_objectSpread$5({
2277
+ return this._update(_objectSpread$6({
2247
2278
  add_members: members,
2248
2279
  message: message
2249
2280
  }, options));
@@ -2286,7 +2317,7 @@ var Channel = /*#__PURE__*/function () {
2286
2317
  case 0:
2287
2318
  options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
2288
2319
  _context16.next = 3;
2289
- return this._update(_objectSpread$5({
2320
+ return this._update(_objectSpread$6({
2290
2321
  add_moderators: members,
2291
2322
  message: message
2292
2323
  }, options));
@@ -2329,7 +2360,7 @@ var Channel = /*#__PURE__*/function () {
2329
2360
  case 0:
2330
2361
  options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
2331
2362
  _context17.next = 3;
2332
- return this._update(_objectSpread$5({
2363
+ return this._update(_objectSpread$6({
2333
2364
  assign_roles: roles,
2334
2365
  message: message
2335
2366
  }, options));
@@ -2372,7 +2403,7 @@ var Channel = /*#__PURE__*/function () {
2372
2403
  case 0:
2373
2404
  options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
2374
2405
  _context18.next = 3;
2375
- return this._update(_objectSpread$5({
2406
+ return this._update(_objectSpread$6({
2376
2407
  invites: members,
2377
2408
  message: message
2378
2409
  }, options));
@@ -2415,7 +2446,7 @@ var Channel = /*#__PURE__*/function () {
2415
2446
  case 0:
2416
2447
  options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
2417
2448
  _context19.next = 3;
2418
- return this._update(_objectSpread$5({
2449
+ return this._update(_objectSpread$6({
2419
2450
  remove_members: members,
2420
2451
  message: message
2421
2452
  }, options));
@@ -2458,7 +2489,7 @@ var Channel = /*#__PURE__*/function () {
2458
2489
  case 0:
2459
2490
  options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
2460
2491
  _context20.next = 3;
2461
- return this._update(_objectSpread$5({
2492
+ return this._update(_objectSpread$6({
2462
2493
  demote_moderators: members,
2463
2494
  message: message
2464
2495
  }, options));
@@ -2543,7 +2574,7 @@ var Channel = /*#__PURE__*/function () {
2543
2574
  case 0:
2544
2575
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2545
2576
  _context22.next = 3;
2546
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$5({
2577
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
2547
2578
  channel_cid: this.cid
2548
2579
  }, opts));
2549
2580
 
@@ -2585,7 +2616,7 @@ var Channel = /*#__PURE__*/function () {
2585
2616
  case 0:
2586
2617
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2587
2618
  _context23.next = 3;
2588
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$5({
2619
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
2589
2620
  channel_cid: this.cid
2590
2621
  }, opts));
2591
2622
 
@@ -2644,7 +2675,7 @@ var Channel = /*#__PURE__*/function () {
2644
2675
  }, {
2645
2676
  key: "keystroke",
2646
2677
  value: function () {
2647
- var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id) {
2678
+ var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
2648
2679
  var _this$getConfig;
2649
2680
 
2650
2681
  var now, diff;
@@ -2672,10 +2703,10 @@ var Channel = /*#__PURE__*/function () {
2672
2703
 
2673
2704
  this.lastTypingEvent = new Date();
2674
2705
  _context24.next = 10;
2675
- return this.sendEvent({
2706
+ return this.sendEvent(_objectSpread$6({
2676
2707
  type: 'typing.start',
2677
2708
  parent_id: parent_id
2678
- });
2709
+ }, options || {}));
2679
2710
 
2680
2711
  case 10:
2681
2712
  case "end":
@@ -2685,7 +2716,7 @@ var Channel = /*#__PURE__*/function () {
2685
2716
  }, _callee24, this);
2686
2717
  }));
2687
2718
 
2688
- function keystroke(_x25) {
2719
+ function keystroke(_x25, _x26) {
2689
2720
  return _keystroke.apply(this, arguments);
2690
2721
  }
2691
2722
 
@@ -2700,7 +2731,7 @@ var Channel = /*#__PURE__*/function () {
2700
2731
  }, {
2701
2732
  key: "stopTyping",
2702
2733
  value: function () {
2703
- var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id) {
2734
+ var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
2704
2735
  var _this$getConfig2;
2705
2736
 
2706
2737
  return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
@@ -2718,10 +2749,10 @@ var Channel = /*#__PURE__*/function () {
2718
2749
  this.lastTypingEvent = null;
2719
2750
  this.isTyping = false;
2720
2751
  _context25.next = 6;
2721
- return this.sendEvent({
2752
+ return this.sendEvent(_objectSpread$6({
2722
2753
  type: 'typing.stop',
2723
2754
  parent_id: parent_id
2724
- });
2755
+ }, options || {}));
2725
2756
 
2726
2757
  case 6:
2727
2758
  case "end":
@@ -2731,7 +2762,7 @@ var Channel = /*#__PURE__*/function () {
2731
2762
  }, _callee25, this);
2732
2763
  }));
2733
2764
 
2734
- function stopTyping(_x26) {
2765
+ function stopTyping(_x27, _x28) {
2735
2766
  return _stopTyping.apply(this, arguments);
2736
2767
  }
2737
2768
 
@@ -2794,7 +2825,7 @@ var Channel = /*#__PURE__*/function () {
2794
2825
 
2795
2826
  case 4:
2796
2827
  _context26.next = 6;
2797
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$5({}, data));
2828
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
2798
2829
 
2799
2830
  case 6:
2800
2831
  return _context26.abrupt("return", _context26.sent);
@@ -2841,7 +2872,7 @@ var Channel = /*#__PURE__*/function () {
2841
2872
 
2842
2873
  case 3:
2843
2874
  _context27.next = 5;
2844
- return this.getClient().post(this._channelURL() + '/unread', _objectSpread$5({}, data));
2875
+ return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
2845
2876
 
2846
2877
  case 5:
2847
2878
  return _context27.abrupt("return", _context27.sent);
@@ -2854,7 +2885,7 @@ var Channel = /*#__PURE__*/function () {
2854
2885
  }, _callee27, this);
2855
2886
  }));
2856
2887
 
2857
- function markUnread(_x27) {
2888
+ function markUnread(_x29) {
2858
2889
  return _markUnread.apply(this, arguments);
2859
2890
  }
2860
2891
 
@@ -2909,7 +2940,7 @@ var Channel = /*#__PURE__*/function () {
2909
2940
  defaultOptions.watch = false;
2910
2941
  }
2911
2942
 
2912
- combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
2943
+ combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
2913
2944
  _context28.next = 7;
2914
2945
  return this.query(combined, 'latest');
2915
2946
 
@@ -2933,7 +2964,7 @@ var Channel = /*#__PURE__*/function () {
2933
2964
  }, _callee28, this);
2934
2965
  }));
2935
2966
 
2936
- function watch(_x28) {
2967
+ function watch(_x30) {
2937
2968
  return _watch.apply(this, arguments);
2938
2969
  }
2939
2970
 
@@ -3000,7 +3031,7 @@ var Channel = /*#__PURE__*/function () {
3000
3031
  switch (_context30.prev = _context30.next) {
3001
3032
  case 0:
3002
3033
  _context30.next = 2;
3003
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$5({}, options));
3034
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
3004
3035
 
3005
3036
  case 2:
3006
3037
  data = _context30.sent;
@@ -3020,7 +3051,7 @@ var Channel = /*#__PURE__*/function () {
3020
3051
  }, _callee30, this);
3021
3052
  }));
3022
3053
 
3023
- function getReplies(_x29, _x30) {
3054
+ function getReplies(_x31, _x32) {
3024
3055
  return _getReplies.apply(this, arguments);
3025
3056
  }
3026
3057
 
@@ -3048,7 +3079,7 @@ var Channel = /*#__PURE__*/function () {
3048
3079
  sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
3049
3080
  _context31.next = 3;
3050
3081
  return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
3051
- payload: _objectSpread$5(_objectSpread$5({}, options), {}, {
3082
+ payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
3052
3083
  sort: normalizeQuerySort(sort)
3053
3084
  })
3054
3085
  });
@@ -3064,7 +3095,7 @@ var Channel = /*#__PURE__*/function () {
3064
3095
  }, _callee31, this);
3065
3096
  }));
3066
3097
 
3067
- function getPinnedMessages(_x31) {
3098
+ function getPinnedMessages(_x33) {
3068
3099
  return _getPinnedMessages.apply(this, arguments);
3069
3100
  }
3070
3101
 
@@ -3082,7 +3113,7 @@ var Channel = /*#__PURE__*/function () {
3082
3113
  }, {
3083
3114
  key: "getReactions",
3084
3115
  value: function getReactions(message_id, options) {
3085
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$5({}, options));
3116
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
3086
3117
  }
3087
3118
  /**
3088
3119
  * getMessagesById - Retrieves a list of messages by ID
@@ -3229,7 +3260,7 @@ var Channel = /*#__PURE__*/function () {
3229
3260
  }
3230
3261
 
3231
3262
  _context32.next = 7;
3232
- return this.getClient().post(queryURL + '/query', _objectSpread$5({
3263
+ return this.getClient().post(queryURL + '/query', _objectSpread$6({
3233
3264
  data: this._data,
3234
3265
  state: true
3235
3266
  }, options));
@@ -3293,7 +3324,7 @@ var Channel = /*#__PURE__*/function () {
3293
3324
  }, _callee32, this);
3294
3325
  }));
3295
3326
 
3296
- function query(_x32) {
3327
+ function query(_x34) {
3297
3328
  return _query.apply(this, arguments);
3298
3329
  }
3299
3330
 
@@ -3318,7 +3349,7 @@ var Channel = /*#__PURE__*/function () {
3318
3349
  this._checkInitialized();
3319
3350
 
3320
3351
  _context33.next = 3;
3321
- return this.getClient().banUser(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3352
+ return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3322
3353
  type: this.type,
3323
3354
  id: this.id
3324
3355
  }));
@@ -3334,7 +3365,7 @@ var Channel = /*#__PURE__*/function () {
3334
3365
  }, _callee33, this);
3335
3366
  }));
3336
3367
 
3337
- function banUser(_x33, _x34) {
3368
+ function banUser(_x35, _x36) {
3338
3369
  return _banUser.apply(this, arguments);
3339
3370
  }
3340
3371
 
@@ -3465,7 +3496,7 @@ var Channel = /*#__PURE__*/function () {
3465
3496
  }, _callee36, this);
3466
3497
  }));
3467
3498
 
3468
- function unbanUser(_x35) {
3499
+ function unbanUser(_x37) {
3469
3500
  return _unbanUser.apply(this, arguments);
3470
3501
  }
3471
3502
 
@@ -3490,7 +3521,7 @@ var Channel = /*#__PURE__*/function () {
3490
3521
  this._checkInitialized();
3491
3522
 
3492
3523
  _context37.next = 3;
3493
- return this.getClient().shadowBan(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3524
+ return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3494
3525
  type: this.type,
3495
3526
  id: this.id
3496
3527
  }));
@@ -3506,7 +3537,7 @@ var Channel = /*#__PURE__*/function () {
3506
3537
  }, _callee37, this);
3507
3538
  }));
3508
3539
 
3509
- function shadowBan(_x36, _x37) {
3540
+ function shadowBan(_x38, _x39) {
3510
3541
  return _shadowBan.apply(this, arguments);
3511
3542
  }
3512
3543
 
@@ -3546,7 +3577,7 @@ var Channel = /*#__PURE__*/function () {
3546
3577
  }, _callee38, this);
3547
3578
  }));
3548
3579
 
3549
- function removeShadowBan(_x38) {
3580
+ function removeShadowBan(_x40) {
3550
3581
  return _removeShadowBan.apply(this, arguments);
3551
3582
  }
3552
3583
 
@@ -3581,7 +3612,7 @@ var Channel = /*#__PURE__*/function () {
3581
3612
  }, _callee39, this);
3582
3613
  }));
3583
3614
 
3584
- function createCall(_x39) {
3615
+ function createCall(_x41) {
3585
3616
  return _createCall.apply(this, arguments);
3586
3617
  }
3587
3618
 
@@ -3876,7 +3907,7 @@ var Channel = /*#__PURE__*/function () {
3876
3907
  });
3877
3908
  }
3878
3909
 
3879
- channel.data = _objectSpread$5(_objectSpread$5({}, event.channel), {}, {
3910
+ channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
3880
3911
  hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
3881
3912
  own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
3882
3913
  });
@@ -3907,7 +3938,7 @@ var Channel = /*#__PURE__*/function () {
3907
3938
  break;
3908
3939
 
3909
3940
  case 'channel.hidden':
3910
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3941
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3911
3942
  hidden: true
3912
3943
  });
3913
3944
 
@@ -3918,26 +3949,26 @@ var Channel = /*#__PURE__*/function () {
3918
3949
  break;
3919
3950
 
3920
3951
  case 'channel.visible':
3921
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3952
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3922
3953
  hidden: false
3923
3954
  });
3924
3955
  break;
3925
3956
 
3926
3957
  case 'user.banned':
3927
3958
  if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3928
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3959
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3929
3960
  shadow_banned: !!event.shadow,
3930
3961
  banned: !event.shadow,
3931
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3962
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3932
3963
  });
3933
3964
  break;
3934
3965
 
3935
3966
  case 'user.unbanned':
3936
3967
  if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
3937
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3968
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3938
3969
  shadow_banned: false,
3939
3970
  banned: false,
3940
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3971
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3941
3972
  });
3942
3973
  break;
3943
3974
  } // any event can send over the online count
@@ -3967,7 +3998,7 @@ var Channel = /*#__PURE__*/function () {
3967
3998
 
3968
3999
 
3969
4000
  if (state.members) {
3970
- var _iterator = _createForOfIteratorHelper$2(state.members),
4001
+ var _iterator = _createForOfIteratorHelper$3(state.members),
3971
4002
  _step;
3972
4003
 
3973
4004
  try {
@@ -4011,7 +4042,7 @@ var Channel = /*#__PURE__*/function () {
4011
4042
 
4012
4043
 
4013
4044
  if (state.watchers) {
4014
- var _iterator2 = _createForOfIteratorHelper$2(state.watchers),
4045
+ var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
4015
4046
  _step2;
4016
4047
 
4017
4048
  try {
@@ -4047,7 +4078,7 @@ var Channel = /*#__PURE__*/function () {
4047
4078
 
4048
4079
 
4049
4080
  if (state.read) {
4050
- var _iterator3 = _createForOfIteratorHelper$2(state.read),
4081
+ var _iterator3 = _createForOfIteratorHelper$3(state.read),
4051
4082
  _step3;
4052
4083
 
4053
4084
  try {
@@ -4116,11 +4147,11 @@ var Channel = /*#__PURE__*/function () {
4116
4147
  return Channel;
4117
4148
  }();
4118
4149
 
4119
- function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4150
+ function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4120
4151
 
4121
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
4152
+ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
4122
4153
 
4123
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4154
+ function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4124
4155
 
4125
4156
  /**
4126
4157
  * ClientState - A container class for the client state.
@@ -4143,7 +4174,7 @@ var ClientState = /*#__PURE__*/function () {
4143
4174
  _createClass__default['default'](ClientState, [{
4144
4175
  key: "updateUsers",
4145
4176
  value: function updateUsers(users) {
4146
- var _iterator = _createForOfIteratorHelper$1(users),
4177
+ var _iterator = _createForOfIteratorHelper$2(users),
4147
4178
  _step;
4148
4179
 
4149
4180
  try {
@@ -4191,9 +4222,9 @@ var ClientState = /*#__PURE__*/function () {
4191
4222
  return ClientState;
4192
4223
  }();
4193
4224
 
4194
- function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4225
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4195
4226
 
4196
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4227
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4197
4228
  var InsightMetrics = function InsightMetrics() {
4198
4229
  _classCallCheck__default['default'](this, InsightMetrics);
4199
4230
 
@@ -4272,7 +4303,7 @@ var postInsights = /*#__PURE__*/function () {
4272
4303
  };
4273
4304
  }();
4274
4305
  function buildWsFatalInsight(connection, event) {
4275
- return _objectSpread$4(_objectSpread$4({}, event), buildWsBaseInsight(connection));
4306
+ return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
4276
4307
  }
4277
4308
 
4278
4309
  function buildWsBaseInsight(connection) {
@@ -4305,9 +4336,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
4305
4336
  return buildWsBaseInsight(connection);
4306
4337
  }
4307
4338
 
4308
- function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4339
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4309
4340
 
4310
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4341
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4311
4342
 
4312
4343
  // Type guards to check WebSocket error type
4313
4344
  var isCloseEvent = function isCloseEvent(res) {
@@ -4671,7 +4702,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4671
4702
  value: function _log(msg) {
4672
4703
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4673
4704
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
4674
- this.client.logger(level, 'connection:' + msg, _objectSpread$3({
4705
+ this.client.logger(level, 'connection:' + msg, _objectSpread$4({
4675
4706
  tags: ['connection']
4676
4707
  }, extra));
4677
4708
  }
@@ -5266,9 +5297,9 @@ var jwt = null;
5266
5297
 
5267
5298
  var crypto$1 = null;
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
 
@@ -5693,9 +5724,9 @@ function isErrorResponse(res) {
5693
5724
  return !res.status || res.status < 200 || 300 <= res.status;
5694
5725
  }
5695
5726
 
5696
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5727
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5697
5728
 
5698
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5729
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5699
5730
  var ConnectionState;
5700
5731
 
5701
5732
  (function (ConnectionState) {
@@ -5758,7 +5789,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5758
5789
  _context.next = 4;
5759
5790
  return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
5760
5791
  undefined, {
5761
- config: _objectSpread$1(_objectSpread$1({}, config), {}, {
5792
+ config: _objectSpread$2(_objectSpread$2({}, config), {}, {
5762
5793
  cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
5763
5794
  }),
5764
5795
  params: params
@@ -6036,7 +6067,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6036
6067
  value: function _log(msg) {
6037
6068
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6038
6069
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
6039
- this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$1({
6070
+ this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
6040
6071
  tags: ['connection_fallback', 'connection']
6041
6072
  }, extra));
6042
6073
  }
@@ -6083,6 +6114,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
6083
6114
  /**
6084
6115
  * Response Types
6085
6116
  */
6117
+ // TODO: Figure out a way to strongly type set and unset.
6086
6118
  // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6087
6119
 
6088
6120
  /**
@@ -6154,6 +6186,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6154
6186
  return ErrorFromResponse;
6155
6187
  }( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
6156
6188
 
6189
+ 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; }
6190
+
6191
+ 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; }
6192
+
6193
+ 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; } } }; }
6194
+
6195
+ 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); }
6196
+
6197
+ 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; }
6198
+ var Thread = /*#__PURE__*/function () {
6199
+ function Thread(client, t) {
6200
+ _classCallCheck__default['default'](this, Thread);
6201
+
6202
+ _defineProperty__default['default'](this, "id", void 0);
6203
+
6204
+ _defineProperty__default['default'](this, "latestReplies", []);
6205
+
6206
+ _defineProperty__default['default'](this, "participants", []);
6207
+
6208
+ _defineProperty__default['default'](this, "message", void 0);
6209
+
6210
+ _defineProperty__default['default'](this, "channel", void 0);
6211
+
6212
+ _defineProperty__default['default'](this, "_channel", void 0);
6213
+
6214
+ _defineProperty__default['default'](this, "replyCount", 0);
6215
+
6216
+ _defineProperty__default['default'](this, "_client", void 0);
6217
+
6218
+ _defineProperty__default['default'](this, "read", {});
6219
+
6220
+ this.id = t.parent_message.id;
6221
+ this.message = formatMessage(t.parent_message);
6222
+ this.latestReplies = t.latest_replies.map(formatMessage);
6223
+ this.participants = t.thread_participants;
6224
+ this.replyCount = t.reply_count;
6225
+ this.channel = t.channel;
6226
+ this._channel = client.channel(t.channel.type, t.channel.id);
6227
+ this._client = client;
6228
+
6229
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6230
+ _step;
6231
+
6232
+ try {
6233
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6234
+ var r = _step.value;
6235
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6236
+ last_read: new Date(r.last_read)
6237
+ });
6238
+ }
6239
+ } catch (err) {
6240
+ _iterator.e(err);
6241
+ } finally {
6242
+ _iterator.f();
6243
+ }
6244
+ }
6245
+
6246
+ _createClass__default['default'](Thread, [{
6247
+ key: "getClient",
6248
+ value: function getClient() {
6249
+ return this._client;
6250
+ }
6251
+ }, {
6252
+ key: "addReply",
6253
+ value: function addReply(message) {
6254
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6255
+ }
6256
+ }, {
6257
+ key: "updateReply",
6258
+ value: function updateReply(message) {
6259
+ this.latestReplies = this.latestReplies.map(function (m) {
6260
+ if (m.id === message.id) {
6261
+ return formatMessage(message);
6262
+ }
6263
+
6264
+ return m;
6265
+ });
6266
+ }
6267
+ }, {
6268
+ key: "updateMessageOrReplyIfExists",
6269
+ value: function updateMessageOrReplyIfExists(message) {
6270
+ if (!message.parent_id && message.id !== this.message.id) {
6271
+ return;
6272
+ }
6273
+
6274
+ if (message.parent_id && message.parent_id !== this.message.id) {
6275
+ return;
6276
+ }
6277
+
6278
+ if (message.parent_id && message.parent_id === this.message.id) {
6279
+ this.updateReply(message);
6280
+ }
6281
+
6282
+ if (!message.parent_id && message.id === this.message.id) {
6283
+ this.message = formatMessage(message);
6284
+ }
6285
+ }
6286
+ }, {
6287
+ key: "addReaction",
6288
+ value: function addReaction(reaction, message, enforce_unique) {
6289
+ var _this = this;
6290
+
6291
+ if (!message) return;
6292
+ this.latestReplies = this.latestReplies.map(function (m) {
6293
+ if (m.id === message.id) {
6294
+ return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
6295
+ }
6296
+
6297
+ return m;
6298
+ });
6299
+ }
6300
+ }, {
6301
+ key: "removeReaction",
6302
+ value: function removeReaction(reaction, message) {
6303
+ var _this2 = this;
6304
+
6305
+ if (!message) return;
6306
+ this.latestReplies = this.latestReplies.map(function (m) {
6307
+ if (m.id === message.id) {
6308
+ return formatMessage(_this2._channel.state.removeReaction(reaction, message));
6309
+ }
6310
+
6311
+ return m;
6312
+ });
6313
+ }
6314
+ }]);
6315
+
6316
+ return Thread;
6317
+ }();
6318
+
6157
6319
  var _excluded = ["created_at", "updated_at", "last_active", "online"],
6158
6320
  _excluded2 = ["params", "headers"];
6159
6321
 
@@ -10265,10 +10427,197 @@ var StreamChat = /*#__PURE__*/function () {
10265
10427
 
10266
10428
  return getMessage;
10267
10429
  }()
10430
+ /**
10431
+ * queryThreads - returns the list of threads of current user.
10432
+ *
10433
+ * @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
10434
+ * @param {number} options.limit Limits the number of threads to be returned.
10435
+ * @param {boolean} options.watch Subscribes the user to the channels of the threads.
10436
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10437
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10438
+ *
10439
+ * @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
10440
+ */
10441
+
10442
+ }, {
10443
+ key: "queryThreads",
10444
+ value: function () {
10445
+ var _queryThreads = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(options) {
10446
+ var _this5 = this;
10447
+
10448
+ var opts, res;
10449
+ return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10450
+ while (1) {
10451
+ switch (_context59.prev = _context59.next) {
10452
+ case 0:
10453
+ opts = _objectSpread({
10454
+ limit: 10,
10455
+ participant_limit: 10,
10456
+ reply_limit: 3,
10457
+ watch: true
10458
+ }, options);
10459
+ _context59.next = 3;
10460
+ return this.post(this.baseURL + "/threads", opts);
10461
+
10462
+ case 3:
10463
+ res = _context59.sent;
10464
+ return _context59.abrupt("return", {
10465
+ threads: res.threads.map(function (thread) {
10466
+ return new Thread(_this5, thread);
10467
+ }),
10468
+ next: res.next
10469
+ });
10470
+
10471
+ case 5:
10472
+ case "end":
10473
+ return _context59.stop();
10474
+ }
10475
+ }
10476
+ }, _callee59, this);
10477
+ }));
10478
+
10479
+ function queryThreads(_x78) {
10480
+ return _queryThreads.apply(this, arguments);
10481
+ }
10482
+
10483
+ return queryThreads;
10484
+ }()
10485
+ /**
10486
+ * getThread - returns the thread of a message by its id.
10487
+ *
10488
+ * @param {string} messageId The message id
10489
+ * @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
10490
+ * @param {boolean} options.watch Subscribes the user to the channel of the thread.
10491
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10492
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10493
+ *
10494
+ * @returns {Thread<StreamChatGenerics>} Returns the thread.
10495
+ */
10496
+
10497
+ }, {
10498
+ key: "getThread",
10499
+ value: function () {
10500
+ var _getThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(messageId) {
10501
+ var options,
10502
+ opts,
10503
+ res,
10504
+ _args60 = arguments;
10505
+ return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10506
+ while (1) {
10507
+ switch (_context60.prev = _context60.next) {
10508
+ case 0:
10509
+ options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
10510
+
10511
+ if (messageId) {
10512
+ _context60.next = 3;
10513
+ break;
10514
+ }
10515
+
10516
+ throw Error('Please specify the message id when calling partialUpdateThread');
10517
+
10518
+ case 3:
10519
+ opts = _objectSpread({
10520
+ participant_limit: 100,
10521
+ reply_limit: 3,
10522
+ watch: true
10523
+ }, options);
10524
+ _context60.next = 6;
10525
+ return this.get(this.baseURL + "/threads/".concat(messageId), opts);
10526
+
10527
+ case 6:
10528
+ res = _context60.sent;
10529
+ return _context60.abrupt("return", new Thread(this, res.thread));
10530
+
10531
+ case 8:
10532
+ case "end":
10533
+ return _context60.stop();
10534
+ }
10535
+ }
10536
+ }, _callee60, this);
10537
+ }));
10538
+
10539
+ function getThread(_x79) {
10540
+ return _getThread.apply(this, arguments);
10541
+ }
10542
+
10543
+ return getThread;
10544
+ }()
10545
+ /**
10546
+ * partialUpdateThread - updates the given thread
10547
+ *
10548
+ * @param {string} messageId The id of the thread message which needs to be updated.
10549
+ * @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
10550
+ *
10551
+ * @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
10552
+ */
10553
+
10554
+ }, {
10555
+ key: "partialUpdateThread",
10556
+ value: function () {
10557
+ var _partialUpdateThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(messageId, partialThreadObject) {
10558
+ var reservedThreadFields, _key5;
10559
+
10560
+ return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10561
+ while (1) {
10562
+ switch (_context61.prev = _context61.next) {
10563
+ case 0:
10564
+ if (messageId) {
10565
+ _context61.next = 2;
10566
+ break;
10567
+ }
10568
+
10569
+ throw Error('Please specify the message id when calling partialUpdateThread');
10570
+
10571
+ case 2:
10572
+ // check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
10573
+ // Throw error if any of the reserved field is found.
10574
+ reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
10575
+ _context61.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
10576
+
10577
+ case 4:
10578
+ if ((_context61.t1 = _context61.t0()).done) {
10579
+ _context61.next = 10;
10580
+ break;
10581
+ }
10582
+
10583
+ _key5 = _context61.t1.value;
10584
+
10585
+ if (!reservedThreadFields.includes(_key5)) {
10586
+ _context61.next = 8;
10587
+ break;
10588
+ }
10589
+
10590
+ 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."));
10591
+
10592
+ case 8:
10593
+ _context61.next = 4;
10594
+ break;
10595
+
10596
+ case 10:
10597
+ _context61.next = 12;
10598
+ return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
10599
+
10600
+ case 12:
10601
+ return _context61.abrupt("return", _context61.sent);
10602
+
10603
+ case 13:
10604
+ case "end":
10605
+ return _context61.stop();
10606
+ }
10607
+ }
10608
+ }, _callee61, this);
10609
+ }));
10610
+
10611
+ function partialUpdateThread(_x80, _x81) {
10612
+ return _partialUpdateThread.apply(this, arguments);
10613
+ }
10614
+
10615
+ return partialUpdateThread;
10616
+ }()
10268
10617
  }, {
10269
10618
  key: "getUserAgent",
10270
10619
  value: function getUserAgent() {
10271
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.15.0");
10620
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
10272
10621
  }
10273
10622
  }, {
10274
10623
  key: "setUserAgent",
@@ -10487,28 +10836,28 @@ var StreamChat = /*#__PURE__*/function () {
10487
10836
  }, {
10488
10837
  key: "sendUserCustomEvent",
10489
10838
  value: function () {
10490
- var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(targetUserID, event) {
10491
- return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
10839
+ var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(targetUserID, event) {
10840
+ return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
10492
10841
  while (1) {
10493
- switch (_context59.prev = _context59.next) {
10842
+ switch (_context62.prev = _context62.next) {
10494
10843
  case 0:
10495
- _context59.next = 2;
10844
+ _context62.next = 2;
10496
10845
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
10497
10846
  event: event
10498
10847
  });
10499
10848
 
10500
10849
  case 2:
10501
- return _context59.abrupt("return", _context59.sent);
10850
+ return _context62.abrupt("return", _context62.sent);
10502
10851
 
10503
10852
  case 3:
10504
10853
  case "end":
10505
- return _context59.stop();
10854
+ return _context62.stop();
10506
10855
  }
10507
10856
  }
10508
- }, _callee59, this);
10857
+ }, _callee62, this);
10509
10858
  }));
10510
10859
 
10511
- function sendUserCustomEvent(_x78, _x79) {
10860
+ function sendUserCustomEvent(_x82, _x83) {
10512
10861
  return _sendUserCustomEvent.apply(this, arguments);
10513
10862
  }
10514
10863
 
@@ -10580,12 +10929,12 @@ var StreamChat = /*#__PURE__*/function () {
10580
10929
  }, {
10581
10930
  key: "createSegment",
10582
10931
  value: function () {
10583
- var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(type, id, name, data) {
10932
+ var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(type, id, name, data) {
10584
10933
  var body, _yield$this$post, segment;
10585
10934
 
10586
- return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
10935
+ return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
10587
10936
  while (1) {
10588
- switch (_context60.prev = _context60.next) {
10937
+ switch (_context63.prev = _context63.next) {
10589
10938
  case 0:
10590
10939
  body = {
10591
10940
  id: id,
@@ -10593,23 +10942,23 @@ var StreamChat = /*#__PURE__*/function () {
10593
10942
  name: name,
10594
10943
  data: data
10595
10944
  };
10596
- _context60.next = 3;
10945
+ _context63.next = 3;
10597
10946
  return this.post(this.baseURL + "/segments", body);
10598
10947
 
10599
10948
  case 3:
10600
- _yield$this$post = _context60.sent;
10949
+ _yield$this$post = _context63.sent;
10601
10950
  segment = _yield$this$post.segment;
10602
- return _context60.abrupt("return", segment);
10951
+ return _context63.abrupt("return", segment);
10603
10952
 
10604
10953
  case 6:
10605
10954
  case "end":
10606
- return _context60.stop();
10955
+ return _context63.stop();
10607
10956
  }
10608
10957
  }
10609
- }, _callee60, this);
10958
+ }, _callee63, this);
10610
10959
  }));
10611
10960
 
10612
- function createSegment(_x80, _x81, _x82, _x83) {
10961
+ function createSegment(_x84, _x85, _x86, _x87) {
10613
10962
  return _createSegment.apply(this, arguments);
10614
10963
  }
10615
10964
 
@@ -10628,26 +10977,26 @@ var StreamChat = /*#__PURE__*/function () {
10628
10977
  }, {
10629
10978
  key: "createUserSegment",
10630
10979
  value: function () {
10631
- var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(id, name, data) {
10632
- return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
10980
+ var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, name, data) {
10981
+ return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
10633
10982
  while (1) {
10634
- switch (_context61.prev = _context61.next) {
10983
+ switch (_context64.prev = _context64.next) {
10635
10984
  case 0:
10636
- _context61.next = 2;
10985
+ _context64.next = 2;
10637
10986
  return this.createSegment('user', id, name, data);
10638
10987
 
10639
10988
  case 2:
10640
- return _context61.abrupt("return", _context61.sent);
10989
+ return _context64.abrupt("return", _context64.sent);
10641
10990
 
10642
10991
  case 3:
10643
10992
  case "end":
10644
- return _context61.stop();
10993
+ return _context64.stop();
10645
10994
  }
10646
10995
  }
10647
- }, _callee61, this);
10996
+ }, _callee64, this);
10648
10997
  }));
10649
10998
 
10650
- function createUserSegment(_x84, _x85, _x86) {
10999
+ function createUserSegment(_x88, _x89, _x90) {
10651
11000
  return _createUserSegment.apply(this, arguments);
10652
11001
  }
10653
11002
 
@@ -10666,26 +11015,26 @@ var StreamChat = /*#__PURE__*/function () {
10666
11015
  }, {
10667
11016
  key: "createChannelSegment",
10668
11017
  value: function () {
10669
- var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(id, name, data) {
10670
- return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
11018
+ var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
11019
+ return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
10671
11020
  while (1) {
10672
- switch (_context62.prev = _context62.next) {
11021
+ switch (_context65.prev = _context65.next) {
10673
11022
  case 0:
10674
- _context62.next = 2;
11023
+ _context65.next = 2;
10675
11024
  return this.createSegment('channel', id, name, data);
10676
11025
 
10677
11026
  case 2:
10678
- return _context62.abrupt("return", _context62.sent);
11027
+ return _context65.abrupt("return", _context65.sent);
10679
11028
 
10680
11029
  case 3:
10681
11030
  case "end":
10682
- return _context62.stop();
11031
+ return _context65.stop();
10683
11032
  }
10684
11033
  }
10685
- }, _callee62, this);
11034
+ }, _callee65, this);
10686
11035
  }));
10687
11036
 
10688
- function createChannelSegment(_x87, _x88, _x89) {
11037
+ function createChannelSegment(_x91, _x92, _x93) {
10689
11038
  return _createChannelSegment.apply(this, arguments);
10690
11039
  }
10691
11040
 
@@ -10703,30 +11052,30 @@ var StreamChat = /*#__PURE__*/function () {
10703
11052
  }, {
10704
11053
  key: "updateSegment",
10705
11054
  value: function () {
10706
- var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(id, data) {
11055
+ var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
10707
11056
  var _yield$this$put, segment;
10708
11057
 
10709
- return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
11058
+ return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
10710
11059
  while (1) {
10711
- switch (_context63.prev = _context63.next) {
11060
+ switch (_context66.prev = _context66.next) {
10712
11061
  case 0:
10713
- _context63.next = 2;
11062
+ _context66.next = 2;
10714
11063
  return this.put(this.baseURL + "/segments/".concat(id), data);
10715
11064
 
10716
11065
  case 2:
10717
- _yield$this$put = _context63.sent;
11066
+ _yield$this$put = _context66.sent;
10718
11067
  segment = _yield$this$put.segment;
10719
- return _context63.abrupt("return", segment);
11068
+ return _context66.abrupt("return", segment);
10720
11069
 
10721
11070
  case 5:
10722
11071
  case "end":
10723
- return _context63.stop();
11072
+ return _context66.stop();
10724
11073
  }
10725
11074
  }
10726
- }, _callee63, this);
11075
+ }, _callee66, this);
10727
11076
  }));
10728
11077
 
10729
- function updateSegment(_x90, _x91) {
11078
+ function updateSegment(_x94, _x95) {
10730
11079
  return _updateSegment.apply(this, arguments);
10731
11080
  }
10732
11081
 
@@ -10744,30 +11093,30 @@ var StreamChat = /*#__PURE__*/function () {
10744
11093
  }, {
10745
11094
  key: "addSegmentTargets",
10746
11095
  value: function () {
10747
- var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, targets) {
11096
+ var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id, targets) {
10748
11097
  var body;
10749
- return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
11098
+ return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
10750
11099
  while (1) {
10751
- switch (_context64.prev = _context64.next) {
11100
+ switch (_context67.prev = _context67.next) {
10752
11101
  case 0:
10753
11102
  body = {
10754
11103
  targets: targets
10755
11104
  };
10756
- _context64.next = 3;
11105
+ _context67.next = 3;
10757
11106
  return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
10758
11107
 
10759
11108
  case 3:
10760
- return _context64.abrupt("return", _context64.sent);
11109
+ return _context67.abrupt("return", _context67.sent);
10761
11110
 
10762
11111
  case 4:
10763
11112
  case "end":
10764
- return _context64.stop();
11113
+ return _context67.stop();
10765
11114
  }
10766
11115
  }
10767
- }, _callee64, this);
11116
+ }, _callee67, this);
10768
11117
  }));
10769
11118
 
10770
- function addSegmentTargets(_x92, _x93) {
11119
+ function addSegmentTargets(_x96, _x97) {
10771
11120
  return _addSegmentTargets.apply(this, arguments);
10772
11121
  }
10773
11122
 
@@ -10785,30 +11134,30 @@ var StreamChat = /*#__PURE__*/function () {
10785
11134
  }, {
10786
11135
  key: "deleteSegmentTargets",
10787
11136
  value: function () {
10788
- var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, targets) {
11137
+ var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(id, targets) {
10789
11138
  var body;
10790
- return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
11139
+ return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
10791
11140
  while (1) {
10792
- switch (_context65.prev = _context65.next) {
11141
+ switch (_context68.prev = _context68.next) {
10793
11142
  case 0:
10794
11143
  body = {
10795
11144
  targets: targets
10796
11145
  };
10797
- _context65.next = 3;
11146
+ _context68.next = 3;
10798
11147
  return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
10799
11148
 
10800
11149
  case 3:
10801
- return _context65.abrupt("return", _context65.sent);
11150
+ return _context68.abrupt("return", _context68.sent);
10802
11151
 
10803
11152
  case 4:
10804
11153
  case "end":
10805
- return _context65.stop();
11154
+ return _context68.stop();
10806
11155
  }
10807
11156
  }
10808
- }, _callee65, this);
11157
+ }, _callee68, this);
10809
11158
  }));
10810
11159
 
10811
- function deleteSegmentTargets(_x94, _x95) {
11160
+ function deleteSegmentTargets(_x98, _x99) {
10812
11161
  return _deleteSegmentTargets.apply(this, arguments);
10813
11162
  }
10814
11163
 
@@ -10826,15 +11175,15 @@ var StreamChat = /*#__PURE__*/function () {
10826
11175
  }, {
10827
11176
  key: "querySegments",
10828
11177
  value: function () {
10829
- var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(filter) {
11178
+ var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(filter) {
10830
11179
  var options,
10831
- _args66 = arguments;
10832
- return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
11180
+ _args69 = arguments;
11181
+ return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
10833
11182
  while (1) {
10834
- switch (_context66.prev = _context66.next) {
11183
+ switch (_context69.prev = _context69.next) {
10835
11184
  case 0:
10836
- options = _args66.length > 1 && _args66[1] !== undefined ? _args66[1] : {};
10837
- _context66.next = 3;
11185
+ options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11186
+ _context69.next = 3;
10838
11187
  return this.get(this.baseURL + "/segments", {
10839
11188
  payload: _objectSpread({
10840
11189
  filter: filter
@@ -10842,17 +11191,17 @@ var StreamChat = /*#__PURE__*/function () {
10842
11191
  });
10843
11192
 
10844
11193
  case 3:
10845
- return _context66.abrupt("return", _context66.sent);
11194
+ return _context69.abrupt("return", _context69.sent);
10846
11195
 
10847
11196
  case 4:
10848
11197
  case "end":
10849
- return _context66.stop();
11198
+ return _context69.stop();
10850
11199
  }
10851
11200
  }
10852
- }, _callee66, this);
11201
+ }, _callee69, this);
10853
11202
  }));
10854
11203
 
10855
- function querySegments(_x96) {
11204
+ function querySegments(_x100) {
10856
11205
  return _querySegments.apply(this, arguments);
10857
11206
  }
10858
11207
 
@@ -10869,26 +11218,26 @@ var StreamChat = /*#__PURE__*/function () {
10869
11218
  }, {
10870
11219
  key: "deleteSegment",
10871
11220
  value: function () {
10872
- var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id) {
10873
- return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
11221
+ var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(id) {
11222
+ return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
10874
11223
  while (1) {
10875
- switch (_context67.prev = _context67.next) {
11224
+ switch (_context70.prev = _context70.next) {
10876
11225
  case 0:
10877
- _context67.next = 2;
11226
+ _context70.next = 2;
10878
11227
  return this.delete(this.baseURL + "/segments/".concat(id));
10879
11228
 
10880
11229
  case 2:
10881
- return _context67.abrupt("return", _context67.sent);
11230
+ return _context70.abrupt("return", _context70.sent);
10882
11231
 
10883
11232
  case 3:
10884
11233
  case "end":
10885
- return _context67.stop();
11234
+ return _context70.stop();
10886
11235
  }
10887
11236
  }
10888
- }, _callee67, this);
11237
+ }, _callee70, this);
10889
11238
  }));
10890
11239
 
10891
- function deleteSegment(_x97) {
11240
+ function deleteSegment(_x101) {
10892
11241
  return _deleteSegment.apply(this, arguments);
10893
11242
  }
10894
11243
 
@@ -10906,26 +11255,26 @@ var StreamChat = /*#__PURE__*/function () {
10906
11255
  }, {
10907
11256
  key: "segmentTargetExists",
10908
11257
  value: function () {
10909
- var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(segmentId, targetId) {
10910
- return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
11258
+ var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(segmentId, targetId) {
11259
+ return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
10911
11260
  while (1) {
10912
- switch (_context68.prev = _context68.next) {
11261
+ switch (_context71.prev = _context71.next) {
10913
11262
  case 0:
10914
- _context68.next = 2;
11263
+ _context71.next = 2;
10915
11264
  return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
10916
11265
 
10917
11266
  case 2:
10918
- return _context68.abrupt("return", _context68.sent);
11267
+ return _context71.abrupt("return", _context71.sent);
10919
11268
 
10920
11269
  case 3:
10921
11270
  case "end":
10922
- return _context68.stop();
11271
+ return _context71.stop();
10923
11272
  }
10924
11273
  }
10925
- }, _callee68, this);
11274
+ }, _callee71, this);
10926
11275
  }));
10927
11276
 
10928
- function segmentTargetExists(_x98, _x99) {
11277
+ function segmentTargetExists(_x102, _x103) {
10929
11278
  return _segmentTargetExists.apply(this, arguments);
10930
11279
  }
10931
11280
 
@@ -10942,32 +11291,32 @@ var StreamChat = /*#__PURE__*/function () {
10942
11291
  }, {
10943
11292
  key: "createCampaign",
10944
11293
  value: function () {
10945
- var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(params) {
11294
+ var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(params) {
10946
11295
  var _yield$this$post2, campaign;
10947
11296
 
10948
- return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
11297
+ return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
10949
11298
  while (1) {
10950
- switch (_context69.prev = _context69.next) {
11299
+ switch (_context72.prev = _context72.next) {
10951
11300
  case 0:
10952
- _context69.next = 2;
11301
+ _context72.next = 2;
10953
11302
  return this.post(this.baseURL + "/campaigns", {
10954
11303
  campaign: params
10955
11304
  });
10956
11305
 
10957
11306
  case 2:
10958
- _yield$this$post2 = _context69.sent;
11307
+ _yield$this$post2 = _context72.sent;
10959
11308
  campaign = _yield$this$post2.campaign;
10960
- return _context69.abrupt("return", campaign);
11309
+ return _context72.abrupt("return", campaign);
10961
11310
 
10962
11311
  case 5:
10963
11312
  case "end":
10964
- return _context69.stop();
11313
+ return _context72.stop();
10965
11314
  }
10966
11315
  }
10967
- }, _callee69, this);
11316
+ }, _callee72, this);
10968
11317
  }));
10969
11318
 
10970
- function createCampaign(_x100) {
11319
+ function createCampaign(_x104) {
10971
11320
  return _createCampaign.apply(this, arguments);
10972
11321
  }
10973
11322
 
@@ -10983,15 +11332,15 @@ var StreamChat = /*#__PURE__*/function () {
10983
11332
  }, {
10984
11333
  key: "queryCampaigns",
10985
11334
  value: function () {
10986
- var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(filters) {
11335
+ var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(filters) {
10987
11336
  var options,
10988
- _args70 = arguments;
10989
- return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
11337
+ _args73 = arguments;
11338
+ return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
10990
11339
  while (1) {
10991
- switch (_context70.prev = _context70.next) {
11340
+ switch (_context73.prev = _context73.next) {
10992
11341
  case 0:
10993
- options = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {};
10994
- _context70.next = 3;
11342
+ options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11343
+ _context73.next = 3;
10995
11344
  return this.get(this.baseURL + "/campaigns", {
10996
11345
  payload: _objectSpread({
10997
11346
  filter_conditions: filters
@@ -10999,17 +11348,17 @@ var StreamChat = /*#__PURE__*/function () {
10999
11348
  });
11000
11349
 
11001
11350
  case 3:
11002
- return _context70.abrupt("return", _context70.sent);
11351
+ return _context73.abrupt("return", _context73.sent);
11003
11352
 
11004
11353
  case 4:
11005
11354
  case "end":
11006
- return _context70.stop();
11355
+ return _context73.stop();
11007
11356
  }
11008
11357
  }
11009
- }, _callee70, this);
11358
+ }, _callee73, this);
11010
11359
  }));
11011
11360
 
11012
- function queryCampaigns(_x101) {
11361
+ function queryCampaigns(_x105) {
11013
11362
  return _queryCampaigns.apply(this, arguments);
11014
11363
  }
11015
11364
 
@@ -11027,32 +11376,32 @@ var StreamChat = /*#__PURE__*/function () {
11027
11376
  }, {
11028
11377
  key: "updateCampaign",
11029
11378
  value: function () {
11030
- var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(id, params) {
11379
+ var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id, params) {
11031
11380
  var _yield$this$put2, campaign;
11032
11381
 
11033
- return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
11382
+ return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11034
11383
  while (1) {
11035
- switch (_context71.prev = _context71.next) {
11384
+ switch (_context74.prev = _context74.next) {
11036
11385
  case 0:
11037
- _context71.next = 2;
11386
+ _context74.next = 2;
11038
11387
  return this.put(this.baseURL + "/campaigns/".concat(id), {
11039
11388
  campaign: params
11040
11389
  });
11041
11390
 
11042
11391
  case 2:
11043
- _yield$this$put2 = _context71.sent;
11392
+ _yield$this$put2 = _context74.sent;
11044
11393
  campaign = _yield$this$put2.campaign;
11045
- return _context71.abrupt("return", campaign);
11394
+ return _context74.abrupt("return", campaign);
11046
11395
 
11047
11396
  case 5:
11048
11397
  case "end":
11049
- return _context71.stop();
11398
+ return _context74.stop();
11050
11399
  }
11051
11400
  }
11052
- }, _callee71, this);
11401
+ }, _callee74, this);
11053
11402
  }));
11054
11403
 
11055
- function updateCampaign(_x102, _x103) {
11404
+ function updateCampaign(_x106, _x107) {
11056
11405
  return _updateCampaign.apply(this, arguments);
11057
11406
  }
11058
11407
 
@@ -11069,25 +11418,25 @@ var StreamChat = /*#__PURE__*/function () {
11069
11418
  }, {
11070
11419
  key: "deleteCampaign",
11071
11420
  value: function () {
11072
- var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(id) {
11421
+ var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11073
11422
  var params,
11074
- _args72 = arguments;
11075
- return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
11423
+ _args75 = arguments;
11424
+ return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11076
11425
  while (1) {
11077
- switch (_context72.prev = _context72.next) {
11426
+ switch (_context75.prev = _context75.next) {
11078
11427
  case 0:
11079
- params = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {};
11080
- return _context72.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11428
+ params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11429
+ return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11081
11430
 
11082
11431
  case 2:
11083
11432
  case "end":
11084
- return _context72.stop();
11433
+ return _context75.stop();
11085
11434
  }
11086
11435
  }
11087
- }, _callee72, this);
11436
+ }, _callee75, this);
11088
11437
  }));
11089
11438
 
11090
- function deleteCampaign(_x104) {
11439
+ function deleteCampaign(_x108) {
11091
11440
  return _deleteCampaign.apply(this, arguments);
11092
11441
  }
11093
11442
 
@@ -11105,33 +11454,33 @@ var StreamChat = /*#__PURE__*/function () {
11105
11454
  }, {
11106
11455
  key: "scheduleCampaign",
11107
11456
  value: function () {
11108
- var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(id, params) {
11457
+ var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11109
11458
  var scheduledFor, _yield$this$patch, campaign;
11110
11459
 
11111
- return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
11460
+ return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11112
11461
  while (1) {
11113
- switch (_context73.prev = _context73.next) {
11462
+ switch (_context76.prev = _context76.next) {
11114
11463
  case 0:
11115
11464
  scheduledFor = params.scheduledFor;
11116
- _context73.next = 3;
11465
+ _context76.next = 3;
11117
11466
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
11118
11467
  scheduled_for: scheduledFor
11119
11468
  });
11120
11469
 
11121
11470
  case 3:
11122
- _yield$this$patch = _context73.sent;
11471
+ _yield$this$patch = _context76.sent;
11123
11472
  campaign = _yield$this$patch.campaign;
11124
- return _context73.abrupt("return", campaign);
11473
+ return _context76.abrupt("return", campaign);
11125
11474
 
11126
11475
  case 6:
11127
11476
  case "end":
11128
- return _context73.stop();
11477
+ return _context76.stop();
11129
11478
  }
11130
11479
  }
11131
- }, _callee73, this);
11480
+ }, _callee76, this);
11132
11481
  }));
11133
11482
 
11134
- function scheduleCampaign(_x105, _x106) {
11483
+ function scheduleCampaign(_x109, _x110) {
11135
11484
  return _scheduleCampaign.apply(this, arguments);
11136
11485
  }
11137
11486
 
@@ -11148,30 +11497,30 @@ var StreamChat = /*#__PURE__*/function () {
11148
11497
  }, {
11149
11498
  key: "stopCampaign",
11150
11499
  value: function () {
11151
- var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id) {
11500
+ var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(id) {
11152
11501
  var _yield$this$patch2, campaign;
11153
11502
 
11154
- return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
11503
+ return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11155
11504
  while (1) {
11156
- switch (_context74.prev = _context74.next) {
11505
+ switch (_context77.prev = _context77.next) {
11157
11506
  case 0:
11158
- _context74.next = 2;
11507
+ _context77.next = 2;
11159
11508
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
11160
11509
 
11161
11510
  case 2:
11162
- _yield$this$patch2 = _context74.sent;
11511
+ _yield$this$patch2 = _context77.sent;
11163
11512
  campaign = _yield$this$patch2.campaign;
11164
- return _context74.abrupt("return", campaign);
11513
+ return _context77.abrupt("return", campaign);
11165
11514
 
11166
11515
  case 5:
11167
11516
  case "end":
11168
- return _context74.stop();
11517
+ return _context77.stop();
11169
11518
  }
11170
11519
  }
11171
- }, _callee74, this);
11520
+ }, _callee77, this);
11172
11521
  }));
11173
11522
 
11174
- function stopCampaign(_x107) {
11523
+ function stopCampaign(_x111) {
11175
11524
  return _stopCampaign.apply(this, arguments);
11176
11525
  }
11177
11526
 
@@ -11188,30 +11537,30 @@ var StreamChat = /*#__PURE__*/function () {
11188
11537
  }, {
11189
11538
  key: "resumeCampaign",
11190
11539
  value: function () {
11191
- var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
11540
+ var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11192
11541
  var _yield$this$patch3, campaign;
11193
11542
 
11194
- return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
11543
+ return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11195
11544
  while (1) {
11196
- switch (_context75.prev = _context75.next) {
11545
+ switch (_context78.prev = _context78.next) {
11197
11546
  case 0:
11198
- _context75.next = 2;
11547
+ _context78.next = 2;
11199
11548
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
11200
11549
 
11201
11550
  case 2:
11202
- _yield$this$patch3 = _context75.sent;
11551
+ _yield$this$patch3 = _context78.sent;
11203
11552
  campaign = _yield$this$patch3.campaign;
11204
- return _context75.abrupt("return", campaign);
11553
+ return _context78.abrupt("return", campaign);
11205
11554
 
11206
11555
  case 5:
11207
11556
  case "end":
11208
- return _context75.stop();
11557
+ return _context78.stop();
11209
11558
  }
11210
11559
  }
11211
- }, _callee75, this);
11560
+ }, _callee78, this);
11212
11561
  }));
11213
11562
 
11214
- function resumeCampaign(_x108) {
11563
+ function resumeCampaign(_x112) {
11215
11564
  return _resumeCampaign.apply(this, arguments);
11216
11565
  }
11217
11566
 
@@ -11229,30 +11578,30 @@ var StreamChat = /*#__PURE__*/function () {
11229
11578
  }, {
11230
11579
  key: "testCampaign",
11231
11580
  value: function () {
11232
- var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
11581
+ var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(id, params) {
11233
11582
  var users;
11234
- return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
11583
+ return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11235
11584
  while (1) {
11236
- switch (_context76.prev = _context76.next) {
11585
+ switch (_context79.prev = _context79.next) {
11237
11586
  case 0:
11238
11587
  users = params.users;
11239
- _context76.next = 3;
11588
+ _context79.next = 3;
11240
11589
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
11241
11590
  users: users
11242
11591
  });
11243
11592
 
11244
11593
  case 3:
11245
- return _context76.abrupt("return", _context76.sent);
11594
+ return _context79.abrupt("return", _context79.sent);
11246
11595
 
11247
11596
  case 4:
11248
11597
  case "end":
11249
- return _context76.stop();
11598
+ return _context79.stop();
11250
11599
  }
11251
11600
  }
11252
- }, _callee76, this);
11601
+ }, _callee79, this);
11253
11602
  }));
11254
11603
 
11255
- function testCampaign(_x109, _x110) {
11604
+ function testCampaign(_x113, _x114) {
11256
11605
  return _testCampaign.apply(this, arguments);
11257
11606
  }
11258
11607
 
@@ -11268,24 +11617,24 @@ var StreamChat = /*#__PURE__*/function () {
11268
11617
  }, {
11269
11618
  key: "enrichURL",
11270
11619
  value: function () {
11271
- var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(url) {
11272
- return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
11620
+ var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(url) {
11621
+ return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11273
11622
  while (1) {
11274
- switch (_context77.prev = _context77.next) {
11623
+ switch (_context80.prev = _context80.next) {
11275
11624
  case 0:
11276
- return _context77.abrupt("return", this.get(this.baseURL + "/og", {
11625
+ return _context80.abrupt("return", this.get(this.baseURL + "/og", {
11277
11626
  url: url
11278
11627
  }));
11279
11628
 
11280
11629
  case 1:
11281
11630
  case "end":
11282
- return _context77.stop();
11631
+ return _context80.stop();
11283
11632
  }
11284
11633
  }
11285
- }, _callee77, this);
11634
+ }, _callee80, this);
11286
11635
  }));
11287
11636
 
11288
- function enrichURL(_x111) {
11637
+ function enrichURL(_x115) {
11289
11638
  return _enrichURL.apply(this, arguments);
11290
11639
  }
11291
11640
 
@@ -11302,22 +11651,22 @@ var StreamChat = /*#__PURE__*/function () {
11302
11651
  }, {
11303
11652
  key: "getTask",
11304
11653
  value: function () {
11305
- var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
11306
- return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
11654
+ var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
11655
+ return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11307
11656
  while (1) {
11308
- switch (_context78.prev = _context78.next) {
11657
+ switch (_context81.prev = _context81.next) {
11309
11658
  case 0:
11310
- return _context78.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11659
+ return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11311
11660
 
11312
11661
  case 1:
11313
11662
  case "end":
11314
- return _context78.stop();
11663
+ return _context81.stop();
11315
11664
  }
11316
11665
  }
11317
- }, _callee78, this);
11666
+ }, _callee81, this);
11318
11667
  }));
11319
11668
 
11320
- function getTask(_x112) {
11669
+ function getTask(_x116) {
11321
11670
  return _getTask.apply(this, arguments);
11322
11671
  }
11323
11672
 
@@ -11335,31 +11684,31 @@ var StreamChat = /*#__PURE__*/function () {
11335
11684
  }, {
11336
11685
  key: "deleteChannels",
11337
11686
  value: function () {
11338
- var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(cids) {
11687
+ var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(cids) {
11339
11688
  var options,
11340
- _args79 = arguments;
11341
- return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
11689
+ _args82 = arguments;
11690
+ return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11342
11691
  while (1) {
11343
- switch (_context79.prev = _context79.next) {
11692
+ switch (_context82.prev = _context82.next) {
11344
11693
  case 0:
11345
- options = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {};
11346
- _context79.next = 3;
11694
+ options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11695
+ _context82.next = 3;
11347
11696
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11348
11697
  cids: cids
11349
11698
  }, options));
11350
11699
 
11351
11700
  case 3:
11352
- return _context79.abrupt("return", _context79.sent);
11701
+ return _context82.abrupt("return", _context82.sent);
11353
11702
 
11354
11703
  case 4:
11355
11704
  case "end":
11356
- return _context79.stop();
11705
+ return _context82.stop();
11357
11706
  }
11358
11707
  }
11359
- }, _callee79, this);
11708
+ }, _callee82, this);
11360
11709
  }));
11361
11710
 
11362
- function deleteChannels(_x113) {
11711
+ function deleteChannels(_x117) {
11363
11712
  return _deleteChannels.apply(this, arguments);
11364
11713
  }
11365
11714
 
@@ -11377,17 +11726,17 @@ var StreamChat = /*#__PURE__*/function () {
11377
11726
  }, {
11378
11727
  key: "deleteUsers",
11379
11728
  value: function () {
11380
- var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(user_ids) {
11729
+ var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(user_ids) {
11381
11730
  var options,
11382
- _args80 = arguments;
11383
- return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
11731
+ _args83 = arguments;
11732
+ return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11384
11733
  while (1) {
11385
- switch (_context80.prev = _context80.next) {
11734
+ switch (_context83.prev = _context83.next) {
11386
11735
  case 0:
11387
- options = _args80.length > 1 && _args80[1] !== undefined ? _args80[1] : {};
11736
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
11388
11737
 
11389
11738
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11390
- _context80.next = 3;
11739
+ _context83.next = 3;
11391
11740
  break;
11392
11741
  }
11393
11742
 
@@ -11395,7 +11744,7 @@ var StreamChat = /*#__PURE__*/function () {
11395
11744
 
11396
11745
  case 3:
11397
11746
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11398
- _context80.next = 5;
11747
+ _context83.next = 5;
11399
11748
  break;
11400
11749
  }
11401
11750
 
@@ -11403,30 +11752,30 @@ var StreamChat = /*#__PURE__*/function () {
11403
11752
 
11404
11753
  case 5:
11405
11754
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11406
- _context80.next = 7;
11755
+ _context83.next = 7;
11407
11756
  break;
11408
11757
  }
11409
11758
 
11410
11759
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11411
11760
 
11412
11761
  case 7:
11413
- _context80.next = 9;
11762
+ _context83.next = 9;
11414
11763
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11415
11764
  user_ids: user_ids
11416
11765
  }, options));
11417
11766
 
11418
11767
  case 9:
11419
- return _context80.abrupt("return", _context80.sent);
11768
+ return _context83.abrupt("return", _context83.sent);
11420
11769
 
11421
11770
  case 10:
11422
11771
  case "end":
11423
- return _context80.stop();
11772
+ return _context83.stop();
11424
11773
  }
11425
11774
  }
11426
- }, _callee80, this);
11775
+ }, _callee83, this);
11427
11776
  }));
11428
11777
 
11429
- function deleteUsers(_x114) {
11778
+ function deleteUsers(_x118) {
11430
11779
  return _deleteUsers.apply(this, arguments);
11431
11780
  }
11432
11781
 
@@ -11447,28 +11796,28 @@ var StreamChat = /*#__PURE__*/function () {
11447
11796
  }, {
11448
11797
  key: "_createImportURL",
11449
11798
  value: function () {
11450
- var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(filename) {
11451
- return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
11799
+ var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(filename) {
11800
+ return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11452
11801
  while (1) {
11453
- switch (_context81.prev = _context81.next) {
11802
+ switch (_context84.prev = _context84.next) {
11454
11803
  case 0:
11455
- _context81.next = 2;
11804
+ _context84.next = 2;
11456
11805
  return this.post(this.baseURL + "/import_urls", {
11457
11806
  filename: filename
11458
11807
  });
11459
11808
 
11460
11809
  case 2:
11461
- return _context81.abrupt("return", _context81.sent);
11810
+ return _context84.abrupt("return", _context84.sent);
11462
11811
 
11463
11812
  case 3:
11464
11813
  case "end":
11465
- return _context81.stop();
11814
+ return _context84.stop();
11466
11815
  }
11467
11816
  }
11468
- }, _callee81, this);
11817
+ }, _callee84, this);
11469
11818
  }));
11470
11819
 
11471
- function _createImportURL(_x115) {
11820
+ function _createImportURL(_x119) {
11472
11821
  return _createImportURL2.apply(this, arguments);
11473
11822
  }
11474
11823
 
@@ -11490,33 +11839,33 @@ var StreamChat = /*#__PURE__*/function () {
11490
11839
  }, {
11491
11840
  key: "_createImport",
11492
11841
  value: function () {
11493
- var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(path) {
11842
+ var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(path) {
11494
11843
  var options,
11495
- _args82 = arguments;
11496
- return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
11844
+ _args85 = arguments;
11845
+ return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11497
11846
  while (1) {
11498
- switch (_context82.prev = _context82.next) {
11847
+ switch (_context85.prev = _context85.next) {
11499
11848
  case 0:
11500
- options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {
11849
+ options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
11501
11850
  mode: 'upsert'
11502
11851
  };
11503
- _context82.next = 3;
11852
+ _context85.next = 3;
11504
11853
  return this.post(this.baseURL + "/imports", _objectSpread({
11505
11854
  path: path
11506
11855
  }, options));
11507
11856
 
11508
11857
  case 3:
11509
- return _context82.abrupt("return", _context82.sent);
11858
+ return _context85.abrupt("return", _context85.sent);
11510
11859
 
11511
11860
  case 4:
11512
11861
  case "end":
11513
- return _context82.stop();
11862
+ return _context85.stop();
11514
11863
  }
11515
11864
  }
11516
- }, _callee82, this);
11865
+ }, _callee85, this);
11517
11866
  }));
11518
11867
 
11519
- function _createImport(_x116) {
11868
+ function _createImport(_x120) {
11520
11869
  return _createImport2.apply(this, arguments);
11521
11870
  }
11522
11871
 
@@ -11538,26 +11887,26 @@ var StreamChat = /*#__PURE__*/function () {
11538
11887
  }, {
11539
11888
  key: "_getImport",
11540
11889
  value: function () {
11541
- var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(id) {
11542
- return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
11890
+ var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(id) {
11891
+ return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
11543
11892
  while (1) {
11544
- switch (_context83.prev = _context83.next) {
11893
+ switch (_context86.prev = _context86.next) {
11545
11894
  case 0:
11546
- _context83.next = 2;
11895
+ _context86.next = 2;
11547
11896
  return this.get(this.baseURL + "/imports/".concat(id));
11548
11897
 
11549
11898
  case 2:
11550
- return _context83.abrupt("return", _context83.sent);
11899
+ return _context86.abrupt("return", _context86.sent);
11551
11900
 
11552
11901
  case 3:
11553
11902
  case "end":
11554
- return _context83.stop();
11903
+ return _context86.stop();
11555
11904
  }
11556
11905
  }
11557
- }, _callee83, this);
11906
+ }, _callee86, this);
11558
11907
  }));
11559
11908
 
11560
- function _getImport(_x117) {
11909
+ function _getImport(_x121) {
11561
11910
  return _getImport2.apply(this, arguments);
11562
11911
  }
11563
11912
 
@@ -11579,26 +11928,26 @@ var StreamChat = /*#__PURE__*/function () {
11579
11928
  }, {
11580
11929
  key: "_listImports",
11581
11930
  value: function () {
11582
- var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(options) {
11583
- return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
11931
+ var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87(options) {
11932
+ return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
11584
11933
  while (1) {
11585
- switch (_context84.prev = _context84.next) {
11934
+ switch (_context87.prev = _context87.next) {
11586
11935
  case 0:
11587
- _context84.next = 2;
11936
+ _context87.next = 2;
11588
11937
  return this.get(this.baseURL + "/imports", options);
11589
11938
 
11590
11939
  case 2:
11591
- return _context84.abrupt("return", _context84.sent);
11940
+ return _context87.abrupt("return", _context87.sent);
11592
11941
 
11593
11942
  case 3:
11594
11943
  case "end":
11595
- return _context84.stop();
11944
+ return _context87.stop();
11596
11945
  }
11597
11946
  }
11598
- }, _callee84, this);
11947
+ }, _callee87, this);
11599
11948
  }));
11600
11949
 
11601
- function _listImports(_x118) {
11950
+ function _listImports(_x122) {
11602
11951
  return _listImports2.apply(this, arguments);
11603
11952
  }
11604
11953
 
@@ -11617,28 +11966,28 @@ var StreamChat = /*#__PURE__*/function () {
11617
11966
  }, {
11618
11967
  key: "upsertPushProvider",
11619
11968
  value: function () {
11620
- var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(pushProvider) {
11621
- return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
11969
+ var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(pushProvider) {
11970
+ return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
11622
11971
  while (1) {
11623
- switch (_context85.prev = _context85.next) {
11972
+ switch (_context88.prev = _context88.next) {
11624
11973
  case 0:
11625
- _context85.next = 2;
11974
+ _context88.next = 2;
11626
11975
  return this.post(this.baseURL + "/push_providers", {
11627
11976
  push_provider: pushProvider
11628
11977
  });
11629
11978
 
11630
11979
  case 2:
11631
- return _context85.abrupt("return", _context85.sent);
11980
+ return _context88.abrupt("return", _context88.sent);
11632
11981
 
11633
11982
  case 3:
11634
11983
  case "end":
11635
- return _context85.stop();
11984
+ return _context88.stop();
11636
11985
  }
11637
11986
  }
11638
- }, _callee85, this);
11987
+ }, _callee88, this);
11639
11988
  }));
11640
11989
 
11641
- function upsertPushProvider(_x119) {
11990
+ function upsertPushProvider(_x123) {
11642
11991
  return _upsertPushProvider.apply(this, arguments);
11643
11992
  }
11644
11993
 
@@ -11657,28 +12006,28 @@ var StreamChat = /*#__PURE__*/function () {
11657
12006
  }, {
11658
12007
  key: "deletePushProvider",
11659
12008
  value: function () {
11660
- var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(_ref10) {
12009
+ var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee89(_ref10) {
11661
12010
  var type, name;
11662
- return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
12011
+ return _regeneratorRuntime__default['default'].wrap(function _callee89$(_context89) {
11663
12012
  while (1) {
11664
- switch (_context86.prev = _context86.next) {
12013
+ switch (_context89.prev = _context89.next) {
11665
12014
  case 0:
11666
12015
  type = _ref10.type, name = _ref10.name;
11667
- _context86.next = 3;
12016
+ _context89.next = 3;
11668
12017
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11669
12018
 
11670
12019
  case 3:
11671
- return _context86.abrupt("return", _context86.sent);
12020
+ return _context89.abrupt("return", _context89.sent);
11672
12021
 
11673
12022
  case 4:
11674
12023
  case "end":
11675
- return _context86.stop();
12024
+ return _context89.stop();
11676
12025
  }
11677
12026
  }
11678
- }, _callee86, this);
12027
+ }, _callee89, this);
11679
12028
  }));
11680
12029
 
11681
- function deletePushProvider(_x120) {
12030
+ function deletePushProvider(_x124) {
11682
12031
  return _deletePushProvider.apply(this, arguments);
11683
12032
  }
11684
12033
 
@@ -11695,23 +12044,23 @@ var StreamChat = /*#__PURE__*/function () {
11695
12044
  }, {
11696
12045
  key: "listPushProviders",
11697
12046
  value: function () {
11698
- var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87() {
11699
- return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
12047
+ var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee90() {
12048
+ return _regeneratorRuntime__default['default'].wrap(function _callee90$(_context90) {
11700
12049
  while (1) {
11701
- switch (_context87.prev = _context87.next) {
12050
+ switch (_context90.prev = _context90.next) {
11702
12051
  case 0:
11703
- _context87.next = 2;
12052
+ _context90.next = 2;
11704
12053
  return this.get(this.baseURL + "/push_providers");
11705
12054
 
11706
12055
  case 2:
11707
- return _context87.abrupt("return", _context87.sent);
12056
+ return _context90.abrupt("return", _context90.sent);
11708
12057
 
11709
12058
  case 3:
11710
12059
  case "end":
11711
- return _context87.stop();
12060
+ return _context90.stop();
11712
12061
  }
11713
12062
  }
11714
- }, _callee87, this);
12063
+ }, _callee90, this);
11715
12064
  }));
11716
12065
 
11717
12066
  function listPushProviders() {
@@ -11739,26 +12088,26 @@ var StreamChat = /*#__PURE__*/function () {
11739
12088
  }, {
11740
12089
  key: "commitMessage",
11741
12090
  value: function () {
11742
- var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(id) {
11743
- return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
12091
+ var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee91(id) {
12092
+ return _regeneratorRuntime__default['default'].wrap(function _callee91$(_context91) {
11744
12093
  while (1) {
11745
- switch (_context88.prev = _context88.next) {
12094
+ switch (_context91.prev = _context91.next) {
11746
12095
  case 0:
11747
- _context88.next = 2;
12096
+ _context91.next = 2;
11748
12097
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
11749
12098
 
11750
12099
  case 2:
11751
- return _context88.abrupt("return", _context88.sent);
12100
+ return _context91.abrupt("return", _context91.sent);
11752
12101
 
11753
12102
  case 3:
11754
12103
  case "end":
11755
- return _context88.stop();
12104
+ return _context91.stop();
11756
12105
  }
11757
12106
  }
11758
- }, _callee88, this);
12107
+ }, _callee91, this);
11759
12108
  }));
11760
12109
 
11761
- function commitMessage(_x121) {
12110
+ function commitMessage(_x125) {
11762
12111
  return _commitMessage.apply(this, arguments);
11763
12112
  }
11764
12113
 
@@ -11814,6 +12163,7 @@ var EVENT_MAP = {
11814
12163
  'notification.message_new': true,
11815
12164
  'notification.mutes_updated': true,
11816
12165
  'notification.removed_from_channel': true,
12166
+ 'notification.thread_message_new': true,
11817
12167
  'reaction.deleted': true,
11818
12168
  'reaction.new': true,
11819
12169
  'reaction.updated': true,
@@ -11932,6 +12282,7 @@ exports.MinPriority = MinPriority;
11932
12282
  exports.Permission = Permission;
11933
12283
  exports.StableWSConnection = StableWSConnection;
11934
12284
  exports.StreamChat = StreamChat;
12285
+ exports.Thread = Thread;
11935
12286
  exports.TokenManager = TokenManager;
11936
12287
  exports.UserFromToken = UserFromToken;
11937
12288
  exports.buildWsFatalInsight = buildWsFatalInsight;
@@ -11939,6 +12290,7 @@ exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
11939
12290
  exports.chatCodes = chatCodes;
11940
12291
  exports.decodeBase64 = decodeBase64;
11941
12292
  exports.encodeBase64 = encodeBase64;
12293
+ exports.formatMessage = formatMessage;
11942
12294
  exports.isOwnUser = isOwnUser;
11943
12295
  exports.logChatPromiseExecution = logChatPromiseExecution;
11944
12296
  exports.postInsights = postInsights;