stream-chat 8.15.0 → 8.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -94,9 +94,347 @@ var decodeBase64 = function decodeBase64(s) {
94
94
  return r;
95
95
  };
96
96
 
97
- function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
97
+ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
98
98
 
99
- function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
99
+ function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
100
+
101
+ function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
102
+
103
+ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
104
+
105
+ function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
106
+
107
+ /**
108
+ * logChatPromiseExecution - utility function for logging the execution of a promise..
109
+ * use this when you want to run the promise and handle errors by logging a warning
110
+ *
111
+ * @param {Promise<T>} promise The promise you want to run and log
112
+ * @param {string} name A descriptive name of what the promise does for log output
113
+ *
114
+ */
115
+ function logChatPromiseExecution(promise, name) {
116
+ promise.then().catch(function (error) {
117
+ console.warn("failed to do ".concat(name, ", ran into error: "), error);
118
+ });
119
+ }
120
+ var sleep = function sleep(m) {
121
+ return new Promise(function (r) {
122
+ return setTimeout(r, m);
123
+ });
124
+ };
125
+ function isFunction(value) {
126
+ return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
127
+ }
128
+ var chatCodes = {
129
+ TOKEN_EXPIRED: 40,
130
+ WS_CLOSED_SUCCESS: 1000
131
+ };
132
+
133
+ function isReadableStream(obj) {
134
+ return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
135
+ }
136
+
137
+ function isBuffer(obj) {
138
+ return obj != null && obj.constructor != null && // @ts-expect-error
139
+ typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
140
+ obj.constructor.isBuffer(obj);
141
+ }
142
+
143
+ function isFileWebAPI(uri) {
144
+ return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
145
+ }
146
+
147
+ function isOwnUser(user) {
148
+ return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
149
+ }
150
+
151
+ function isBlobWebAPI(uri) {
152
+ return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
153
+ }
154
+
155
+ function isOwnUserBaseProperty(property) {
156
+ var ownUserBaseProperties = {
157
+ channel_mutes: true,
158
+ devices: true,
159
+ mutes: true,
160
+ total_unread_count: true,
161
+ unread_channels: true,
162
+ unread_count: true,
163
+ invisible: true,
164
+ roles: true
165
+ };
166
+ return ownUserBaseProperties[property];
167
+ }
168
+ function addFileToFormData(uri, name, contentType) {
169
+ var data = new FormData();
170
+
171
+ if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
172
+ if (name) data.append('file', uri, name);else data.append('file', uri);
173
+ } else {
174
+ data.append('file', {
175
+ uri: uri,
176
+ name: name || uri.split('/').reverse()[0],
177
+ contentType: contentType || undefined,
178
+ type: contentType || undefined
179
+ });
180
+ }
181
+
182
+ return data;
183
+ }
184
+ function normalizeQuerySort(sort) {
185
+ var sortFields = [];
186
+ var sortArr = Array.isArray(sort) ? sort : [sort];
187
+
188
+ var _iterator = _createForOfIteratorHelper$4(sortArr),
189
+ _step;
190
+
191
+ try {
192
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
193
+ var item = _step.value;
194
+ var entries = Object.entries(item);
195
+
196
+ if (entries.length > 1) {
197
+ console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
198
+ }
199
+
200
+ for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
201
+ var _entries$_i = _slicedToArray(_entries[_i], 2),
202
+ field = _entries$_i[0],
203
+ direction = _entries$_i[1];
204
+
205
+ sortFields.push({
206
+ field: field,
207
+ direction: direction
208
+ });
209
+ }
210
+ }
211
+ } catch (err) {
212
+ _iterator.e(err);
213
+ } finally {
214
+ _iterator.f();
215
+ }
216
+
217
+ return sortFields;
218
+ }
219
+ /**
220
+ * retryInterval - A retry interval which increases acc to number of failures
221
+ *
222
+ * @return {number} Duration to wait in milliseconds
223
+ */
224
+
225
+ function retryInterval(numberOfFailures) {
226
+ // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
227
+ var max = Math.min(500 + numberOfFailures * 2000, 25000);
228
+ var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
229
+ return Math.floor(Math.random() * (max - min) + min);
230
+ }
231
+ function randomId() {
232
+ return generateUUIDv4();
233
+ }
234
+
235
+ function hex(bytes) {
236
+ var s = '';
237
+
238
+ for (var i = 0; i < bytes.length; i++) {
239
+ s += bytes[i].toString(16).padStart(2, '0');
240
+ }
241
+
242
+ return s;
243
+ } // https://tools.ietf.org/html/rfc4122
244
+
245
+
246
+ function generateUUIDv4() {
247
+ var bytes = getRandomBytes(16);
248
+ bytes[6] = bytes[6] & 0x0f | 0x40; // version
249
+
250
+ bytes[8] = bytes[8] & 0xbf | 0x80; // variant
251
+
252
+ return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
253
+ }
254
+
255
+ function getRandomValuesWithMathRandom(bytes) {
256
+ var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
257
+
258
+ for (var i = 0; i < bytes.length; i++) {
259
+ bytes[i] = Math.random() * max;
260
+ }
261
+ }
262
+
263
+ var getRandomValues = function () {
264
+ var _crypto;
265
+
266
+ if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
267
+ return crypto.getRandomValues.bind(crypto);
268
+ } else if (typeof msCrypto !== 'undefined') {
269
+ return msCrypto.getRandomValues.bind(msCrypto);
270
+ } else {
271
+ return getRandomValuesWithMathRandom;
272
+ }
273
+ }();
274
+
275
+ function getRandomBytes(length) {
276
+ var bytes = new Uint8Array(length);
277
+ getRandomValues(bytes);
278
+ return bytes;
279
+ }
280
+
281
+ function convertErrorToJson(err) {
282
+ var jsonObj = {};
283
+ if (!err) return jsonObj;
284
+
285
+ try {
286
+ Object.getOwnPropertyNames(err).forEach(function (key) {
287
+ jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
288
+ });
289
+ } catch (_) {
290
+ return {
291
+ error: 'failed to serialize the error'
292
+ };
293
+ }
294
+
295
+ return jsonObj;
296
+ }
297
+ /**
298
+ * isOnline safely return the navigator.online value for browser env
299
+ * if navigator is not in global object, it always return true
300
+ */
301
+
302
+ function isOnline() {
303
+ var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
304
+
305
+ if (!nav) {
306
+ console.warn('isOnline failed to access window.navigator and assume browser is online');
307
+ return true;
308
+ } // RN navigator has undefined for onLine
309
+
310
+
311
+ if (typeof nav.onLine !== 'boolean') {
312
+ return true;
313
+ }
314
+
315
+ return nav.onLine;
316
+ }
317
+ /**
318
+ * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
319
+ */
320
+
321
+ function addConnectionEventListeners(cb) {
322
+ if (typeof window !== 'undefined' && window.addEventListener) {
323
+ window.addEventListener('offline', cb);
324
+ window.addEventListener('online', cb);
325
+ }
326
+ }
327
+ function removeConnectionEventListeners(cb) {
328
+ if (typeof window !== 'undefined' && window.removeEventListener) {
329
+ window.removeEventListener('offline', cb);
330
+ window.removeEventListener('online', cb);
331
+ }
332
+ }
333
+ var axiosParamsSerializer = function axiosParamsSerializer(params) {
334
+ var newParams = [];
335
+
336
+ for (var k in params) {
337
+ // Stream backend doesn't treat "undefined" value same as value not being present.
338
+ // So, we need to skip the undefined values.
339
+ if (params[k] === undefined) continue;
340
+
341
+ if (Array.isArray(params[k]) || _typeof(params[k]) === 'object') {
342
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
343
+ } else {
344
+ newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
345
+ }
346
+ }
347
+
348
+ return newParams.join('&');
349
+ };
350
+ /**
351
+ * formatMessage - Takes the message object. Parses the dates, sets __html
352
+ * and sets the status to received if missing. Returns a message object
353
+ *
354
+ * @param {MessageResponse<StreamChatGenerics>} message a message object
355
+ *
356
+ */
357
+
358
+ function formatMessage(message) {
359
+ return _objectSpread$8(_objectSpread$8({}, message), {}, {
360
+ /**
361
+ * @deprecated please use `html`
362
+ */
363
+ __html: message.html,
364
+ // parse the date..
365
+ pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
366
+ created_at: message.created_at ? new Date(message.created_at) : new Date(),
367
+ updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
368
+ status: message.status || 'received'
369
+ });
370
+ }
371
+ function addToMessageList(messages, message) {
372
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
373
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
374
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
375
+ var addMessageToList = addIfDoesNotExist || timestampChanged;
376
+ var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
377
+ // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
378
+
379
+ if (timestampChanged) {
380
+ messageArr = messageArr.filter(function (msg) {
381
+ return !(msg.id && message.id === msg.id);
382
+ });
383
+ } // Get array length after filtering
384
+
385
+
386
+ var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
387
+
388
+ if (messageArrayLength === 0 && addMessageToList) {
389
+ return messageArr.concat(message);
390
+ } else if (messageArrayLength === 0) {
391
+ return _toConsumableArray(messageArr);
392
+ }
393
+
394
+ var messageTime = message[sortBy].getTime();
395
+ var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
396
+
397
+ if (messageIsNewest && addMessageToList) {
398
+ return messageArr.concat(message);
399
+ } else if (messageIsNewest) {
400
+ return _toConsumableArray(messageArr);
401
+ } // find the closest index to push the new message
402
+
403
+
404
+ var left = 0;
405
+ var middle = 0;
406
+ var right = messageArrayLength - 1;
407
+
408
+ while (left <= right) {
409
+ middle = Math.floor((right + left) / 2);
410
+ if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
411
+ } // message already exists and not filtered due to timestampChanged, update and return
412
+
413
+
414
+ if (!timestampChanged && message.id) {
415
+ if (messageArr[left] && message.id === messageArr[left].id) {
416
+ messageArr[left] = message;
417
+ return _toConsumableArray(messageArr);
418
+ }
419
+
420
+ if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
421
+ messageArr[left - 1] = message;
422
+ return _toConsumableArray(messageArr);
423
+ }
424
+ } // Do not add updated or deleted messages to the list if they do not already exist
425
+ // or have a timestamp change.
426
+
427
+
428
+ if (addMessageToList) {
429
+ messageArr.splice(left, 0, message);
430
+ }
431
+
432
+ return _toConsumableArray(messageArr);
433
+ }
434
+
435
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
436
+
437
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
100
438
 
101
439
  /**
102
440
  * ChannelState - A container class for the channel state.
@@ -173,7 +511,7 @@ var ChannelState = /*#__PURE__*/function () {
173
511
  var m = messages[i];
174
512
 
175
513
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
176
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
514
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
177
515
  user: user
178
516
  });
179
517
  }
@@ -228,7 +566,7 @@ var ChannelState = /*#__PURE__*/function () {
228
566
  user: m.user
229
567
  };
230
568
  } else {
231
- messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
569
+ messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
232
570
  type: 'deleted',
233
571
  deleted_at: user.deleted_at
234
572
  });
@@ -335,7 +673,7 @@ var ChannelState = /*#__PURE__*/function () {
335
673
  }, {
336
674
  key: "formatMessage",
337
675
  value: function formatMessage(message) {
338
- return _objectSpread$6(_objectSpread$6({}, message), {}, {
676
+ return _objectSpread$7(_objectSpread$7({}, message), {}, {
339
677
  /**
340
678
  * @deprecated please use `html`
341
679
  */
@@ -553,7 +891,7 @@ var ChannelState = /*#__PURE__*/function () {
553
891
  var parseMessage = function parseMessage(m) {
554
892
  var _m$pinned_at, _m$updated_at;
555
893
 
556
- return _objectSpread$6(_objectSpread$6({}, m), {}, {
894
+ return _objectSpread$7(_objectSpread$7({}, m), {}, {
557
895
  created_at: m.created_at.toISOString(),
558
896
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
559
897
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
@@ -564,8 +902,8 @@ var ChannelState = /*#__PURE__*/function () {
564
902
  var updatedMessages = set.messages.filter(function (msg) {
565
903
  return msg.quoted_message_id === message.id;
566
904
  }).map(parseMessage).map(function (msg) {
567
- return _objectSpread$6(_objectSpread$6({}, msg), {}, {
568
- quoted_message: _objectSpread$6(_objectSpread$6({}, message), {}, {
905
+ return _objectSpread$7(_objectSpread$7({}, msg), {}, {
906
+ quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
569
907
  attachments: []
570
908
  })
571
909
  });
@@ -642,70 +980,13 @@ var ChannelState = /*#__PURE__*/function () {
642
980
  * @param message
643
981
  * @param {boolean} timestampChanged Whether updating a message with changed created_at value.
644
982
  * @param {string} sortBy field name to use to sort the messages by
645
- * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
646
- */
647
- function _addToMessageList(messages, message) {
648
- var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
649
- var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
650
- var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
651
- var addMessageToList = addIfDoesNotExist || timestampChanged;
652
- var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
653
- // slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
654
-
655
- if (timestampChanged) {
656
- messageArr = messageArr.filter(function (msg) {
657
- return !(msg.id && message.id === msg.id);
658
- });
659
- } // Get array length after filtering
660
-
661
-
662
- var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
663
-
664
- if (messageArrayLength === 0 && addMessageToList) {
665
- return messageArr.concat(message);
666
- } else if (messageArrayLength === 0) {
667
- return _toConsumableArray(messageArr);
668
- }
669
-
670
- var messageTime = message[sortBy].getTime();
671
- var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
672
-
673
- if (messageIsNewest && addMessageToList) {
674
- return messageArr.concat(message);
675
- } else if (messageIsNewest) {
676
- return _toConsumableArray(messageArr);
677
- } // find the closest index to push the new message
678
-
679
-
680
- var left = 0;
681
- var middle = 0;
682
- var right = messageArrayLength - 1;
683
-
684
- while (left <= right) {
685
- middle = Math.floor((right + left) / 2);
686
- if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
687
- } // message already exists and not filtered due to timestampChanged, update and return
688
-
689
-
690
- if (!timestampChanged && message.id) {
691
- if (messageArr[left] && message.id === messageArr[left].id) {
692
- messageArr[left] = message;
693
- return _toConsumableArray(messageArr);
694
- }
695
-
696
- if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
697
- messageArr[left - 1] = message;
698
- return _toConsumableArray(messageArr);
699
- }
700
- } // Do not add updated or deleted messages to the list if they do not already exist
701
- // or have a timestamp change.
702
-
703
-
704
- if (addMessageToList) {
705
- messageArr.splice(left, 0, message);
706
- }
707
-
708
- return _toConsumableArray(messageArr);
983
+ * @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
984
+ */
985
+ function _addToMessageList(messages, message) {
986
+ var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
987
+ var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
988
+ var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
989
+ return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
709
990
  }
710
991
  /**
711
992
  * removeMessage - Description
@@ -1077,268 +1358,18 @@ var ChannelState = /*#__PURE__*/function () {
1077
1358
  }
1078
1359
  }]);
1079
1360
 
1080
- return ChannelState;
1081
- }();
1082
-
1083
- function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1084
-
1085
- function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1086
-
1087
- function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1088
-
1089
- /**
1090
- * logChatPromiseExecution - utility function for logging the execution of a promise..
1091
- * use this when you want to run the promise and handle errors by logging a warning
1092
- *
1093
- * @param {Promise<T>} promise The promise you want to run and log
1094
- * @param {string} name A descriptive name of what the promise does for log output
1095
- *
1096
- */
1097
- function logChatPromiseExecution(promise, name) {
1098
- promise.then().catch(function (error) {
1099
- console.warn("failed to do ".concat(name, ", ran into error: "), error);
1100
- });
1101
- }
1102
- var sleep = function sleep(m) {
1103
- return new Promise(function (r) {
1104
- return setTimeout(r, m);
1105
- });
1106
- };
1107
- function isFunction(value) {
1108
- return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
1109
- }
1110
- var chatCodes = {
1111
- TOKEN_EXPIRED: 40,
1112
- WS_CLOSED_SUCCESS: 1000
1113
- };
1114
-
1115
- function isReadableStream(obj) {
1116
- return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
1117
- }
1118
-
1119
- function isBuffer(obj) {
1120
- return obj != null && obj.constructor != null && // @ts-expect-error
1121
- typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
1122
- obj.constructor.isBuffer(obj);
1123
- }
1124
-
1125
- function isFileWebAPI(uri) {
1126
- return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
1127
- }
1128
-
1129
- function isOwnUser(user) {
1130
- return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
1131
- }
1132
-
1133
- function isBlobWebAPI(uri) {
1134
- return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
1135
- }
1136
-
1137
- function isOwnUserBaseProperty(property) {
1138
- var ownUserBaseProperties = {
1139
- channel_mutes: true,
1140
- devices: true,
1141
- mutes: true,
1142
- total_unread_count: true,
1143
- unread_channels: true,
1144
- unread_count: true,
1145
- invisible: true,
1146
- roles: true
1147
- };
1148
- return ownUserBaseProperties[property];
1149
- }
1150
- function addFileToFormData(uri, name, contentType) {
1151
- var data = new FormData();
1152
-
1153
- if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
1154
- if (name) data.append('file', uri, name);else data.append('file', uri);
1155
- } else {
1156
- data.append('file', {
1157
- uri: uri,
1158
- name: name || uri.split('/').reverse()[0],
1159
- contentType: contentType || undefined,
1160
- type: contentType || undefined
1161
- });
1162
- }
1163
-
1164
- return data;
1165
- }
1166
- function normalizeQuerySort(sort) {
1167
- var sortFields = [];
1168
- var sortArr = Array.isArray(sort) ? sort : [sort];
1169
-
1170
- var _iterator = _createForOfIteratorHelper$3(sortArr),
1171
- _step;
1172
-
1173
- try {
1174
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1175
- var item = _step.value;
1176
- var entries = Object.entries(item);
1177
-
1178
- if (entries.length > 1) {
1179
- console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
1180
- }
1181
-
1182
- for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
1183
- var _entries$_i = _slicedToArray(_entries[_i], 2),
1184
- field = _entries$_i[0],
1185
- direction = _entries$_i[1];
1186
-
1187
- sortFields.push({
1188
- field: field,
1189
- direction: direction
1190
- });
1191
- }
1192
- }
1193
- } catch (err) {
1194
- _iterator.e(err);
1195
- } finally {
1196
- _iterator.f();
1197
- }
1198
-
1199
- return sortFields;
1200
- }
1201
- /**
1202
- * retryInterval - A retry interval which increases acc to number of failures
1203
- *
1204
- * @return {number} Duration to wait in milliseconds
1205
- */
1206
-
1207
- function retryInterval(numberOfFailures) {
1208
- // try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
1209
- var max = Math.min(500 + numberOfFailures * 2000, 25000);
1210
- var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
1211
- return Math.floor(Math.random() * (max - min) + min);
1212
- }
1213
- function randomId() {
1214
- return generateUUIDv4();
1215
- }
1216
-
1217
- function hex(bytes) {
1218
- var s = '';
1219
-
1220
- for (var i = 0; i < bytes.length; i++) {
1221
- s += bytes[i].toString(16).padStart(2, '0');
1222
- }
1223
-
1224
- return s;
1225
- } // https://tools.ietf.org/html/rfc4122
1226
-
1227
-
1228
- function generateUUIDv4() {
1229
- var bytes = getRandomBytes(16);
1230
- bytes[6] = bytes[6] & 0x0f | 0x40; // version
1231
-
1232
- bytes[8] = bytes[8] & 0xbf | 0x80; // variant
1233
-
1234
- return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
1235
- }
1236
-
1237
- function getRandomValuesWithMathRandom(bytes) {
1238
- var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
1239
-
1240
- for (var i = 0; i < bytes.length; i++) {
1241
- bytes[i] = Math.random() * max;
1242
- }
1243
- }
1244
-
1245
- var getRandomValues = function () {
1246
- var _crypto;
1247
-
1248
- if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
1249
- return crypto.getRandomValues.bind(crypto);
1250
- } else if (typeof msCrypto !== 'undefined') {
1251
- return msCrypto.getRandomValues.bind(msCrypto);
1252
- } else {
1253
- return getRandomValuesWithMathRandom;
1254
- }
1255
- }();
1256
-
1257
- function getRandomBytes(length) {
1258
- var bytes = new Uint8Array(length);
1259
- getRandomValues(bytes);
1260
- return bytes;
1261
- }
1262
-
1263
- function convertErrorToJson(err) {
1264
- var jsonObj = {};
1265
- if (!err) return jsonObj;
1266
-
1267
- try {
1268
- Object.getOwnPropertyNames(err).forEach(function (key) {
1269
- jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
1270
- });
1271
- } catch (_) {
1272
- return {
1273
- error: 'failed to serialize the error'
1274
- };
1275
- }
1276
-
1277
- return jsonObj;
1278
- }
1279
- /**
1280
- * isOnline safely return the navigator.online value for browser env
1281
- * if navigator is not in global object, it always return true
1282
- */
1283
-
1284
- function isOnline() {
1285
- var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
1286
-
1287
- if (!nav) {
1288
- console.warn('isOnline failed to access window.navigator and assume browser is online');
1289
- return true;
1290
- } // RN navigator has undefined for onLine
1291
-
1292
-
1293
- if (typeof nav.onLine !== 'boolean') {
1294
- return true;
1295
- }
1296
-
1297
- return nav.onLine;
1298
- }
1299
- /**
1300
- * listenForConnectionChanges - Adds an event listener fired on browser going online or offline
1301
- */
1302
-
1303
- function addConnectionEventListeners(cb) {
1304
- if (typeof window !== 'undefined' && window.addEventListener) {
1305
- window.addEventListener('offline', cb);
1306
- window.addEventListener('online', cb);
1307
- }
1308
- }
1309
- function removeConnectionEventListeners(cb) {
1310
- if (typeof window !== 'undefined' && window.removeEventListener) {
1311
- window.removeEventListener('offline', cb);
1312
- window.removeEventListener('online', cb);
1313
- }
1314
- }
1315
- var axiosParamsSerializer = function axiosParamsSerializer(params) {
1316
- var newParams = [];
1317
-
1318
- for (var k in params) {
1319
- // Stream backend doesn't treat "undefined" value same as value not being present.
1320
- // So, we need to skip the undefined values.
1321
- if (params[k] === undefined) continue;
1322
-
1323
- if (Array.isArray(params[k]) || _typeof(params[k]) === 'object') {
1324
- newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
1325
- } else {
1326
- newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
1327
- }
1328
- }
1329
-
1330
- return newParams.join('&');
1331
- };
1361
+ return ChannelState;
1362
+ }();
1332
1363
 
1333
- function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1364
+ function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1334
1365
 
1335
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
1366
+ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1336
1367
 
1337
- function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1368
+ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1338
1369
 
1339
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1370
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1340
1371
 
1341
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1372
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1342
1373
 
1343
1374
  /**
1344
1375
  * Channel - The Channel class manages it's own state.
@@ -1411,7 +1442,7 @@ var Channel = /*#__PURE__*/function () {
1411
1442
  while (1) {
1412
1443
  switch (_context.prev = _context.next) {
1413
1444
  case 0:
1414
- defaultOptions = _objectSpread$5(_objectSpread$5({}, options), {}, {
1445
+ defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
1415
1446
  watch: false,
1416
1447
  state: false,
1417
1448
  presence: false
@@ -1483,7 +1514,7 @@ var Channel = /*#__PURE__*/function () {
1483
1514
 
1484
1515
  this.data = data; // this._data is used for the requests...
1485
1516
 
1486
- this._data = _objectSpread$5({}, data);
1517
+ this._data = _objectSpread$6({}, data);
1487
1518
  this.cid = "".concat(type, ":").concat(id);
1488
1519
  this.listeners = {}; // perhaps the state variable should be private
1489
1520
 
@@ -1545,7 +1576,7 @@ var Channel = /*#__PURE__*/function () {
1545
1576
  switch (_context2.prev = _context2.next) {
1546
1577
  case 0:
1547
1578
  _context2.next = 2;
1548
- return this.getClient().post(this._channelURL() + '/message', _objectSpread$5({
1579
+ return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
1549
1580
  message: message
1550
1581
  }, options));
1551
1582
 
@@ -1661,7 +1692,7 @@ var Channel = /*#__PURE__*/function () {
1661
1692
 
1662
1693
  case 3:
1663
1694
  // Return a list of channels
1664
- payload = _objectSpread$5(_objectSpread$5({
1695
+ payload = _objectSpread$6(_objectSpread$6({
1665
1696
  filter_conditions: {
1666
1697
  cid: this.cid
1667
1698
  }
@@ -1758,7 +1789,7 @@ var Channel = /*#__PURE__*/function () {
1758
1789
 
1759
1790
  _context5.next = 6;
1760
1791
  return this.getClient().get(this.getClient().baseURL + '/members', {
1761
- payload: _objectSpread$5({
1792
+ payload: _objectSpread$6({
1762
1793
  type: type,
1763
1794
  id: id,
1764
1795
  members: members,
@@ -1819,7 +1850,7 @@ var Channel = /*#__PURE__*/function () {
1819
1850
 
1820
1851
  case 4:
1821
1852
  _context6.next = 6;
1822
- return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$5({
1853
+ return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
1823
1854
  reaction: reaction
1824
1855
  }, options));
1825
1856
 
@@ -1900,7 +1931,7 @@ var Channel = /*#__PURE__*/function () {
1900
1931
  delete channelData[key];
1901
1932
  });
1902
1933
  _context7.next = 7;
1903
- return this._update(_objectSpread$5({
1934
+ return this._update(_objectSpread$6({
1904
1935
  message: updateMessage,
1905
1936
  data: channelData
1906
1937
  }, options));
@@ -1934,7 +1965,9 @@ var Channel = /*#__PURE__*/function () {
1934
1965
  key: "updatePartial",
1935
1966
  value: function () {
1936
1967
  var _updatePartial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(update) {
1937
- var data;
1968
+ var _this$data2, _this$data3;
1969
+
1970
+ var data, areCapabilitiesChanged;
1938
1971
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
1939
1972
  while (1) {
1940
1973
  switch (_context8.prev = _context8.next) {
@@ -1944,10 +1977,20 @@ var Channel = /*#__PURE__*/function () {
1944
1977
 
1945
1978
  case 2:
1946
1979
  data = _context8.sent;
1947
- this.data = data.channel;
1980
+ areCapabilitiesChanged = _toConsumableArray(data.channel.own_capabilities || []).sort().join() !== _toConsumableArray(Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) ? (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.own_capabilities : []).sort().join();
1981
+ this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
1982
+
1983
+ if (areCapabilitiesChanged) {
1984
+ this.getClient().dispatchEvent({
1985
+ type: 'capabilities.changed',
1986
+ cid: this.cid,
1987
+ own_capabilities: data.channel.own_capabilities
1988
+ });
1989
+ }
1990
+
1948
1991
  return _context8.abrupt("return", data);
1949
1992
 
1950
- case 5:
1993
+ case 7:
1951
1994
  case "end":
1952
1995
  return _context8.stop();
1953
1996
  }
@@ -2060,7 +2103,7 @@ var Channel = /*#__PURE__*/function () {
2060
2103
  case 0:
2061
2104
  options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
2062
2105
  _context11.next = 3;
2063
- return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
2106
+ return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
2064
2107
 
2065
2108
  case 3:
2066
2109
  return _context11.abrupt("return", _context11.sent);
@@ -2136,7 +2179,7 @@ var Channel = /*#__PURE__*/function () {
2136
2179
  case 0:
2137
2180
  options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
2138
2181
  _context13.next = 3;
2139
- return this._update(_objectSpread$5({
2182
+ return this._update(_objectSpread$6({
2140
2183
  accept_invite: true
2141
2184
  }, options));
2142
2185
 
@@ -2177,7 +2220,7 @@ var Channel = /*#__PURE__*/function () {
2177
2220
  case 0:
2178
2221
  options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
2179
2222
  _context14.next = 3;
2180
- return this._update(_objectSpread$5({
2223
+ return this._update(_objectSpread$6({
2181
2224
  reject_invite: true
2182
2225
  }, options));
2183
2226
 
@@ -2219,7 +2262,7 @@ var Channel = /*#__PURE__*/function () {
2219
2262
  case 0:
2220
2263
  options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
2221
2264
  _context15.next = 3;
2222
- return this._update(_objectSpread$5({
2265
+ return this._update(_objectSpread$6({
2223
2266
  add_members: members,
2224
2267
  message: message
2225
2268
  }, options));
@@ -2262,7 +2305,7 @@ var Channel = /*#__PURE__*/function () {
2262
2305
  case 0:
2263
2306
  options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
2264
2307
  _context16.next = 3;
2265
- return this._update(_objectSpread$5({
2308
+ return this._update(_objectSpread$6({
2266
2309
  add_moderators: members,
2267
2310
  message: message
2268
2311
  }, options));
@@ -2305,7 +2348,7 @@ var Channel = /*#__PURE__*/function () {
2305
2348
  case 0:
2306
2349
  options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
2307
2350
  _context17.next = 3;
2308
- return this._update(_objectSpread$5({
2351
+ return this._update(_objectSpread$6({
2309
2352
  assign_roles: roles,
2310
2353
  message: message
2311
2354
  }, options));
@@ -2348,7 +2391,7 @@ var Channel = /*#__PURE__*/function () {
2348
2391
  case 0:
2349
2392
  options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
2350
2393
  _context18.next = 3;
2351
- return this._update(_objectSpread$5({
2394
+ return this._update(_objectSpread$6({
2352
2395
  invites: members,
2353
2396
  message: message
2354
2397
  }, options));
@@ -2391,7 +2434,7 @@ var Channel = /*#__PURE__*/function () {
2391
2434
  case 0:
2392
2435
  options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
2393
2436
  _context19.next = 3;
2394
- return this._update(_objectSpread$5({
2437
+ return this._update(_objectSpread$6({
2395
2438
  remove_members: members,
2396
2439
  message: message
2397
2440
  }, options));
@@ -2434,7 +2477,7 @@ var Channel = /*#__PURE__*/function () {
2434
2477
  case 0:
2435
2478
  options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
2436
2479
  _context20.next = 3;
2437
- return this._update(_objectSpread$5({
2480
+ return this._update(_objectSpread$6({
2438
2481
  demote_moderators: members,
2439
2482
  message: message
2440
2483
  }, options));
@@ -2519,7 +2562,7 @@ var Channel = /*#__PURE__*/function () {
2519
2562
  case 0:
2520
2563
  opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
2521
2564
  _context22.next = 3;
2522
- return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$5({
2565
+ return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
2523
2566
  channel_cid: this.cid
2524
2567
  }, opts));
2525
2568
 
@@ -2561,7 +2604,7 @@ var Channel = /*#__PURE__*/function () {
2561
2604
  case 0:
2562
2605
  opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
2563
2606
  _context23.next = 3;
2564
- return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$5({
2607
+ return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
2565
2608
  channel_cid: this.cid
2566
2609
  }, opts));
2567
2610
 
@@ -2620,7 +2663,7 @@ var Channel = /*#__PURE__*/function () {
2620
2663
  }, {
2621
2664
  key: "keystroke",
2622
2665
  value: function () {
2623
- var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id) {
2666
+ var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id, options) {
2624
2667
  var _this$getConfig;
2625
2668
 
2626
2669
  var now, diff;
@@ -2648,10 +2691,10 @@ var Channel = /*#__PURE__*/function () {
2648
2691
 
2649
2692
  this.lastTypingEvent = new Date();
2650
2693
  _context24.next = 10;
2651
- return this.sendEvent({
2694
+ return this.sendEvent(_objectSpread$6({
2652
2695
  type: 'typing.start',
2653
2696
  parent_id: parent_id
2654
- });
2697
+ }, options || {}));
2655
2698
 
2656
2699
  case 10:
2657
2700
  case "end":
@@ -2661,7 +2704,7 @@ var Channel = /*#__PURE__*/function () {
2661
2704
  }, _callee24, this);
2662
2705
  }));
2663
2706
 
2664
- function keystroke(_x25) {
2707
+ function keystroke(_x25, _x26) {
2665
2708
  return _keystroke.apply(this, arguments);
2666
2709
  }
2667
2710
 
@@ -2676,7 +2719,7 @@ var Channel = /*#__PURE__*/function () {
2676
2719
  }, {
2677
2720
  key: "stopTyping",
2678
2721
  value: function () {
2679
- var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id) {
2722
+ var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id, options) {
2680
2723
  var _this$getConfig2;
2681
2724
 
2682
2725
  return _regeneratorRuntime.wrap(function _callee25$(_context25) {
@@ -2694,10 +2737,10 @@ var Channel = /*#__PURE__*/function () {
2694
2737
  this.lastTypingEvent = null;
2695
2738
  this.isTyping = false;
2696
2739
  _context25.next = 6;
2697
- return this.sendEvent({
2740
+ return this.sendEvent(_objectSpread$6({
2698
2741
  type: 'typing.stop',
2699
2742
  parent_id: parent_id
2700
- });
2743
+ }, options || {}));
2701
2744
 
2702
2745
  case 6:
2703
2746
  case "end":
@@ -2707,7 +2750,7 @@ var Channel = /*#__PURE__*/function () {
2707
2750
  }, _callee25, this);
2708
2751
  }));
2709
2752
 
2710
- function stopTyping(_x26) {
2753
+ function stopTyping(_x27, _x28) {
2711
2754
  return _stopTyping.apply(this, arguments);
2712
2755
  }
2713
2756
 
@@ -2761,7 +2804,7 @@ var Channel = /*#__PURE__*/function () {
2761
2804
 
2762
2805
  this._checkInitialized();
2763
2806
 
2764
- if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
2807
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2765
2808
  _context26.next = 4;
2766
2809
  break;
2767
2810
  }
@@ -2770,7 +2813,7 @@ var Channel = /*#__PURE__*/function () {
2770
2813
 
2771
2814
  case 4:
2772
2815
  _context26.next = 6;
2773
- return this.getClient().post(this._channelURL() + '/read', _objectSpread$5({}, data));
2816
+ return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
2774
2817
 
2775
2818
  case 6:
2776
2819
  return _context26.abrupt("return", _context26.sent);
@@ -2808,7 +2851,7 @@ var Channel = /*#__PURE__*/function () {
2808
2851
  case 0:
2809
2852
  this._checkInitialized();
2810
2853
 
2811
- if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
2854
+ if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2812
2855
  _context27.next = 3;
2813
2856
  break;
2814
2857
  }
@@ -2817,7 +2860,7 @@ var Channel = /*#__PURE__*/function () {
2817
2860
 
2818
2861
  case 3:
2819
2862
  _context27.next = 5;
2820
- return this.getClient().post(this._channelURL() + '/unread', _objectSpread$5({}, data));
2863
+ return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
2821
2864
 
2822
2865
  case 5:
2823
2866
  return _context27.abrupt("return", _context27.sent);
@@ -2830,7 +2873,7 @@ var Channel = /*#__PURE__*/function () {
2830
2873
  }, _callee27, this);
2831
2874
  }));
2832
2875
 
2833
- function markUnread(_x27) {
2876
+ function markUnread(_x29) {
2834
2877
  return _markUnread.apply(this, arguments);
2835
2878
  }
2836
2879
 
@@ -2885,7 +2928,7 @@ var Channel = /*#__PURE__*/function () {
2885
2928
  defaultOptions.watch = false;
2886
2929
  }
2887
2930
 
2888
- combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
2931
+ combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
2889
2932
  _context28.next = 7;
2890
2933
  return this.query(combined, 'latest');
2891
2934
 
@@ -2909,7 +2952,7 @@ var Channel = /*#__PURE__*/function () {
2909
2952
  }, _callee28, this);
2910
2953
  }));
2911
2954
 
2912
- function watch(_x28) {
2955
+ function watch(_x30) {
2913
2956
  return _watch.apply(this, arguments);
2914
2957
  }
2915
2958
 
@@ -2976,7 +3019,7 @@ var Channel = /*#__PURE__*/function () {
2976
3019
  switch (_context30.prev = _context30.next) {
2977
3020
  case 0:
2978
3021
  _context30.next = 2;
2979
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$5({}, options));
3022
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
2980
3023
 
2981
3024
  case 2:
2982
3025
  data = _context30.sent;
@@ -2996,7 +3039,7 @@ var Channel = /*#__PURE__*/function () {
2996
3039
  }, _callee30, this);
2997
3040
  }));
2998
3041
 
2999
- function getReplies(_x29, _x30) {
3042
+ function getReplies(_x31, _x32) {
3000
3043
  return _getReplies.apply(this, arguments);
3001
3044
  }
3002
3045
 
@@ -3024,7 +3067,7 @@ var Channel = /*#__PURE__*/function () {
3024
3067
  sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
3025
3068
  _context31.next = 3;
3026
3069
  return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
3027
- payload: _objectSpread$5(_objectSpread$5({}, options), {}, {
3070
+ payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
3028
3071
  sort: normalizeQuerySort(sort)
3029
3072
  })
3030
3073
  });
@@ -3040,7 +3083,7 @@ var Channel = /*#__PURE__*/function () {
3040
3083
  }, _callee31, this);
3041
3084
  }));
3042
3085
 
3043
- function getPinnedMessages(_x31) {
3086
+ function getPinnedMessages(_x33) {
3044
3087
  return _getPinnedMessages.apply(this, arguments);
3045
3088
  }
3046
3089
 
@@ -3058,7 +3101,7 @@ var Channel = /*#__PURE__*/function () {
3058
3101
  }, {
3059
3102
  key: "getReactions",
3060
3103
  value: function getReactions(message_id, options) {
3061
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$5({}, options));
3104
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
3062
3105
  }
3063
3106
  /**
3064
3107
  * getMessagesById - Retrieves a list of messages by ID
@@ -3093,7 +3136,7 @@ var Channel = /*#__PURE__*/function () {
3093
3136
  }, {
3094
3137
  key: "_countMessageAsUnread",
3095
3138
  value: function _countMessageAsUnread(message) {
3096
- var _message$user, _message$user2, _this$data2, _this$data3;
3139
+ var _message$user, _message$user2, _this$data4, _this$data5;
3097
3140
 
3098
3141
  if (message.shadowed) return false;
3099
3142
  if (message.silent) return false;
@@ -3102,7 +3145,7 @@ var Channel = /*#__PURE__*/function () {
3102
3145
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3103
3146
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3104
3147
 
3105
- if (Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) && !((_this$data3 = this.data) !== null && _this$data3 !== void 0 && _this$data3.own_capabilities.includes('read-events'))) return false;
3148
+ if (Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) && !((_this$data5 = this.data) !== null && _this$data5 !== void 0 && _this$data5.own_capabilities.includes('read-events'))) return false;
3106
3149
  if (this.muteStatus().muted) return false;
3107
3150
  return true;
3108
3151
  }
@@ -3177,7 +3220,7 @@ var Channel = /*#__PURE__*/function () {
3177
3220
  */
3178
3221
  function () {
3179
3222
  var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(options) {
3180
- var _this$data4, _this$data5;
3223
+ var _this$data6, _this$data7;
3181
3224
 
3182
3225
  var messageSetToAddToIfDoesNotExist,
3183
3226
  queryURL,
@@ -3205,7 +3248,7 @@ var Channel = /*#__PURE__*/function () {
3205
3248
  }
3206
3249
 
3207
3250
  _context32.next = 7;
3208
- return this.getClient().post(queryURL + '/query', _objectSpread$5({
3251
+ return this.getClient().post(queryURL + '/query', _objectSpread$6({
3209
3252
  data: this._data,
3210
3253
  state: true
3211
3254
  }, options));
@@ -3240,7 +3283,7 @@ var Channel = /*#__PURE__*/function () {
3240
3283
 
3241
3284
 
3242
3285
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3243
- areCapabilitiesChanged = _toConsumableArray(state.channel.own_capabilities || []).sort().join() !== _toConsumableArray(Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) ? (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.own_capabilities : []).sort().join();
3286
+ areCapabilitiesChanged = _toConsumableArray(state.channel.own_capabilities || []).sort().join() !== _toConsumableArray(Array.isArray((_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.own_capabilities) ? (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.own_capabilities : []).sort().join();
3244
3287
  this.data = state.channel;
3245
3288
  this.offlineMode = false;
3246
3289
 
@@ -3269,7 +3312,7 @@ var Channel = /*#__PURE__*/function () {
3269
3312
  }, _callee32, this);
3270
3313
  }));
3271
3314
 
3272
- function query(_x32) {
3315
+ function query(_x34) {
3273
3316
  return _query.apply(this, arguments);
3274
3317
  }
3275
3318
 
@@ -3294,7 +3337,7 @@ var Channel = /*#__PURE__*/function () {
3294
3337
  this._checkInitialized();
3295
3338
 
3296
3339
  _context33.next = 3;
3297
- return this.getClient().banUser(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3340
+ return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3298
3341
  type: this.type,
3299
3342
  id: this.id
3300
3343
  }));
@@ -3310,7 +3353,7 @@ var Channel = /*#__PURE__*/function () {
3310
3353
  }, _callee33, this);
3311
3354
  }));
3312
3355
 
3313
- function banUser(_x33, _x34) {
3356
+ function banUser(_x35, _x36) {
3314
3357
  return _banUser.apply(this, arguments);
3315
3358
  }
3316
3359
 
@@ -3441,7 +3484,7 @@ var Channel = /*#__PURE__*/function () {
3441
3484
  }, _callee36, this);
3442
3485
  }));
3443
3486
 
3444
- function unbanUser(_x35) {
3487
+ function unbanUser(_x37) {
3445
3488
  return _unbanUser.apply(this, arguments);
3446
3489
  }
3447
3490
 
@@ -3466,7 +3509,7 @@ var Channel = /*#__PURE__*/function () {
3466
3509
  this._checkInitialized();
3467
3510
 
3468
3511
  _context37.next = 3;
3469
- return this.getClient().shadowBan(targetUserID, _objectSpread$5(_objectSpread$5({}, options), {}, {
3512
+ return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
3470
3513
  type: this.type,
3471
3514
  id: this.id
3472
3515
  }));
@@ -3482,7 +3525,7 @@ var Channel = /*#__PURE__*/function () {
3482
3525
  }, _callee37, this);
3483
3526
  }));
3484
3527
 
3485
- function shadowBan(_x36, _x37) {
3528
+ function shadowBan(_x38, _x39) {
3486
3529
  return _shadowBan.apply(this, arguments);
3487
3530
  }
3488
3531
 
@@ -3522,7 +3565,7 @@ var Channel = /*#__PURE__*/function () {
3522
3565
  }, _callee38, this);
3523
3566
  }));
3524
3567
 
3525
- function removeShadowBan(_x38) {
3568
+ function removeShadowBan(_x40) {
3526
3569
  return _removeShadowBan.apply(this, arguments);
3527
3570
  }
3528
3571
 
@@ -3557,7 +3600,7 @@ var Channel = /*#__PURE__*/function () {
3557
3600
  }, _callee39, this);
3558
3601
  }));
3559
3602
 
3560
- function createCall(_x39) {
3603
+ function createCall(_x41) {
3561
3604
  return _createCall.apply(this, arguments);
3562
3605
  }
3563
3606
 
@@ -3852,7 +3895,7 @@ var Channel = /*#__PURE__*/function () {
3852
3895
  });
3853
3896
  }
3854
3897
 
3855
- channel.data = _objectSpread$5(_objectSpread$5({}, event.channel), {}, {
3898
+ channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
3856
3899
  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,
3857
3900
  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
3858
3901
  });
@@ -3883,7 +3926,7 @@ var Channel = /*#__PURE__*/function () {
3883
3926
  break;
3884
3927
 
3885
3928
  case 'channel.hidden':
3886
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3929
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3887
3930
  hidden: true
3888
3931
  });
3889
3932
 
@@ -3894,26 +3937,26 @@ var Channel = /*#__PURE__*/function () {
3894
3937
  break;
3895
3938
 
3896
3939
  case 'channel.visible':
3897
- channel.data = _objectSpread$5(_objectSpread$5({}, channel.data), {}, {
3940
+ channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
3898
3941
  hidden: false
3899
3942
  });
3900
3943
  break;
3901
3944
 
3902
3945
  case 'user.banned':
3903
3946
  if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
3904
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3947
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3905
3948
  shadow_banned: !!event.shadow,
3906
3949
  banned: !event.shadow,
3907
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3950
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
3908
3951
  });
3909
3952
  break;
3910
3953
 
3911
3954
  case 'user.unbanned':
3912
3955
  if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
3913
- channelState.members[event.user.id] = _objectSpread$5(_objectSpread$5({}, channelState.members[event.user.id] || {}), {}, {
3956
+ channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
3914
3957
  shadow_banned: false,
3915
3958
  banned: false,
3916
- user: _objectSpread$5(_objectSpread$5({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3959
+ user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
3917
3960
  });
3918
3961
  break;
3919
3962
  } // any event can send over the online count
@@ -3943,7 +3986,7 @@ var Channel = /*#__PURE__*/function () {
3943
3986
 
3944
3987
 
3945
3988
  if (state.members) {
3946
- var _iterator = _createForOfIteratorHelper$2(state.members),
3989
+ var _iterator = _createForOfIteratorHelper$3(state.members),
3947
3990
  _step;
3948
3991
 
3949
3992
  try {
@@ -3987,7 +4030,7 @@ var Channel = /*#__PURE__*/function () {
3987
4030
 
3988
4031
 
3989
4032
  if (state.watchers) {
3990
- var _iterator2 = _createForOfIteratorHelper$2(state.watchers),
4033
+ var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
3991
4034
  _step2;
3992
4035
 
3993
4036
  try {
@@ -4023,7 +4066,7 @@ var Channel = /*#__PURE__*/function () {
4023
4066
 
4024
4067
 
4025
4068
  if (state.read) {
4026
- var _iterator3 = _createForOfIteratorHelper$2(state.read),
4069
+ var _iterator3 = _createForOfIteratorHelper$3(state.read),
4027
4070
  _step3;
4028
4071
 
4029
4072
  try {
@@ -4092,11 +4135,11 @@ var Channel = /*#__PURE__*/function () {
4092
4135
  return Channel;
4093
4136
  }();
4094
4137
 
4095
- 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; } } }; }
4138
+ 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; } } }; }
4096
4139
 
4097
- 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); }
4140
+ 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); }
4098
4141
 
4099
- 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; }
4142
+ 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; }
4100
4143
 
4101
4144
  /**
4102
4145
  * ClientState - A container class for the client state.
@@ -4119,7 +4162,7 @@ var ClientState = /*#__PURE__*/function () {
4119
4162
  _createClass(ClientState, [{
4120
4163
  key: "updateUsers",
4121
4164
  value: function updateUsers(users) {
4122
- var _iterator = _createForOfIteratorHelper$1(users),
4165
+ var _iterator = _createForOfIteratorHelper$2(users),
4123
4166
  _step;
4124
4167
 
4125
4168
  try {
@@ -4167,9 +4210,9 @@ var ClientState = /*#__PURE__*/function () {
4167
4210
  return ClientState;
4168
4211
  }();
4169
4212
 
4170
- 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; }
4213
+ 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; }
4171
4214
 
4172
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4215
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4173
4216
  var InsightMetrics = function InsightMetrics() {
4174
4217
  _classCallCheck(this, InsightMetrics);
4175
4218
 
@@ -4248,7 +4291,7 @@ var postInsights = /*#__PURE__*/function () {
4248
4291
  };
4249
4292
  }();
4250
4293
  function buildWsFatalInsight(connection, event) {
4251
- return _objectSpread$4(_objectSpread$4({}, event), buildWsBaseInsight(connection));
4294
+ return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
4252
4295
  }
4253
4296
 
4254
4297
  function buildWsBaseInsight(connection) {
@@ -4281,9 +4324,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
4281
4324
  return buildWsBaseInsight(connection);
4282
4325
  }
4283
4326
 
4284
- 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; }
4327
+ 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; }
4285
4328
 
4286
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4329
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4287
4330
 
4288
4331
  // Type guards to check WebSocket error type
4289
4332
  var isCloseEvent = function isCloseEvent(res) {
@@ -4647,7 +4690,7 @@ var StableWSConnection = /*#__PURE__*/function () {
4647
4690
  value: function _log(msg) {
4648
4691
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4649
4692
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
4650
- this.client.logger(level, 'connection:' + msg, _objectSpread$3({
4693
+ this.client.logger(level, 'connection:' + msg, _objectSpread$4({
4651
4694
  tags: ['connection']
4652
4695
  }, extra));
4653
4696
  }
@@ -5238,9 +5281,9 @@ var StableWSConnection = /*#__PURE__*/function () {
5238
5281
  return StableWSConnection;
5239
5282
  }();
5240
5283
 
5241
- 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; }
5284
+ 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; }
5242
5285
 
5243
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5286
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5244
5287
 
5245
5288
  /**
5246
5289
  * Creates the JWT token that can be used for a UserSession
@@ -5261,7 +5304,7 @@ function JWTUserToken(apiSecret, userId) {
5261
5304
  throw new TypeError('userId should be a string');
5262
5305
  }
5263
5306
 
5264
- var payload = _objectSpread$2({
5307
+ var payload = _objectSpread$3({
5265
5308
  user_id: userId
5266
5309
  }, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
5267
5310
 
@@ -5671,9 +5714,9 @@ function isErrorResponse(res) {
5671
5714
  return !res.status || res.status < 200 || 300 <= res.status;
5672
5715
  }
5673
5716
 
5674
- 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; }
5717
+ 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; }
5675
5718
 
5676
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5719
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5677
5720
  var ConnectionState;
5678
5721
 
5679
5722
  (function (ConnectionState) {
@@ -5736,7 +5779,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5736
5779
  _context.next = 4;
5737
5780
  return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
5738
5781
  undefined, {
5739
- config: _objectSpread$1(_objectSpread$1({}, config), {}, {
5782
+ config: _objectSpread$2(_objectSpread$2({}, config), {}, {
5740
5783
  cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
5741
5784
  }),
5742
5785
  params: params
@@ -6014,7 +6057,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
6014
6057
  value: function _log(msg) {
6015
6058
  var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6016
6059
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
6017
- this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$1({
6060
+ this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
6018
6061
  tags: ['connection_fallback', 'connection']
6019
6062
  }, extra));
6020
6063
  }
@@ -6061,6 +6104,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
6061
6104
  /**
6062
6105
  * Response Types
6063
6106
  */
6107
+ // TODO: Figure out a way to strongly type set and unset.
6064
6108
  // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
6065
6109
 
6066
6110
  /**
@@ -6132,6 +6176,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
6132
6176
  return ErrorFromResponse;
6133
6177
  }( /*#__PURE__*/_wrapNativeSuper(Error));
6134
6178
 
6179
+ 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; }
6180
+
6181
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6182
+
6183
+ 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; } } }; }
6184
+
6185
+ 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); }
6186
+
6187
+ 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; }
6188
+ var Thread = /*#__PURE__*/function () {
6189
+ function Thread(client, t) {
6190
+ _classCallCheck(this, Thread);
6191
+
6192
+ _defineProperty(this, "id", void 0);
6193
+
6194
+ _defineProperty(this, "latestReplies", []);
6195
+
6196
+ _defineProperty(this, "participants", []);
6197
+
6198
+ _defineProperty(this, "message", void 0);
6199
+
6200
+ _defineProperty(this, "channel", void 0);
6201
+
6202
+ _defineProperty(this, "_channel", void 0);
6203
+
6204
+ _defineProperty(this, "replyCount", 0);
6205
+
6206
+ _defineProperty(this, "_client", void 0);
6207
+
6208
+ _defineProperty(this, "read", {});
6209
+
6210
+ this.id = t.parent_message.id;
6211
+ this.message = formatMessage(t.parent_message);
6212
+ this.latestReplies = t.latest_replies.map(formatMessage);
6213
+ this.participants = t.thread_participants;
6214
+ this.replyCount = t.reply_count;
6215
+ this.channel = t.channel;
6216
+ this._channel = client.channel(t.channel.type, t.channel.id);
6217
+ this._client = client;
6218
+
6219
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6220
+ _step;
6221
+
6222
+ try {
6223
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6224
+ var r = _step.value;
6225
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6226
+ last_read: new Date(r.last_read)
6227
+ });
6228
+ }
6229
+ } catch (err) {
6230
+ _iterator.e(err);
6231
+ } finally {
6232
+ _iterator.f();
6233
+ }
6234
+ }
6235
+
6236
+ _createClass(Thread, [{
6237
+ key: "getClient",
6238
+ value: function getClient() {
6239
+ return this._client;
6240
+ }
6241
+ }, {
6242
+ key: "addReply",
6243
+ value: function addReply(message) {
6244
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6245
+ }
6246
+ }, {
6247
+ key: "updateReply",
6248
+ value: function updateReply(message) {
6249
+ this.latestReplies = this.latestReplies.map(function (m) {
6250
+ if (m.id === message.id) {
6251
+ return formatMessage(message);
6252
+ }
6253
+
6254
+ return m;
6255
+ });
6256
+ }
6257
+ }, {
6258
+ key: "updateMessageOrReplyIfExists",
6259
+ value: function updateMessageOrReplyIfExists(message) {
6260
+ if (!message.parent_id && message.id !== this.message.id) {
6261
+ return;
6262
+ }
6263
+
6264
+ if (message.parent_id && message.parent_id !== this.message.id) {
6265
+ return;
6266
+ }
6267
+
6268
+ if (message.parent_id && message.parent_id === this.message.id) {
6269
+ this.updateReply(message);
6270
+ }
6271
+
6272
+ if (!message.parent_id && message.id === this.message.id) {
6273
+ this.message = formatMessage(message);
6274
+ }
6275
+ }
6276
+ }, {
6277
+ key: "addReaction",
6278
+ value: function addReaction(reaction, message, enforce_unique) {
6279
+ var _this = this;
6280
+
6281
+ if (!message) return;
6282
+ this.latestReplies = this.latestReplies.map(function (m) {
6283
+ if (m.id === message.id) {
6284
+ return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
6285
+ }
6286
+
6287
+ return m;
6288
+ });
6289
+ }
6290
+ }, {
6291
+ key: "removeReaction",
6292
+ value: function removeReaction(reaction, message) {
6293
+ var _this2 = this;
6294
+
6295
+ if (!message) return;
6296
+ this.latestReplies = this.latestReplies.map(function (m) {
6297
+ if (m.id === message.id) {
6298
+ return formatMessage(_this2._channel.state.removeReaction(reaction, message));
6299
+ }
6300
+
6301
+ return m;
6302
+ });
6303
+ }
6304
+ }]);
6305
+
6306
+ return Thread;
6307
+ }();
6308
+
6135
6309
  var _excluded = ["created_at", "updated_at", "last_active", "online"],
6136
6310
  _excluded2 = ["params", "headers"];
6137
6311
 
@@ -10243,10 +10417,197 @@ var StreamChat = /*#__PURE__*/function () {
10243
10417
 
10244
10418
  return getMessage;
10245
10419
  }()
10420
+ /**
10421
+ * queryThreads - returns the list of threads of current user.
10422
+ *
10423
+ * @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
10424
+ * @param {number} options.limit Limits the number of threads to be returned.
10425
+ * @param {boolean} options.watch Subscribes the user to the channels of the threads.
10426
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10427
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10428
+ *
10429
+ * @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
10430
+ */
10431
+
10432
+ }, {
10433
+ key: "queryThreads",
10434
+ value: function () {
10435
+ var _queryThreads = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(options) {
10436
+ var _this5 = this;
10437
+
10438
+ var opts, res;
10439
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
10440
+ while (1) {
10441
+ switch (_context59.prev = _context59.next) {
10442
+ case 0:
10443
+ opts = _objectSpread({
10444
+ limit: 10,
10445
+ participant_limit: 10,
10446
+ reply_limit: 3,
10447
+ watch: true
10448
+ }, options);
10449
+ _context59.next = 3;
10450
+ return this.post(this.baseURL + "/threads", opts);
10451
+
10452
+ case 3:
10453
+ res = _context59.sent;
10454
+ return _context59.abrupt("return", {
10455
+ threads: res.threads.map(function (thread) {
10456
+ return new Thread(_this5, thread);
10457
+ }),
10458
+ next: res.next
10459
+ });
10460
+
10461
+ case 5:
10462
+ case "end":
10463
+ return _context59.stop();
10464
+ }
10465
+ }
10466
+ }, _callee59, this);
10467
+ }));
10468
+
10469
+ function queryThreads(_x78) {
10470
+ return _queryThreads.apply(this, arguments);
10471
+ }
10472
+
10473
+ return queryThreads;
10474
+ }()
10475
+ /**
10476
+ * getThread - returns the thread of a message by its id.
10477
+ *
10478
+ * @param {string} messageId The message id
10479
+ * @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
10480
+ * @param {boolean} options.watch Subscribes the user to the channel of the thread.
10481
+ * @param {number} options.participant_limit Limits the number of participants returned per threads.
10482
+ * @param {number} options.reply_limit Limits the number of replies returned per threads.
10483
+ *
10484
+ * @returns {Thread<StreamChatGenerics>} Returns the thread.
10485
+ */
10486
+
10487
+ }, {
10488
+ key: "getThread",
10489
+ value: function () {
10490
+ var _getThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(messageId) {
10491
+ var options,
10492
+ opts,
10493
+ res,
10494
+ _args60 = arguments;
10495
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
10496
+ while (1) {
10497
+ switch (_context60.prev = _context60.next) {
10498
+ case 0:
10499
+ options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
10500
+
10501
+ if (messageId) {
10502
+ _context60.next = 3;
10503
+ break;
10504
+ }
10505
+
10506
+ throw Error('Please specify the message id when calling partialUpdateThread');
10507
+
10508
+ case 3:
10509
+ opts = _objectSpread({
10510
+ participant_limit: 100,
10511
+ reply_limit: 3,
10512
+ watch: true
10513
+ }, options);
10514
+ _context60.next = 6;
10515
+ return this.get(this.baseURL + "/threads/".concat(messageId), opts);
10516
+
10517
+ case 6:
10518
+ res = _context60.sent;
10519
+ return _context60.abrupt("return", new Thread(this, res.thread));
10520
+
10521
+ case 8:
10522
+ case "end":
10523
+ return _context60.stop();
10524
+ }
10525
+ }
10526
+ }, _callee60, this);
10527
+ }));
10528
+
10529
+ function getThread(_x79) {
10530
+ return _getThread.apply(this, arguments);
10531
+ }
10532
+
10533
+ return getThread;
10534
+ }()
10535
+ /**
10536
+ * partialUpdateThread - updates the given thread
10537
+ *
10538
+ * @param {string} messageId The id of the thread message which needs to be updated.
10539
+ * @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
10540
+ *
10541
+ * @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
10542
+ */
10543
+
10544
+ }, {
10545
+ key: "partialUpdateThread",
10546
+ value: function () {
10547
+ var _partialUpdateThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(messageId, partialThreadObject) {
10548
+ var reservedThreadFields, _key5;
10549
+
10550
+ return _regeneratorRuntime.wrap(function _callee61$(_context61) {
10551
+ while (1) {
10552
+ switch (_context61.prev = _context61.next) {
10553
+ case 0:
10554
+ if (messageId) {
10555
+ _context61.next = 2;
10556
+ break;
10557
+ }
10558
+
10559
+ throw Error('Please specify the message id when calling partialUpdateThread');
10560
+
10561
+ case 2:
10562
+ // check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
10563
+ // Throw error if any of the reserved field is found.
10564
+ reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
10565
+ _context61.t0 = _regeneratorRuntime.keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
10566
+
10567
+ case 4:
10568
+ if ((_context61.t1 = _context61.t0()).done) {
10569
+ _context61.next = 10;
10570
+ break;
10571
+ }
10572
+
10573
+ _key5 = _context61.t1.value;
10574
+
10575
+ if (!reservedThreadFields.includes(_key5)) {
10576
+ _context61.next = 8;
10577
+ break;
10578
+ }
10579
+
10580
+ 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."));
10581
+
10582
+ case 8:
10583
+ _context61.next = 4;
10584
+ break;
10585
+
10586
+ case 10:
10587
+ _context61.next = 12;
10588
+ return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
10589
+
10590
+ case 12:
10591
+ return _context61.abrupt("return", _context61.sent);
10592
+
10593
+ case 13:
10594
+ case "end":
10595
+ return _context61.stop();
10596
+ }
10597
+ }
10598
+ }, _callee61, this);
10599
+ }));
10600
+
10601
+ function partialUpdateThread(_x80, _x81) {
10602
+ return _partialUpdateThread.apply(this, arguments);
10603
+ }
10604
+
10605
+ return partialUpdateThread;
10606
+ }()
10246
10607
  }, {
10247
10608
  key: "getUserAgent",
10248
10609
  value: function getUserAgent() {
10249
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.15.0");
10610
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.17.0");
10250
10611
  }
10251
10612
  }, {
10252
10613
  key: "setUserAgent",
@@ -10465,28 +10826,28 @@ var StreamChat = /*#__PURE__*/function () {
10465
10826
  }, {
10466
10827
  key: "sendUserCustomEvent",
10467
10828
  value: function () {
10468
- var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(targetUserID, event) {
10469
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
10829
+ var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(targetUserID, event) {
10830
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
10470
10831
  while (1) {
10471
- switch (_context59.prev = _context59.next) {
10832
+ switch (_context62.prev = _context62.next) {
10472
10833
  case 0:
10473
- _context59.next = 2;
10834
+ _context62.next = 2;
10474
10835
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
10475
10836
  event: event
10476
10837
  });
10477
10838
 
10478
10839
  case 2:
10479
- return _context59.abrupt("return", _context59.sent);
10840
+ return _context62.abrupt("return", _context62.sent);
10480
10841
 
10481
10842
  case 3:
10482
10843
  case "end":
10483
- return _context59.stop();
10844
+ return _context62.stop();
10484
10845
  }
10485
10846
  }
10486
- }, _callee59, this);
10847
+ }, _callee62, this);
10487
10848
  }));
10488
10849
 
10489
- function sendUserCustomEvent(_x78, _x79) {
10850
+ function sendUserCustomEvent(_x82, _x83) {
10490
10851
  return _sendUserCustomEvent.apply(this, arguments);
10491
10852
  }
10492
10853
 
@@ -10558,12 +10919,12 @@ var StreamChat = /*#__PURE__*/function () {
10558
10919
  }, {
10559
10920
  key: "createSegment",
10560
10921
  value: function () {
10561
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(type, id, name, data) {
10922
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(type, id, name, data) {
10562
10923
  var body, _yield$this$post, segment;
10563
10924
 
10564
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
10925
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
10565
10926
  while (1) {
10566
- switch (_context60.prev = _context60.next) {
10927
+ switch (_context63.prev = _context63.next) {
10567
10928
  case 0:
10568
10929
  body = {
10569
10930
  id: id,
@@ -10571,23 +10932,23 @@ var StreamChat = /*#__PURE__*/function () {
10571
10932
  name: name,
10572
10933
  data: data
10573
10934
  };
10574
- _context60.next = 3;
10935
+ _context63.next = 3;
10575
10936
  return this.post(this.baseURL + "/segments", body);
10576
10937
 
10577
10938
  case 3:
10578
- _yield$this$post = _context60.sent;
10939
+ _yield$this$post = _context63.sent;
10579
10940
  segment = _yield$this$post.segment;
10580
- return _context60.abrupt("return", segment);
10941
+ return _context63.abrupt("return", segment);
10581
10942
 
10582
10943
  case 6:
10583
10944
  case "end":
10584
- return _context60.stop();
10945
+ return _context63.stop();
10585
10946
  }
10586
10947
  }
10587
- }, _callee60, this);
10948
+ }, _callee63, this);
10588
10949
  }));
10589
10950
 
10590
- function createSegment(_x80, _x81, _x82, _x83) {
10951
+ function createSegment(_x84, _x85, _x86, _x87) {
10591
10952
  return _createSegment.apply(this, arguments);
10592
10953
  }
10593
10954
 
@@ -10606,26 +10967,26 @@ var StreamChat = /*#__PURE__*/function () {
10606
10967
  }, {
10607
10968
  key: "createUserSegment",
10608
10969
  value: function () {
10609
- var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id, name, data) {
10610
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
10970
+ var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id, name, data) {
10971
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
10611
10972
  while (1) {
10612
- switch (_context61.prev = _context61.next) {
10973
+ switch (_context64.prev = _context64.next) {
10613
10974
  case 0:
10614
- _context61.next = 2;
10975
+ _context64.next = 2;
10615
10976
  return this.createSegment('user', id, name, data);
10616
10977
 
10617
10978
  case 2:
10618
- return _context61.abrupt("return", _context61.sent);
10979
+ return _context64.abrupt("return", _context64.sent);
10619
10980
 
10620
10981
  case 3:
10621
10982
  case "end":
10622
- return _context61.stop();
10983
+ return _context64.stop();
10623
10984
  }
10624
10985
  }
10625
- }, _callee61, this);
10986
+ }, _callee64, this);
10626
10987
  }));
10627
10988
 
10628
- function createUserSegment(_x84, _x85, _x86) {
10989
+ function createUserSegment(_x88, _x89, _x90) {
10629
10990
  return _createUserSegment.apply(this, arguments);
10630
10991
  }
10631
10992
 
@@ -10644,26 +11005,26 @@ var StreamChat = /*#__PURE__*/function () {
10644
11005
  }, {
10645
11006
  key: "createChannelSegment",
10646
11007
  value: function () {
10647
- var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id, name, data) {
10648
- return _regeneratorRuntime.wrap(function _callee62$(_context62) {
11008
+ var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, name, data) {
11009
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
10649
11010
  while (1) {
10650
- switch (_context62.prev = _context62.next) {
11011
+ switch (_context65.prev = _context65.next) {
10651
11012
  case 0:
10652
- _context62.next = 2;
11013
+ _context65.next = 2;
10653
11014
  return this.createSegment('channel', id, name, data);
10654
11015
 
10655
11016
  case 2:
10656
- return _context62.abrupt("return", _context62.sent);
11017
+ return _context65.abrupt("return", _context65.sent);
10657
11018
 
10658
11019
  case 3:
10659
11020
  case "end":
10660
- return _context62.stop();
11021
+ return _context65.stop();
10661
11022
  }
10662
11023
  }
10663
- }, _callee62, this);
11024
+ }, _callee65, this);
10664
11025
  }));
10665
11026
 
10666
- function createChannelSegment(_x87, _x88, _x89) {
11027
+ function createChannelSegment(_x91, _x92, _x93) {
10667
11028
  return _createChannelSegment.apply(this, arguments);
10668
11029
  }
10669
11030
 
@@ -10681,30 +11042,30 @@ var StreamChat = /*#__PURE__*/function () {
10681
11042
  }, {
10682
11043
  key: "updateSegment",
10683
11044
  value: function () {
10684
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id, data) {
11045
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
10685
11046
  var _yield$this$put, segment;
10686
11047
 
10687
- return _regeneratorRuntime.wrap(function _callee63$(_context63) {
11048
+ return _regeneratorRuntime.wrap(function _callee66$(_context66) {
10688
11049
  while (1) {
10689
- switch (_context63.prev = _context63.next) {
11050
+ switch (_context66.prev = _context66.next) {
10690
11051
  case 0:
10691
- _context63.next = 2;
11052
+ _context66.next = 2;
10692
11053
  return this.put(this.baseURL + "/segments/".concat(id), data);
10693
11054
 
10694
11055
  case 2:
10695
- _yield$this$put = _context63.sent;
11056
+ _yield$this$put = _context66.sent;
10696
11057
  segment = _yield$this$put.segment;
10697
- return _context63.abrupt("return", segment);
11058
+ return _context66.abrupt("return", segment);
10698
11059
 
10699
11060
  case 5:
10700
11061
  case "end":
10701
- return _context63.stop();
11062
+ return _context66.stop();
10702
11063
  }
10703
11064
  }
10704
- }, _callee63, this);
11065
+ }, _callee66, this);
10705
11066
  }));
10706
11067
 
10707
- function updateSegment(_x90, _x91) {
11068
+ function updateSegment(_x94, _x95) {
10708
11069
  return _updateSegment.apply(this, arguments);
10709
11070
  }
10710
11071
 
@@ -10722,30 +11083,30 @@ var StreamChat = /*#__PURE__*/function () {
10722
11083
  }, {
10723
11084
  key: "addSegmentTargets",
10724
11085
  value: function () {
10725
- var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id, targets) {
11086
+ var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, targets) {
10726
11087
  var body;
10727
- return _regeneratorRuntime.wrap(function _callee64$(_context64) {
11088
+ return _regeneratorRuntime.wrap(function _callee67$(_context67) {
10728
11089
  while (1) {
10729
- switch (_context64.prev = _context64.next) {
11090
+ switch (_context67.prev = _context67.next) {
10730
11091
  case 0:
10731
11092
  body = {
10732
11093
  targets: targets
10733
11094
  };
10734
- _context64.next = 3;
11095
+ _context67.next = 3;
10735
11096
  return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
10736
11097
 
10737
11098
  case 3:
10738
- return _context64.abrupt("return", _context64.sent);
11099
+ return _context67.abrupt("return", _context67.sent);
10739
11100
 
10740
11101
  case 4:
10741
11102
  case "end":
10742
- return _context64.stop();
11103
+ return _context67.stop();
10743
11104
  }
10744
11105
  }
10745
- }, _callee64, this);
11106
+ }, _callee67, this);
10746
11107
  }));
10747
11108
 
10748
- function addSegmentTargets(_x92, _x93) {
11109
+ function addSegmentTargets(_x96, _x97) {
10749
11110
  return _addSegmentTargets.apply(this, arguments);
10750
11111
  }
10751
11112
 
@@ -10763,30 +11124,30 @@ var StreamChat = /*#__PURE__*/function () {
10763
11124
  }, {
10764
11125
  key: "deleteSegmentTargets",
10765
11126
  value: function () {
10766
- var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, targets) {
11127
+ var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
10767
11128
  var body;
10768
- return _regeneratorRuntime.wrap(function _callee65$(_context65) {
11129
+ return _regeneratorRuntime.wrap(function _callee68$(_context68) {
10769
11130
  while (1) {
10770
- switch (_context65.prev = _context65.next) {
11131
+ switch (_context68.prev = _context68.next) {
10771
11132
  case 0:
10772
11133
  body = {
10773
11134
  targets: targets
10774
11135
  };
10775
- _context65.next = 3;
11136
+ _context68.next = 3;
10776
11137
  return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
10777
11138
 
10778
11139
  case 3:
10779
- return _context65.abrupt("return", _context65.sent);
11140
+ return _context68.abrupt("return", _context68.sent);
10780
11141
 
10781
11142
  case 4:
10782
11143
  case "end":
10783
- return _context65.stop();
11144
+ return _context68.stop();
10784
11145
  }
10785
11146
  }
10786
- }, _callee65, this);
11147
+ }, _callee68, this);
10787
11148
  }));
10788
11149
 
10789
- function deleteSegmentTargets(_x94, _x95) {
11150
+ function deleteSegmentTargets(_x98, _x99) {
10790
11151
  return _deleteSegmentTargets.apply(this, arguments);
10791
11152
  }
10792
11153
 
@@ -10804,15 +11165,15 @@ var StreamChat = /*#__PURE__*/function () {
10804
11165
  }, {
10805
11166
  key: "querySegments",
10806
11167
  value: function () {
10807
- var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(filter) {
11168
+ var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(filter) {
10808
11169
  var options,
10809
- _args66 = arguments;
10810
- return _regeneratorRuntime.wrap(function _callee66$(_context66) {
11170
+ _args69 = arguments;
11171
+ return _regeneratorRuntime.wrap(function _callee69$(_context69) {
10811
11172
  while (1) {
10812
- switch (_context66.prev = _context66.next) {
11173
+ switch (_context69.prev = _context69.next) {
10813
11174
  case 0:
10814
- options = _args66.length > 1 && _args66[1] !== undefined ? _args66[1] : {};
10815
- _context66.next = 3;
11175
+ options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
11176
+ _context69.next = 3;
10816
11177
  return this.get(this.baseURL + "/segments", {
10817
11178
  payload: _objectSpread({
10818
11179
  filter: filter
@@ -10820,17 +11181,17 @@ var StreamChat = /*#__PURE__*/function () {
10820
11181
  });
10821
11182
 
10822
11183
  case 3:
10823
- return _context66.abrupt("return", _context66.sent);
11184
+ return _context69.abrupt("return", _context69.sent);
10824
11185
 
10825
11186
  case 4:
10826
11187
  case "end":
10827
- return _context66.stop();
11188
+ return _context69.stop();
10828
11189
  }
10829
11190
  }
10830
- }, _callee66, this);
11191
+ }, _callee69, this);
10831
11192
  }));
10832
11193
 
10833
- function querySegments(_x96) {
11194
+ function querySegments(_x100) {
10834
11195
  return _querySegments.apply(this, arguments);
10835
11196
  }
10836
11197
 
@@ -10847,26 +11208,26 @@ var StreamChat = /*#__PURE__*/function () {
10847
11208
  }, {
10848
11209
  key: "deleteSegment",
10849
11210
  value: function () {
10850
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id) {
10851
- return _regeneratorRuntime.wrap(function _callee67$(_context67) {
11211
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id) {
11212
+ return _regeneratorRuntime.wrap(function _callee70$(_context70) {
10852
11213
  while (1) {
10853
- switch (_context67.prev = _context67.next) {
11214
+ switch (_context70.prev = _context70.next) {
10854
11215
  case 0:
10855
- _context67.next = 2;
11216
+ _context70.next = 2;
10856
11217
  return this.delete(this.baseURL + "/segments/".concat(id));
10857
11218
 
10858
11219
  case 2:
10859
- return _context67.abrupt("return", _context67.sent);
11220
+ return _context70.abrupt("return", _context70.sent);
10860
11221
 
10861
11222
  case 3:
10862
11223
  case "end":
10863
- return _context67.stop();
11224
+ return _context70.stop();
10864
11225
  }
10865
11226
  }
10866
- }, _callee67, this);
11227
+ }, _callee70, this);
10867
11228
  }));
10868
11229
 
10869
- function deleteSegment(_x97) {
11230
+ function deleteSegment(_x101) {
10870
11231
  return _deleteSegment.apply(this, arguments);
10871
11232
  }
10872
11233
 
@@ -10884,26 +11245,26 @@ var StreamChat = /*#__PURE__*/function () {
10884
11245
  }, {
10885
11246
  key: "segmentTargetExists",
10886
11247
  value: function () {
10887
- var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(segmentId, targetId) {
10888
- return _regeneratorRuntime.wrap(function _callee68$(_context68) {
11248
+ var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(segmentId, targetId) {
11249
+ return _regeneratorRuntime.wrap(function _callee71$(_context71) {
10889
11250
  while (1) {
10890
- switch (_context68.prev = _context68.next) {
11251
+ switch (_context71.prev = _context71.next) {
10891
11252
  case 0:
10892
- _context68.next = 2;
11253
+ _context71.next = 2;
10893
11254
  return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
10894
11255
 
10895
11256
  case 2:
10896
- return _context68.abrupt("return", _context68.sent);
11257
+ return _context71.abrupt("return", _context71.sent);
10897
11258
 
10898
11259
  case 3:
10899
11260
  case "end":
10900
- return _context68.stop();
11261
+ return _context71.stop();
10901
11262
  }
10902
11263
  }
10903
- }, _callee68, this);
11264
+ }, _callee71, this);
10904
11265
  }));
10905
11266
 
10906
- function segmentTargetExists(_x98, _x99) {
11267
+ function segmentTargetExists(_x102, _x103) {
10907
11268
  return _segmentTargetExists.apply(this, arguments);
10908
11269
  }
10909
11270
 
@@ -10920,32 +11281,32 @@ var StreamChat = /*#__PURE__*/function () {
10920
11281
  }, {
10921
11282
  key: "createCampaign",
10922
11283
  value: function () {
10923
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(params) {
11284
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(params) {
10924
11285
  var _yield$this$post2, campaign;
10925
11286
 
10926
- return _regeneratorRuntime.wrap(function _callee69$(_context69) {
11287
+ return _regeneratorRuntime.wrap(function _callee72$(_context72) {
10927
11288
  while (1) {
10928
- switch (_context69.prev = _context69.next) {
11289
+ switch (_context72.prev = _context72.next) {
10929
11290
  case 0:
10930
- _context69.next = 2;
11291
+ _context72.next = 2;
10931
11292
  return this.post(this.baseURL + "/campaigns", {
10932
11293
  campaign: params
10933
11294
  });
10934
11295
 
10935
11296
  case 2:
10936
- _yield$this$post2 = _context69.sent;
11297
+ _yield$this$post2 = _context72.sent;
10937
11298
  campaign = _yield$this$post2.campaign;
10938
- return _context69.abrupt("return", campaign);
11299
+ return _context72.abrupt("return", campaign);
10939
11300
 
10940
11301
  case 5:
10941
11302
  case "end":
10942
- return _context69.stop();
11303
+ return _context72.stop();
10943
11304
  }
10944
11305
  }
10945
- }, _callee69, this);
11306
+ }, _callee72, this);
10946
11307
  }));
10947
11308
 
10948
- function createCampaign(_x100) {
11309
+ function createCampaign(_x104) {
10949
11310
  return _createCampaign.apply(this, arguments);
10950
11311
  }
10951
11312
 
@@ -10961,15 +11322,15 @@ var StreamChat = /*#__PURE__*/function () {
10961
11322
  }, {
10962
11323
  key: "queryCampaigns",
10963
11324
  value: function () {
10964
- var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(filters) {
11325
+ var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(filters) {
10965
11326
  var options,
10966
- _args70 = arguments;
10967
- return _regeneratorRuntime.wrap(function _callee70$(_context70) {
11327
+ _args73 = arguments;
11328
+ return _regeneratorRuntime.wrap(function _callee73$(_context73) {
10968
11329
  while (1) {
10969
- switch (_context70.prev = _context70.next) {
11330
+ switch (_context73.prev = _context73.next) {
10970
11331
  case 0:
10971
- options = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {};
10972
- _context70.next = 3;
11332
+ options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
11333
+ _context73.next = 3;
10973
11334
  return this.get(this.baseURL + "/campaigns", {
10974
11335
  payload: _objectSpread({
10975
11336
  filter_conditions: filters
@@ -10977,17 +11338,17 @@ var StreamChat = /*#__PURE__*/function () {
10977
11338
  });
10978
11339
 
10979
11340
  case 3:
10980
- return _context70.abrupt("return", _context70.sent);
11341
+ return _context73.abrupt("return", _context73.sent);
10981
11342
 
10982
11343
  case 4:
10983
11344
  case "end":
10984
- return _context70.stop();
11345
+ return _context73.stop();
10985
11346
  }
10986
11347
  }
10987
- }, _callee70, this);
11348
+ }, _callee73, this);
10988
11349
  }));
10989
11350
 
10990
- function queryCampaigns(_x101) {
11351
+ function queryCampaigns(_x105) {
10991
11352
  return _queryCampaigns.apply(this, arguments);
10992
11353
  }
10993
11354
 
@@ -11005,32 +11366,32 @@ var StreamChat = /*#__PURE__*/function () {
11005
11366
  }, {
11006
11367
  key: "updateCampaign",
11007
11368
  value: function () {
11008
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(id, params) {
11369
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id, params) {
11009
11370
  var _yield$this$put2, campaign;
11010
11371
 
11011
- return _regeneratorRuntime.wrap(function _callee71$(_context71) {
11372
+ return _regeneratorRuntime.wrap(function _callee74$(_context74) {
11012
11373
  while (1) {
11013
- switch (_context71.prev = _context71.next) {
11374
+ switch (_context74.prev = _context74.next) {
11014
11375
  case 0:
11015
- _context71.next = 2;
11376
+ _context74.next = 2;
11016
11377
  return this.put(this.baseURL + "/campaigns/".concat(id), {
11017
11378
  campaign: params
11018
11379
  });
11019
11380
 
11020
11381
  case 2:
11021
- _yield$this$put2 = _context71.sent;
11382
+ _yield$this$put2 = _context74.sent;
11022
11383
  campaign = _yield$this$put2.campaign;
11023
- return _context71.abrupt("return", campaign);
11384
+ return _context74.abrupt("return", campaign);
11024
11385
 
11025
11386
  case 5:
11026
11387
  case "end":
11027
- return _context71.stop();
11388
+ return _context74.stop();
11028
11389
  }
11029
11390
  }
11030
- }, _callee71, this);
11391
+ }, _callee74, this);
11031
11392
  }));
11032
11393
 
11033
- function updateCampaign(_x102, _x103) {
11394
+ function updateCampaign(_x106, _x107) {
11034
11395
  return _updateCampaign.apply(this, arguments);
11035
11396
  }
11036
11397
 
@@ -11047,25 +11408,25 @@ var StreamChat = /*#__PURE__*/function () {
11047
11408
  }, {
11048
11409
  key: "deleteCampaign",
11049
11410
  value: function () {
11050
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(id) {
11411
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
11051
11412
  var params,
11052
- _args72 = arguments;
11053
- return _regeneratorRuntime.wrap(function _callee72$(_context72) {
11413
+ _args75 = arguments;
11414
+ return _regeneratorRuntime.wrap(function _callee75$(_context75) {
11054
11415
  while (1) {
11055
- switch (_context72.prev = _context72.next) {
11416
+ switch (_context75.prev = _context75.next) {
11056
11417
  case 0:
11057
- params = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {};
11058
- return _context72.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11418
+ params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
11419
+ return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
11059
11420
 
11060
11421
  case 2:
11061
11422
  case "end":
11062
- return _context72.stop();
11423
+ return _context75.stop();
11063
11424
  }
11064
11425
  }
11065
- }, _callee72, this);
11426
+ }, _callee75, this);
11066
11427
  }));
11067
11428
 
11068
- function deleteCampaign(_x104) {
11429
+ function deleteCampaign(_x108) {
11069
11430
  return _deleteCampaign.apply(this, arguments);
11070
11431
  }
11071
11432
 
@@ -11083,33 +11444,33 @@ var StreamChat = /*#__PURE__*/function () {
11083
11444
  }, {
11084
11445
  key: "scheduleCampaign",
11085
11446
  value: function () {
11086
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(id, params) {
11447
+ var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, params) {
11087
11448
  var scheduledFor, _yield$this$patch, campaign;
11088
11449
 
11089
- return _regeneratorRuntime.wrap(function _callee73$(_context73) {
11450
+ return _regeneratorRuntime.wrap(function _callee76$(_context76) {
11090
11451
  while (1) {
11091
- switch (_context73.prev = _context73.next) {
11452
+ switch (_context76.prev = _context76.next) {
11092
11453
  case 0:
11093
11454
  scheduledFor = params.scheduledFor;
11094
- _context73.next = 3;
11455
+ _context76.next = 3;
11095
11456
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
11096
11457
  scheduled_for: scheduledFor
11097
11458
  });
11098
11459
 
11099
11460
  case 3:
11100
- _yield$this$patch = _context73.sent;
11461
+ _yield$this$patch = _context76.sent;
11101
11462
  campaign = _yield$this$patch.campaign;
11102
- return _context73.abrupt("return", campaign);
11463
+ return _context76.abrupt("return", campaign);
11103
11464
 
11104
11465
  case 6:
11105
11466
  case "end":
11106
- return _context73.stop();
11467
+ return _context76.stop();
11107
11468
  }
11108
11469
  }
11109
- }, _callee73, this);
11470
+ }, _callee76, this);
11110
11471
  }));
11111
11472
 
11112
- function scheduleCampaign(_x105, _x106) {
11473
+ function scheduleCampaign(_x109, _x110) {
11113
11474
  return _scheduleCampaign.apply(this, arguments);
11114
11475
  }
11115
11476
 
@@ -11126,30 +11487,30 @@ var StreamChat = /*#__PURE__*/function () {
11126
11487
  }, {
11127
11488
  key: "stopCampaign",
11128
11489
  value: function () {
11129
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id) {
11490
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(id) {
11130
11491
  var _yield$this$patch2, campaign;
11131
11492
 
11132
- return _regeneratorRuntime.wrap(function _callee74$(_context74) {
11493
+ return _regeneratorRuntime.wrap(function _callee77$(_context77) {
11133
11494
  while (1) {
11134
- switch (_context74.prev = _context74.next) {
11495
+ switch (_context77.prev = _context77.next) {
11135
11496
  case 0:
11136
- _context74.next = 2;
11497
+ _context77.next = 2;
11137
11498
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
11138
11499
 
11139
11500
  case 2:
11140
- _yield$this$patch2 = _context74.sent;
11501
+ _yield$this$patch2 = _context77.sent;
11141
11502
  campaign = _yield$this$patch2.campaign;
11142
- return _context74.abrupt("return", campaign);
11503
+ return _context77.abrupt("return", campaign);
11143
11504
 
11144
11505
  case 5:
11145
11506
  case "end":
11146
- return _context74.stop();
11507
+ return _context77.stop();
11147
11508
  }
11148
11509
  }
11149
- }, _callee74, this);
11510
+ }, _callee77, this);
11150
11511
  }));
11151
11512
 
11152
- function stopCampaign(_x107) {
11513
+ function stopCampaign(_x111) {
11153
11514
  return _stopCampaign.apply(this, arguments);
11154
11515
  }
11155
11516
 
@@ -11166,30 +11527,30 @@ var StreamChat = /*#__PURE__*/function () {
11166
11527
  }, {
11167
11528
  key: "resumeCampaign",
11168
11529
  value: function () {
11169
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
11530
+ var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
11170
11531
  var _yield$this$patch3, campaign;
11171
11532
 
11172
- return _regeneratorRuntime.wrap(function _callee75$(_context75) {
11533
+ return _regeneratorRuntime.wrap(function _callee78$(_context78) {
11173
11534
  while (1) {
11174
- switch (_context75.prev = _context75.next) {
11535
+ switch (_context78.prev = _context78.next) {
11175
11536
  case 0:
11176
- _context75.next = 2;
11537
+ _context78.next = 2;
11177
11538
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
11178
11539
 
11179
11540
  case 2:
11180
- _yield$this$patch3 = _context75.sent;
11541
+ _yield$this$patch3 = _context78.sent;
11181
11542
  campaign = _yield$this$patch3.campaign;
11182
- return _context75.abrupt("return", campaign);
11543
+ return _context78.abrupt("return", campaign);
11183
11544
 
11184
11545
  case 5:
11185
11546
  case "end":
11186
- return _context75.stop();
11547
+ return _context78.stop();
11187
11548
  }
11188
11549
  }
11189
- }, _callee75, this);
11550
+ }, _callee78, this);
11190
11551
  }));
11191
11552
 
11192
- function resumeCampaign(_x108) {
11553
+ function resumeCampaign(_x112) {
11193
11554
  return _resumeCampaign.apply(this, arguments);
11194
11555
  }
11195
11556
 
@@ -11207,30 +11568,30 @@ var StreamChat = /*#__PURE__*/function () {
11207
11568
  }, {
11208
11569
  key: "testCampaign",
11209
11570
  value: function () {
11210
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, params) {
11571
+ var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id, params) {
11211
11572
  var users;
11212
- return _regeneratorRuntime.wrap(function _callee76$(_context76) {
11573
+ return _regeneratorRuntime.wrap(function _callee79$(_context79) {
11213
11574
  while (1) {
11214
- switch (_context76.prev = _context76.next) {
11575
+ switch (_context79.prev = _context79.next) {
11215
11576
  case 0:
11216
11577
  users = params.users;
11217
- _context76.next = 3;
11578
+ _context79.next = 3;
11218
11579
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
11219
11580
  users: users
11220
11581
  });
11221
11582
 
11222
11583
  case 3:
11223
- return _context76.abrupt("return", _context76.sent);
11584
+ return _context79.abrupt("return", _context79.sent);
11224
11585
 
11225
11586
  case 4:
11226
11587
  case "end":
11227
- return _context76.stop();
11588
+ return _context79.stop();
11228
11589
  }
11229
11590
  }
11230
- }, _callee76, this);
11591
+ }, _callee79, this);
11231
11592
  }));
11232
11593
 
11233
- function testCampaign(_x109, _x110) {
11594
+ function testCampaign(_x113, _x114) {
11234
11595
  return _testCampaign.apply(this, arguments);
11235
11596
  }
11236
11597
 
@@ -11246,24 +11607,24 @@ var StreamChat = /*#__PURE__*/function () {
11246
11607
  }, {
11247
11608
  key: "enrichURL",
11248
11609
  value: function () {
11249
- var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(url) {
11250
- return _regeneratorRuntime.wrap(function _callee77$(_context77) {
11610
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(url) {
11611
+ return _regeneratorRuntime.wrap(function _callee80$(_context80) {
11251
11612
  while (1) {
11252
- switch (_context77.prev = _context77.next) {
11613
+ switch (_context80.prev = _context80.next) {
11253
11614
  case 0:
11254
- return _context77.abrupt("return", this.get(this.baseURL + "/og", {
11615
+ return _context80.abrupt("return", this.get(this.baseURL + "/og", {
11255
11616
  url: url
11256
11617
  }));
11257
11618
 
11258
11619
  case 1:
11259
11620
  case "end":
11260
- return _context77.stop();
11621
+ return _context80.stop();
11261
11622
  }
11262
11623
  }
11263
- }, _callee77, this);
11624
+ }, _callee80, this);
11264
11625
  }));
11265
11626
 
11266
- function enrichURL(_x111) {
11627
+ function enrichURL(_x115) {
11267
11628
  return _enrichURL.apply(this, arguments);
11268
11629
  }
11269
11630
 
@@ -11280,22 +11641,22 @@ var StreamChat = /*#__PURE__*/function () {
11280
11641
  }, {
11281
11642
  key: "getTask",
11282
11643
  value: function () {
11283
- var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
11284
- return _regeneratorRuntime.wrap(function _callee78$(_context78) {
11644
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
11645
+ return _regeneratorRuntime.wrap(function _callee81$(_context81) {
11285
11646
  while (1) {
11286
- switch (_context78.prev = _context78.next) {
11647
+ switch (_context81.prev = _context81.next) {
11287
11648
  case 0:
11288
- return _context78.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11649
+ return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
11289
11650
 
11290
11651
  case 1:
11291
11652
  case "end":
11292
- return _context78.stop();
11653
+ return _context81.stop();
11293
11654
  }
11294
11655
  }
11295
- }, _callee78, this);
11656
+ }, _callee81, this);
11296
11657
  }));
11297
11658
 
11298
- function getTask(_x112) {
11659
+ function getTask(_x116) {
11299
11660
  return _getTask.apply(this, arguments);
11300
11661
  }
11301
11662
 
@@ -11313,31 +11674,31 @@ var StreamChat = /*#__PURE__*/function () {
11313
11674
  }, {
11314
11675
  key: "deleteChannels",
11315
11676
  value: function () {
11316
- var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(cids) {
11677
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(cids) {
11317
11678
  var options,
11318
- _args79 = arguments;
11319
- return _regeneratorRuntime.wrap(function _callee79$(_context79) {
11679
+ _args82 = arguments;
11680
+ return _regeneratorRuntime.wrap(function _callee82$(_context82) {
11320
11681
  while (1) {
11321
- switch (_context79.prev = _context79.next) {
11682
+ switch (_context82.prev = _context82.next) {
11322
11683
  case 0:
11323
- options = _args79.length > 1 && _args79[1] !== undefined ? _args79[1] : {};
11324
- _context79.next = 3;
11684
+ options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
11685
+ _context82.next = 3;
11325
11686
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
11326
11687
  cids: cids
11327
11688
  }, options));
11328
11689
 
11329
11690
  case 3:
11330
- return _context79.abrupt("return", _context79.sent);
11691
+ return _context82.abrupt("return", _context82.sent);
11331
11692
 
11332
11693
  case 4:
11333
11694
  case "end":
11334
- return _context79.stop();
11695
+ return _context82.stop();
11335
11696
  }
11336
11697
  }
11337
- }, _callee79, this);
11698
+ }, _callee82, this);
11338
11699
  }));
11339
11700
 
11340
- function deleteChannels(_x113) {
11701
+ function deleteChannels(_x117) {
11341
11702
  return _deleteChannels.apply(this, arguments);
11342
11703
  }
11343
11704
 
@@ -11355,17 +11716,17 @@ var StreamChat = /*#__PURE__*/function () {
11355
11716
  }, {
11356
11717
  key: "deleteUsers",
11357
11718
  value: function () {
11358
- var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(user_ids) {
11719
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(user_ids) {
11359
11720
  var options,
11360
- _args80 = arguments;
11361
- return _regeneratorRuntime.wrap(function _callee80$(_context80) {
11721
+ _args83 = arguments;
11722
+ return _regeneratorRuntime.wrap(function _callee83$(_context83) {
11362
11723
  while (1) {
11363
- switch (_context80.prev = _context80.next) {
11724
+ switch (_context83.prev = _context83.next) {
11364
11725
  case 0:
11365
- options = _args80.length > 1 && _args80[1] !== undefined ? _args80[1] : {};
11726
+ options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
11366
11727
 
11367
11728
  if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
11368
- _context80.next = 3;
11729
+ _context83.next = 3;
11369
11730
  break;
11370
11731
  }
11371
11732
 
@@ -11373,7 +11734,7 @@ var StreamChat = /*#__PURE__*/function () {
11373
11734
 
11374
11735
  case 3:
11375
11736
  if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
11376
- _context80.next = 5;
11737
+ _context83.next = 5;
11377
11738
  break;
11378
11739
  }
11379
11740
 
@@ -11381,30 +11742,30 @@ var StreamChat = /*#__PURE__*/function () {
11381
11742
 
11382
11743
  case 5:
11383
11744
  if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
11384
- _context80.next = 7;
11745
+ _context83.next = 7;
11385
11746
  break;
11386
11747
  }
11387
11748
 
11388
11749
  throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
11389
11750
 
11390
11751
  case 7:
11391
- _context80.next = 9;
11752
+ _context83.next = 9;
11392
11753
  return this.post(this.baseURL + "/users/delete", _objectSpread({
11393
11754
  user_ids: user_ids
11394
11755
  }, options));
11395
11756
 
11396
11757
  case 9:
11397
- return _context80.abrupt("return", _context80.sent);
11758
+ return _context83.abrupt("return", _context83.sent);
11398
11759
 
11399
11760
  case 10:
11400
11761
  case "end":
11401
- return _context80.stop();
11762
+ return _context83.stop();
11402
11763
  }
11403
11764
  }
11404
- }, _callee80, this);
11765
+ }, _callee83, this);
11405
11766
  }));
11406
11767
 
11407
- function deleteUsers(_x114) {
11768
+ function deleteUsers(_x118) {
11408
11769
  return _deleteUsers.apply(this, arguments);
11409
11770
  }
11410
11771
 
@@ -11425,28 +11786,28 @@ var StreamChat = /*#__PURE__*/function () {
11425
11786
  }, {
11426
11787
  key: "_createImportURL",
11427
11788
  value: function () {
11428
- var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(filename) {
11429
- return _regeneratorRuntime.wrap(function _callee81$(_context81) {
11789
+ var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(filename) {
11790
+ return _regeneratorRuntime.wrap(function _callee84$(_context84) {
11430
11791
  while (1) {
11431
- switch (_context81.prev = _context81.next) {
11792
+ switch (_context84.prev = _context84.next) {
11432
11793
  case 0:
11433
- _context81.next = 2;
11794
+ _context84.next = 2;
11434
11795
  return this.post(this.baseURL + "/import_urls", {
11435
11796
  filename: filename
11436
11797
  });
11437
11798
 
11438
11799
  case 2:
11439
- return _context81.abrupt("return", _context81.sent);
11800
+ return _context84.abrupt("return", _context84.sent);
11440
11801
 
11441
11802
  case 3:
11442
11803
  case "end":
11443
- return _context81.stop();
11804
+ return _context84.stop();
11444
11805
  }
11445
11806
  }
11446
- }, _callee81, this);
11807
+ }, _callee84, this);
11447
11808
  }));
11448
11809
 
11449
- function _createImportURL(_x115) {
11810
+ function _createImportURL(_x119) {
11450
11811
  return _createImportURL2.apply(this, arguments);
11451
11812
  }
11452
11813
 
@@ -11468,33 +11829,33 @@ var StreamChat = /*#__PURE__*/function () {
11468
11829
  }, {
11469
11830
  key: "_createImport",
11470
11831
  value: function () {
11471
- var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(path) {
11832
+ var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(path) {
11472
11833
  var options,
11473
- _args82 = arguments;
11474
- return _regeneratorRuntime.wrap(function _callee82$(_context82) {
11834
+ _args85 = arguments;
11835
+ return _regeneratorRuntime.wrap(function _callee85$(_context85) {
11475
11836
  while (1) {
11476
- switch (_context82.prev = _context82.next) {
11837
+ switch (_context85.prev = _context85.next) {
11477
11838
  case 0:
11478
- options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {
11839
+ options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
11479
11840
  mode: 'upsert'
11480
11841
  };
11481
- _context82.next = 3;
11842
+ _context85.next = 3;
11482
11843
  return this.post(this.baseURL + "/imports", _objectSpread({
11483
11844
  path: path
11484
11845
  }, options));
11485
11846
 
11486
11847
  case 3:
11487
- return _context82.abrupt("return", _context82.sent);
11848
+ return _context85.abrupt("return", _context85.sent);
11488
11849
 
11489
11850
  case 4:
11490
11851
  case "end":
11491
- return _context82.stop();
11852
+ return _context85.stop();
11492
11853
  }
11493
11854
  }
11494
- }, _callee82, this);
11855
+ }, _callee85, this);
11495
11856
  }));
11496
11857
 
11497
- function _createImport(_x116) {
11858
+ function _createImport(_x120) {
11498
11859
  return _createImport2.apply(this, arguments);
11499
11860
  }
11500
11861
 
@@ -11516,26 +11877,26 @@ var StreamChat = /*#__PURE__*/function () {
11516
11877
  }, {
11517
11878
  key: "_getImport",
11518
11879
  value: function () {
11519
- var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(id) {
11520
- return _regeneratorRuntime.wrap(function _callee83$(_context83) {
11880
+ var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(id) {
11881
+ return _regeneratorRuntime.wrap(function _callee86$(_context86) {
11521
11882
  while (1) {
11522
- switch (_context83.prev = _context83.next) {
11883
+ switch (_context86.prev = _context86.next) {
11523
11884
  case 0:
11524
- _context83.next = 2;
11885
+ _context86.next = 2;
11525
11886
  return this.get(this.baseURL + "/imports/".concat(id));
11526
11887
 
11527
11888
  case 2:
11528
- return _context83.abrupt("return", _context83.sent);
11889
+ return _context86.abrupt("return", _context86.sent);
11529
11890
 
11530
11891
  case 3:
11531
11892
  case "end":
11532
- return _context83.stop();
11893
+ return _context86.stop();
11533
11894
  }
11534
11895
  }
11535
- }, _callee83, this);
11896
+ }, _callee86, this);
11536
11897
  }));
11537
11898
 
11538
- function _getImport(_x117) {
11899
+ function _getImport(_x121) {
11539
11900
  return _getImport2.apply(this, arguments);
11540
11901
  }
11541
11902
 
@@ -11557,26 +11918,26 @@ var StreamChat = /*#__PURE__*/function () {
11557
11918
  }, {
11558
11919
  key: "_listImports",
11559
11920
  value: function () {
11560
- var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(options) {
11561
- return _regeneratorRuntime.wrap(function _callee84$(_context84) {
11921
+ var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(options) {
11922
+ return _regeneratorRuntime.wrap(function _callee87$(_context87) {
11562
11923
  while (1) {
11563
- switch (_context84.prev = _context84.next) {
11924
+ switch (_context87.prev = _context87.next) {
11564
11925
  case 0:
11565
- _context84.next = 2;
11926
+ _context87.next = 2;
11566
11927
  return this.get(this.baseURL + "/imports", options);
11567
11928
 
11568
11929
  case 2:
11569
- return _context84.abrupt("return", _context84.sent);
11930
+ return _context87.abrupt("return", _context87.sent);
11570
11931
 
11571
11932
  case 3:
11572
11933
  case "end":
11573
- return _context84.stop();
11934
+ return _context87.stop();
11574
11935
  }
11575
11936
  }
11576
- }, _callee84, this);
11937
+ }, _callee87, this);
11577
11938
  }));
11578
11939
 
11579
- function _listImports(_x118) {
11940
+ function _listImports(_x122) {
11580
11941
  return _listImports2.apply(this, arguments);
11581
11942
  }
11582
11943
 
@@ -11595,28 +11956,28 @@ var StreamChat = /*#__PURE__*/function () {
11595
11956
  }, {
11596
11957
  key: "upsertPushProvider",
11597
11958
  value: function () {
11598
- var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(pushProvider) {
11599
- return _regeneratorRuntime.wrap(function _callee85$(_context85) {
11959
+ var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(pushProvider) {
11960
+ return _regeneratorRuntime.wrap(function _callee88$(_context88) {
11600
11961
  while (1) {
11601
- switch (_context85.prev = _context85.next) {
11962
+ switch (_context88.prev = _context88.next) {
11602
11963
  case 0:
11603
- _context85.next = 2;
11964
+ _context88.next = 2;
11604
11965
  return this.post(this.baseURL + "/push_providers", {
11605
11966
  push_provider: pushProvider
11606
11967
  });
11607
11968
 
11608
11969
  case 2:
11609
- return _context85.abrupt("return", _context85.sent);
11970
+ return _context88.abrupt("return", _context88.sent);
11610
11971
 
11611
11972
  case 3:
11612
11973
  case "end":
11613
- return _context85.stop();
11974
+ return _context88.stop();
11614
11975
  }
11615
11976
  }
11616
- }, _callee85, this);
11977
+ }, _callee88, this);
11617
11978
  }));
11618
11979
 
11619
- function upsertPushProvider(_x119) {
11980
+ function upsertPushProvider(_x123) {
11620
11981
  return _upsertPushProvider.apply(this, arguments);
11621
11982
  }
11622
11983
 
@@ -11635,28 +11996,28 @@ var StreamChat = /*#__PURE__*/function () {
11635
11996
  }, {
11636
11997
  key: "deletePushProvider",
11637
11998
  value: function () {
11638
- var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(_ref10) {
11999
+ var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(_ref10) {
11639
12000
  var type, name;
11640
- return _regeneratorRuntime.wrap(function _callee86$(_context86) {
12001
+ return _regeneratorRuntime.wrap(function _callee89$(_context89) {
11641
12002
  while (1) {
11642
- switch (_context86.prev = _context86.next) {
12003
+ switch (_context89.prev = _context89.next) {
11643
12004
  case 0:
11644
12005
  type = _ref10.type, name = _ref10.name;
11645
- _context86.next = 3;
12006
+ _context89.next = 3;
11646
12007
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11647
12008
 
11648
12009
  case 3:
11649
- return _context86.abrupt("return", _context86.sent);
12010
+ return _context89.abrupt("return", _context89.sent);
11650
12011
 
11651
12012
  case 4:
11652
12013
  case "end":
11653
- return _context86.stop();
12014
+ return _context89.stop();
11654
12015
  }
11655
12016
  }
11656
- }, _callee86, this);
12017
+ }, _callee89, this);
11657
12018
  }));
11658
12019
 
11659
- function deletePushProvider(_x120) {
12020
+ function deletePushProvider(_x124) {
11660
12021
  return _deletePushProvider.apply(this, arguments);
11661
12022
  }
11662
12023
 
@@ -11673,23 +12034,23 @@ var StreamChat = /*#__PURE__*/function () {
11673
12034
  }, {
11674
12035
  key: "listPushProviders",
11675
12036
  value: function () {
11676
- var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87() {
11677
- return _regeneratorRuntime.wrap(function _callee87$(_context87) {
12037
+ var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90() {
12038
+ return _regeneratorRuntime.wrap(function _callee90$(_context90) {
11678
12039
  while (1) {
11679
- switch (_context87.prev = _context87.next) {
12040
+ switch (_context90.prev = _context90.next) {
11680
12041
  case 0:
11681
- _context87.next = 2;
12042
+ _context90.next = 2;
11682
12043
  return this.get(this.baseURL + "/push_providers");
11683
12044
 
11684
12045
  case 2:
11685
- return _context87.abrupt("return", _context87.sent);
12046
+ return _context90.abrupt("return", _context90.sent);
11686
12047
 
11687
12048
  case 3:
11688
12049
  case "end":
11689
- return _context87.stop();
12050
+ return _context90.stop();
11690
12051
  }
11691
12052
  }
11692
- }, _callee87, this);
12053
+ }, _callee90, this);
11693
12054
  }));
11694
12055
 
11695
12056
  function listPushProviders() {
@@ -11717,26 +12078,26 @@ var StreamChat = /*#__PURE__*/function () {
11717
12078
  }, {
11718
12079
  key: "commitMessage",
11719
12080
  value: function () {
11720
- var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(id) {
11721
- return _regeneratorRuntime.wrap(function _callee88$(_context88) {
12081
+ var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91(id) {
12082
+ return _regeneratorRuntime.wrap(function _callee91$(_context91) {
11722
12083
  while (1) {
11723
- switch (_context88.prev = _context88.next) {
12084
+ switch (_context91.prev = _context91.next) {
11724
12085
  case 0:
11725
- _context88.next = 2;
12086
+ _context91.next = 2;
11726
12087
  return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
11727
12088
 
11728
12089
  case 2:
11729
- return _context88.abrupt("return", _context88.sent);
12090
+ return _context91.abrupt("return", _context91.sent);
11730
12091
 
11731
12092
  case 3:
11732
12093
  case "end":
11733
- return _context88.stop();
12094
+ return _context91.stop();
11734
12095
  }
11735
12096
  }
11736
- }, _callee88, this);
12097
+ }, _callee91, this);
11737
12098
  }));
11738
12099
 
11739
- function commitMessage(_x121) {
12100
+ function commitMessage(_x125) {
11740
12101
  return _commitMessage.apply(this, arguments);
11741
12102
  }
11742
12103
 
@@ -11792,6 +12153,7 @@ var EVENT_MAP = {
11792
12153
  'notification.message_new': true,
11793
12154
  'notification.mutes_updated': true,
11794
12155
  'notification.removed_from_channel': true,
12156
+ 'notification.thread_message_new': true,
11795
12157
  'reaction.deleted': true,
11796
12158
  'reaction.new': true,
11797
12159
  'reaction.updated': true,
@@ -11887,5 +12249,5 @@ var BuiltinPermissions = {
11887
12249
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
11888
12250
  };
11889
12251
 
11890
- export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
12252
+ export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
11891
12253
  //# sourceMappingURL=index.es.js.map