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