stream-chat 8.14.5 → 8.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.es.js +1703 -1123
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +1704 -1122
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +1703 -1123
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1704 -1122
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +6 -2
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_state.d.ts +1 -0
- package/dist/types/channel_state.d.ts.map +1 -1
- package/dist/types/client.d.ts +119 -25
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/events.d.ts +2 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/thread.d.ts +28 -0
- package/dist/types/thread.d.ts.map +1 -0
- package/dist/types/types.d.ts +99 -20
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +10 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +32 -18
- package/src/channel_state.ts +9 -59
- package/src/client.ts +218 -43
- package/src/events.ts +2 -0
- package/src/index.ts +2 -1
- package/src/thread.ts +116 -0
- package/src/types.ts +119 -21
- package/src/utils.ts +101 -1
package/dist/browser.js
CHANGED
|
@@ -118,9 +118,347 @@ var decodeBase64 = function decodeBase64(s) {
|
|
|
118
118
|
|
|
119
119
|
var https = null;
|
|
120
120
|
|
|
121
|
-
function ownKeys$
|
|
121
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
122
122
|
|
|
123
|
-
function _objectSpread$
|
|
123
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
124
|
+
|
|
125
|
+
function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
126
|
+
|
|
127
|
+
function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
|
|
128
|
+
|
|
129
|
+
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
133
|
+
* use this when you want to run the promise and handle errors by logging a warning
|
|
134
|
+
*
|
|
135
|
+
* @param {Promise<T>} promise The promise you want to run and log
|
|
136
|
+
* @param {string} name A descriptive name of what the promise does for log output
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
139
|
+
function logChatPromiseExecution(promise, name) {
|
|
140
|
+
promise.then().catch(function (error) {
|
|
141
|
+
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
var sleep = function sleep(m) {
|
|
145
|
+
return new Promise(function (r) {
|
|
146
|
+
return setTimeout(r, m);
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
function isFunction(value) {
|
|
150
|
+
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
151
|
+
}
|
|
152
|
+
var chatCodes = {
|
|
153
|
+
TOKEN_EXPIRED: 40,
|
|
154
|
+
WS_CLOSED_SUCCESS: 1000
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
function isReadableStream(obj) {
|
|
158
|
+
return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function isBuffer(obj) {
|
|
162
|
+
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
163
|
+
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
164
|
+
obj.constructor.isBuffer(obj);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function isFileWebAPI(uri) {
|
|
168
|
+
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function isOwnUser(user) {
|
|
172
|
+
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function isBlobWebAPI(uri) {
|
|
176
|
+
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function isOwnUserBaseProperty(property) {
|
|
180
|
+
var ownUserBaseProperties = {
|
|
181
|
+
channel_mutes: true,
|
|
182
|
+
devices: true,
|
|
183
|
+
mutes: true,
|
|
184
|
+
total_unread_count: true,
|
|
185
|
+
unread_channels: true,
|
|
186
|
+
unread_count: true,
|
|
187
|
+
invisible: true,
|
|
188
|
+
roles: true
|
|
189
|
+
};
|
|
190
|
+
return ownUserBaseProperties[property];
|
|
191
|
+
}
|
|
192
|
+
function addFileToFormData(uri, name, contentType) {
|
|
193
|
+
var data = new FormData__default['default']();
|
|
194
|
+
|
|
195
|
+
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
196
|
+
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
197
|
+
} else {
|
|
198
|
+
data.append('file', {
|
|
199
|
+
uri: uri,
|
|
200
|
+
name: name || uri.split('/').reverse()[0],
|
|
201
|
+
contentType: contentType || undefined,
|
|
202
|
+
type: contentType || undefined
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return data;
|
|
207
|
+
}
|
|
208
|
+
function normalizeQuerySort(sort) {
|
|
209
|
+
var sortFields = [];
|
|
210
|
+
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
211
|
+
|
|
212
|
+
var _iterator = _createForOfIteratorHelper$4(sortArr),
|
|
213
|
+
_step;
|
|
214
|
+
|
|
215
|
+
try {
|
|
216
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
217
|
+
var item = _step.value;
|
|
218
|
+
var entries = Object.entries(item);
|
|
219
|
+
|
|
220
|
+
if (entries.length > 1) {
|
|
221
|
+
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
225
|
+
var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
|
|
226
|
+
field = _entries$_i[0],
|
|
227
|
+
direction = _entries$_i[1];
|
|
228
|
+
|
|
229
|
+
sortFields.push({
|
|
230
|
+
field: field,
|
|
231
|
+
direction: direction
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
} catch (err) {
|
|
236
|
+
_iterator.e(err);
|
|
237
|
+
} finally {
|
|
238
|
+
_iterator.f();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return sortFields;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* retryInterval - A retry interval which increases acc to number of failures
|
|
245
|
+
*
|
|
246
|
+
* @return {number} Duration to wait in milliseconds
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
function retryInterval(numberOfFailures) {
|
|
250
|
+
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
251
|
+
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
252
|
+
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
253
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
254
|
+
}
|
|
255
|
+
function randomId() {
|
|
256
|
+
return generateUUIDv4();
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function hex(bytes) {
|
|
260
|
+
var s = '';
|
|
261
|
+
|
|
262
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
263
|
+
s += bytes[i].toString(16).padStart(2, '0');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return s;
|
|
267
|
+
} // https://tools.ietf.org/html/rfc4122
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
function generateUUIDv4() {
|
|
271
|
+
var bytes = getRandomBytes(16);
|
|
272
|
+
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
273
|
+
|
|
274
|
+
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
275
|
+
|
|
276
|
+
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function getRandomValuesWithMathRandom(bytes) {
|
|
280
|
+
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
281
|
+
|
|
282
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
283
|
+
bytes[i] = Math.random() * max;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
var getRandomValues = function () {
|
|
288
|
+
var _crypto;
|
|
289
|
+
|
|
290
|
+
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
291
|
+
return crypto.getRandomValues.bind(crypto);
|
|
292
|
+
} else if (typeof msCrypto !== 'undefined') {
|
|
293
|
+
return msCrypto.getRandomValues.bind(msCrypto);
|
|
294
|
+
} else {
|
|
295
|
+
return getRandomValuesWithMathRandom;
|
|
296
|
+
}
|
|
297
|
+
}();
|
|
298
|
+
|
|
299
|
+
function getRandomBytes(length) {
|
|
300
|
+
var bytes = new Uint8Array(length);
|
|
301
|
+
getRandomValues(bytes);
|
|
302
|
+
return bytes;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function convertErrorToJson(err) {
|
|
306
|
+
var jsonObj = {};
|
|
307
|
+
if (!err) return jsonObj;
|
|
308
|
+
|
|
309
|
+
try {
|
|
310
|
+
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
311
|
+
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
312
|
+
});
|
|
313
|
+
} catch (_) {
|
|
314
|
+
return {
|
|
315
|
+
error: 'failed to serialize the error'
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return jsonObj;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* isOnline safely return the navigator.online value for browser env
|
|
323
|
+
* if navigator is not in global object, it always return true
|
|
324
|
+
*/
|
|
325
|
+
|
|
326
|
+
function isOnline() {
|
|
327
|
+
var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
|
|
328
|
+
|
|
329
|
+
if (!nav) {
|
|
330
|
+
console.warn('isOnline failed to access window.navigator and assume browser is online');
|
|
331
|
+
return true;
|
|
332
|
+
} // RN navigator has undefined for onLine
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
if (typeof nav.onLine !== 'boolean') {
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return nav.onLine;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
function addConnectionEventListeners(cb) {
|
|
346
|
+
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
347
|
+
window.addEventListener('offline', cb);
|
|
348
|
+
window.addEventListener('online', cb);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function removeConnectionEventListeners(cb) {
|
|
352
|
+
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
353
|
+
window.removeEventListener('offline', cb);
|
|
354
|
+
window.removeEventListener('online', cb);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
358
|
+
var newParams = [];
|
|
359
|
+
|
|
360
|
+
for (var k in params) {
|
|
361
|
+
// Stream backend doesn't treat "undefined" value same as value not being present.
|
|
362
|
+
// So, we need to skip the undefined values.
|
|
363
|
+
if (params[k] === undefined) continue;
|
|
364
|
+
|
|
365
|
+
if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
|
|
366
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
|
|
367
|
+
} else {
|
|
368
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return newParams.join('&');
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
376
|
+
* and sets the status to received if missing. Returns a message object
|
|
377
|
+
*
|
|
378
|
+
* @param {MessageResponse<StreamChatGenerics>} message a message object
|
|
379
|
+
*
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
function formatMessage(message) {
|
|
383
|
+
return _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
384
|
+
/**
|
|
385
|
+
* @deprecated please use `html`
|
|
386
|
+
*/
|
|
387
|
+
__html: message.html,
|
|
388
|
+
// parse the date..
|
|
389
|
+
pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
|
|
390
|
+
created_at: message.created_at ? new Date(message.created_at) : new Date(),
|
|
391
|
+
updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
|
|
392
|
+
status: message.status || 'received'
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function addToMessageList(messages, message) {
|
|
396
|
+
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
397
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
398
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
399
|
+
var addMessageToList = addIfDoesNotExist || timestampChanged;
|
|
400
|
+
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
401
|
+
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
402
|
+
|
|
403
|
+
if (timestampChanged) {
|
|
404
|
+
messageArr = messageArr.filter(function (msg) {
|
|
405
|
+
return !(msg.id && message.id === msg.id);
|
|
406
|
+
});
|
|
407
|
+
} // Get array length after filtering
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
411
|
+
|
|
412
|
+
if (messageArrayLength === 0 && addMessageToList) {
|
|
413
|
+
return messageArr.concat(message);
|
|
414
|
+
} else if (messageArrayLength === 0) {
|
|
415
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
var messageTime = message[sortBy].getTime();
|
|
419
|
+
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
420
|
+
|
|
421
|
+
if (messageIsNewest && addMessageToList) {
|
|
422
|
+
return messageArr.concat(message);
|
|
423
|
+
} else if (messageIsNewest) {
|
|
424
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
425
|
+
} // find the closest index to push the new message
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
var left = 0;
|
|
429
|
+
var middle = 0;
|
|
430
|
+
var right = messageArrayLength - 1;
|
|
431
|
+
|
|
432
|
+
while (left <= right) {
|
|
433
|
+
middle = Math.floor((right + left) / 2);
|
|
434
|
+
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
435
|
+
} // message already exists and not filtered due to timestampChanged, update and return
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
if (!timestampChanged && message.id) {
|
|
439
|
+
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
440
|
+
messageArr[left] = message;
|
|
441
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
445
|
+
messageArr[left - 1] = message;
|
|
446
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
447
|
+
}
|
|
448
|
+
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
449
|
+
// or have a timestamp change.
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
if (addMessageToList) {
|
|
453
|
+
messageArr.splice(left, 0, message);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
460
|
+
|
|
461
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
124
462
|
|
|
125
463
|
/**
|
|
126
464
|
* ChannelState - A container class for the channel state.
|
|
@@ -197,7 +535,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
197
535
|
var m = messages[i];
|
|
198
536
|
|
|
199
537
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
200
|
-
messages[i] = _objectSpread$
|
|
538
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
201
539
|
user: user
|
|
202
540
|
});
|
|
203
541
|
}
|
|
@@ -252,7 +590,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
252
590
|
user: m.user
|
|
253
591
|
};
|
|
254
592
|
} else {
|
|
255
|
-
messages[i] = _objectSpread$
|
|
593
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
256
594
|
type: 'deleted',
|
|
257
595
|
deleted_at: user.deleted_at
|
|
258
596
|
});
|
|
@@ -359,7 +697,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
359
697
|
}, {
|
|
360
698
|
key: "formatMessage",
|
|
361
699
|
value: function formatMessage(message) {
|
|
362
|
-
return _objectSpread$
|
|
700
|
+
return _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
363
701
|
/**
|
|
364
702
|
* @deprecated please use `html`
|
|
365
703
|
*/
|
|
@@ -577,7 +915,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
577
915
|
var parseMessage = function parseMessage(m) {
|
|
578
916
|
var _m$pinned_at, _m$updated_at;
|
|
579
917
|
|
|
580
|
-
return _objectSpread$
|
|
918
|
+
return _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
581
919
|
created_at: m.created_at.toISOString(),
|
|
582
920
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
583
921
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -588,8 +926,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
588
926
|
var updatedMessages = set.messages.filter(function (msg) {
|
|
589
927
|
return msg.quoted_message_id === message.id;
|
|
590
928
|
}).map(parseMessage).map(function (msg) {
|
|
591
|
-
return _objectSpread$
|
|
592
|
-
quoted_message: _objectSpread$
|
|
929
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
930
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
593
931
|
attachments: []
|
|
594
932
|
})
|
|
595
933
|
});
|
|
@@ -670,66 +1008,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
670
1008
|
*/
|
|
671
1009
|
function _addToMessageList(messages, message) {
|
|
672
1010
|
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
673
|
-
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
674
|
-
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
675
|
-
|
|
676
|
-
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
677
|
-
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
678
|
-
|
|
679
|
-
if (timestampChanged) {
|
|
680
|
-
messageArr = messageArr.filter(function (msg) {
|
|
681
|
-
return !(msg.id && message.id === msg.id);
|
|
682
|
-
});
|
|
683
|
-
} // Get array length after filtering
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
687
|
-
|
|
688
|
-
if (messageArrayLength === 0 && addMessageToList) {
|
|
689
|
-
return messageArr.concat(message);
|
|
690
|
-
} else if (messageArrayLength === 0) {
|
|
691
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
var messageTime = message[sortBy].getTime();
|
|
695
|
-
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
696
|
-
|
|
697
|
-
if (messageIsNewest && addMessageToList) {
|
|
698
|
-
return messageArr.concat(message);
|
|
699
|
-
} else if (messageIsNewest) {
|
|
700
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
701
|
-
} // find the closest index to push the new message
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
var left = 0;
|
|
705
|
-
var middle = 0;
|
|
706
|
-
var right = messageArrayLength - 1;
|
|
707
|
-
|
|
708
|
-
while (left <= right) {
|
|
709
|
-
middle = Math.floor((right + left) / 2);
|
|
710
|
-
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
711
|
-
} // message already exists and not filtered due to timestampChanged, update and return
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
if (!timestampChanged && message.id) {
|
|
715
|
-
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
716
|
-
messageArr[left] = message;
|
|
717
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
721
|
-
messageArr[left - 1] = message;
|
|
722
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
723
|
-
}
|
|
724
|
-
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
725
|
-
// or have a timestamp change.
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
if (addMessageToList) {
|
|
729
|
-
messageArr.splice(left, 0, message);
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
1011
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
1012
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
1013
|
+
return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
|
|
733
1014
|
}
|
|
734
1015
|
/**
|
|
735
1016
|
* removeMessage - Description
|
|
@@ -1041,328 +1322,78 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1041
1322
|
isLatest: false
|
|
1042
1323
|
});
|
|
1043
1324
|
targetMessageSetIndex = this.messageSets.length - 1;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
break;
|
|
1047
|
-
|
|
1048
|
-
case 'current':
|
|
1049
|
-
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1050
|
-
return s.isCurrent;
|
|
1051
|
-
});
|
|
1052
|
-
break;
|
|
1053
|
-
|
|
1054
|
-
case 'latest':
|
|
1055
|
-
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1056
|
-
return s.isLatest;
|
|
1057
|
-
});
|
|
1058
|
-
break;
|
|
1059
|
-
|
|
1060
|
-
default:
|
|
1061
|
-
targetMessageSetIndex = -1;
|
|
1062
|
-
} // when merging the target set will be the first one from the overlapping message sets
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1066
|
-
|
|
1067
|
-
var mergeSourceMessageSetIndices = _toConsumableArray__default['default'](overlappingMessageSetIndices);
|
|
1068
|
-
|
|
1069
|
-
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1070
|
-
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1071
|
-
} // merge message sets
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1075
|
-
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1076
|
-
var sources = this.messageSets.filter(function (_, i) {
|
|
1077
|
-
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1078
|
-
});
|
|
1079
|
-
sources.forEach(function (messageSet) {
|
|
1080
|
-
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1081
|
-
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1082
|
-
messagesToAdd = [].concat(_toConsumableArray__default['default'](messagesToAdd), _toConsumableArray__default['default'](messageSet.messages));
|
|
1083
|
-
});
|
|
1084
|
-
sources.forEach(function (s) {
|
|
1085
|
-
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1086
|
-
});
|
|
1087
|
-
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1088
|
-
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1089
|
-
});
|
|
1090
|
-
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1091
|
-
}
|
|
1092
|
-
} else {
|
|
1093
|
-
// assumes that all new messages belong to the same set
|
|
1094
|
-
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
return {
|
|
1098
|
-
targetMessageSetIndex: targetMessageSetIndex,
|
|
1099
|
-
messagesToAdd: messagesToAdd
|
|
1100
|
-
};
|
|
1101
|
-
}
|
|
1102
|
-
}]);
|
|
1103
|
-
|
|
1104
|
-
return ChannelState;
|
|
1105
|
-
}();
|
|
1106
|
-
|
|
1107
|
-
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1108
|
-
|
|
1109
|
-
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1110
|
-
|
|
1111
|
-
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1112
|
-
|
|
1113
|
-
/**
|
|
1114
|
-
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
1115
|
-
* use this when you want to run the promise and handle errors by logging a warning
|
|
1116
|
-
*
|
|
1117
|
-
* @param {Promise<T>} promise The promise you want to run and log
|
|
1118
|
-
* @param {string} name A descriptive name of what the promise does for log output
|
|
1119
|
-
*
|
|
1120
|
-
*/
|
|
1121
|
-
function logChatPromiseExecution(promise, name) {
|
|
1122
|
-
promise.then().catch(function (error) {
|
|
1123
|
-
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
|
-
var sleep = function sleep(m) {
|
|
1127
|
-
return new Promise(function (r) {
|
|
1128
|
-
return setTimeout(r, m);
|
|
1129
|
-
});
|
|
1130
|
-
};
|
|
1131
|
-
function isFunction(value) {
|
|
1132
|
-
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
1133
|
-
}
|
|
1134
|
-
var chatCodes = {
|
|
1135
|
-
TOKEN_EXPIRED: 40,
|
|
1136
|
-
WS_CLOSED_SUCCESS: 1000
|
|
1137
|
-
};
|
|
1138
|
-
|
|
1139
|
-
function isReadableStream(obj) {
|
|
1140
|
-
return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
function isBuffer(obj) {
|
|
1144
|
-
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
1145
|
-
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
1146
|
-
obj.constructor.isBuffer(obj);
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
function isFileWebAPI(uri) {
|
|
1150
|
-
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
function isOwnUser(user) {
|
|
1154
|
-
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
function isBlobWebAPI(uri) {
|
|
1158
|
-
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
function isOwnUserBaseProperty(property) {
|
|
1162
|
-
var ownUserBaseProperties = {
|
|
1163
|
-
channel_mutes: true,
|
|
1164
|
-
devices: true,
|
|
1165
|
-
mutes: true,
|
|
1166
|
-
total_unread_count: true,
|
|
1167
|
-
unread_channels: true,
|
|
1168
|
-
unread_count: true,
|
|
1169
|
-
invisible: true,
|
|
1170
|
-
roles: true
|
|
1171
|
-
};
|
|
1172
|
-
return ownUserBaseProperties[property];
|
|
1173
|
-
}
|
|
1174
|
-
function addFileToFormData(uri, name, contentType) {
|
|
1175
|
-
var data = new FormData__default['default']();
|
|
1176
|
-
|
|
1177
|
-
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
1178
|
-
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
1179
|
-
} else {
|
|
1180
|
-
data.append('file', {
|
|
1181
|
-
uri: uri,
|
|
1182
|
-
name: name || uri.split('/').reverse()[0],
|
|
1183
|
-
contentType: contentType || undefined,
|
|
1184
|
-
type: contentType || undefined
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
return data;
|
|
1189
|
-
}
|
|
1190
|
-
function normalizeQuerySort(sort) {
|
|
1191
|
-
var sortFields = [];
|
|
1192
|
-
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
1193
|
-
|
|
1194
|
-
var _iterator = _createForOfIteratorHelper$3(sortArr),
|
|
1195
|
-
_step;
|
|
1196
|
-
|
|
1197
|
-
try {
|
|
1198
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1199
|
-
var item = _step.value;
|
|
1200
|
-
var entries = Object.entries(item);
|
|
1201
|
-
|
|
1202
|
-
if (entries.length > 1) {
|
|
1203
|
-
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
1207
|
-
var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
|
|
1208
|
-
field = _entries$_i[0],
|
|
1209
|
-
direction = _entries$_i[1];
|
|
1210
|
-
|
|
1211
|
-
sortFields.push({
|
|
1212
|
-
field: field,
|
|
1213
|
-
direction: direction
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
} catch (err) {
|
|
1218
|
-
_iterator.e(err);
|
|
1219
|
-
} finally {
|
|
1220
|
-
_iterator.f();
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
return sortFields;
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* retryInterval - A retry interval which increases acc to number of failures
|
|
1227
|
-
*
|
|
1228
|
-
* @return {number} Duration to wait in milliseconds
|
|
1229
|
-
*/
|
|
1230
|
-
|
|
1231
|
-
function retryInterval(numberOfFailures) {
|
|
1232
|
-
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
1233
|
-
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
1234
|
-
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
1235
|
-
return Math.floor(Math.random() * (max - min) + min);
|
|
1236
|
-
}
|
|
1237
|
-
function randomId() {
|
|
1238
|
-
return generateUUIDv4();
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
function hex(bytes) {
|
|
1242
|
-
var s = '';
|
|
1243
|
-
|
|
1244
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1245
|
-
s += bytes[i].toString(16).padStart(2, '0');
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
return s;
|
|
1249
|
-
} // https://tools.ietf.org/html/rfc4122
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
function generateUUIDv4() {
|
|
1253
|
-
var bytes = getRandomBytes(16);
|
|
1254
|
-
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
1255
|
-
|
|
1256
|
-
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
1257
|
-
|
|
1258
|
-
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
function getRandomValuesWithMathRandom(bytes) {
|
|
1262
|
-
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
1263
|
-
|
|
1264
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1265
|
-
bytes[i] = Math.random() * max;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
var getRandomValues = function () {
|
|
1270
|
-
var _crypto;
|
|
1271
|
-
|
|
1272
|
-
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
1273
|
-
return crypto.getRandomValues.bind(crypto);
|
|
1274
|
-
} else if (typeof msCrypto !== 'undefined') {
|
|
1275
|
-
return msCrypto.getRandomValues.bind(msCrypto);
|
|
1276
|
-
} else {
|
|
1277
|
-
return getRandomValuesWithMathRandom;
|
|
1278
|
-
}
|
|
1279
|
-
}();
|
|
1280
|
-
|
|
1281
|
-
function getRandomBytes(length) {
|
|
1282
|
-
var bytes = new Uint8Array(length);
|
|
1283
|
-
getRandomValues(bytes);
|
|
1284
|
-
return bytes;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
function convertErrorToJson(err) {
|
|
1288
|
-
var jsonObj = {};
|
|
1289
|
-
if (!err) return jsonObj;
|
|
1290
|
-
|
|
1291
|
-
try {
|
|
1292
|
-
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
1293
|
-
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
1294
|
-
});
|
|
1295
|
-
} catch (_) {
|
|
1296
|
-
return {
|
|
1297
|
-
error: 'failed to serialize the error'
|
|
1298
|
-
};
|
|
1299
|
-
}
|
|
1325
|
+
}
|
|
1300
1326
|
|
|
1301
|
-
|
|
1302
|
-
}
|
|
1303
|
-
/**
|
|
1304
|
-
* isOnline safely return the navigator.online value for browser env
|
|
1305
|
-
* if navigator is not in global object, it always return true
|
|
1306
|
-
*/
|
|
1327
|
+
break;
|
|
1307
1328
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1329
|
+
case 'current':
|
|
1330
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1331
|
+
return s.isCurrent;
|
|
1332
|
+
});
|
|
1333
|
+
break;
|
|
1310
1334
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1335
|
+
case 'latest':
|
|
1336
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1337
|
+
return s.isLatest;
|
|
1338
|
+
});
|
|
1339
|
+
break;
|
|
1315
1340
|
|
|
1341
|
+
default:
|
|
1342
|
+
targetMessageSetIndex = -1;
|
|
1343
|
+
} // when merging the target set will be the first one from the overlapping message sets
|
|
1316
1344
|
|
|
1317
|
-
if (typeof nav.onLine !== 'boolean') {
|
|
1318
|
-
return true;
|
|
1319
|
-
}
|
|
1320
1345
|
|
|
1321
|
-
|
|
1322
|
-
}
|
|
1323
|
-
/**
|
|
1324
|
-
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
1325
|
-
*/
|
|
1346
|
+
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1326
1347
|
|
|
1327
|
-
|
|
1328
|
-
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
1329
|
-
window.addEventListener('offline', cb);
|
|
1330
|
-
window.addEventListener('online', cb);
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
function removeConnectionEventListeners(cb) {
|
|
1334
|
-
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
1335
|
-
window.removeEventListener('offline', cb);
|
|
1336
|
-
window.removeEventListener('online', cb);
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
1340
|
-
var newParams = [];
|
|
1348
|
+
var mergeSourceMessageSetIndices = _toConsumableArray__default['default'](overlappingMessageSetIndices);
|
|
1341
1349
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
if (params[k] === undefined) continue;
|
|
1350
|
+
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1351
|
+
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1352
|
+
} // merge message sets
|
|
1346
1353
|
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1354
|
+
|
|
1355
|
+
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1356
|
+
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1357
|
+
var sources = this.messageSets.filter(function (_, i) {
|
|
1358
|
+
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1359
|
+
});
|
|
1360
|
+
sources.forEach(function (messageSet) {
|
|
1361
|
+
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1362
|
+
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1363
|
+
messagesToAdd = [].concat(_toConsumableArray__default['default'](messagesToAdd), _toConsumableArray__default['default'](messageSet.messages));
|
|
1364
|
+
});
|
|
1365
|
+
sources.forEach(function (s) {
|
|
1366
|
+
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1367
|
+
});
|
|
1368
|
+
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1369
|
+
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1370
|
+
});
|
|
1371
|
+
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1372
|
+
}
|
|
1373
|
+
} else {
|
|
1374
|
+
// assumes that all new messages belong to the same set
|
|
1375
|
+
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
return {
|
|
1379
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1380
|
+
messagesToAdd: messagesToAdd
|
|
1381
|
+
};
|
|
1351
1382
|
}
|
|
1352
|
-
}
|
|
1383
|
+
}]);
|
|
1353
1384
|
|
|
1354
|
-
return
|
|
1355
|
-
};
|
|
1385
|
+
return ChannelState;
|
|
1386
|
+
}();
|
|
1356
1387
|
|
|
1357
|
-
function _createForOfIteratorHelper$
|
|
1388
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1358
1389
|
|
|
1359
|
-
function _unsupportedIterableToArray$
|
|
1390
|
+
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1360
1391
|
|
|
1361
|
-
function _arrayLikeToArray$
|
|
1392
|
+
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1362
1393
|
|
|
1363
|
-
function ownKeys$
|
|
1394
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1364
1395
|
|
|
1365
|
-
function _objectSpread$
|
|
1396
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1366
1397
|
|
|
1367
1398
|
/**
|
|
1368
1399
|
* Channel - The Channel class manages it's own state.
|
|
@@ -1435,7 +1466,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1435
1466
|
while (1) {
|
|
1436
1467
|
switch (_context.prev = _context.next) {
|
|
1437
1468
|
case 0:
|
|
1438
|
-
defaultOptions = _objectSpread$
|
|
1469
|
+
defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
1439
1470
|
watch: false,
|
|
1440
1471
|
state: false,
|
|
1441
1472
|
presence: false
|
|
@@ -1507,7 +1538,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1507
1538
|
|
|
1508
1539
|
this.data = data; // this._data is used for the requests...
|
|
1509
1540
|
|
|
1510
|
-
this._data = _objectSpread$
|
|
1541
|
+
this._data = _objectSpread$6({}, data);
|
|
1511
1542
|
this.cid = "".concat(type, ":").concat(id);
|
|
1512
1543
|
this.listeners = {}; // perhaps the state variable should be private
|
|
1513
1544
|
|
|
@@ -1564,23 +1595,19 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1564
1595
|
key: "sendMessage",
|
|
1565
1596
|
value: function () {
|
|
1566
1597
|
var _sendMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(message, options) {
|
|
1567
|
-
var sendMessageResponse;
|
|
1568
1598
|
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
1569
1599
|
while (1) {
|
|
1570
1600
|
switch (_context2.prev = _context2.next) {
|
|
1571
1601
|
case 0:
|
|
1572
1602
|
_context2.next = 2;
|
|
1573
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
1603
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
|
|
1574
1604
|
message: message
|
|
1575
1605
|
}, options));
|
|
1576
1606
|
|
|
1577
1607
|
case 2:
|
|
1578
|
-
|
|
1579
|
-
// Reset unreadCount to 0.
|
|
1580
|
-
this.state.unreadCount = 0;
|
|
1581
|
-
return _context2.abrupt("return", sendMessageResponse);
|
|
1608
|
+
return _context2.abrupt("return", _context2.sent);
|
|
1582
1609
|
|
|
1583
|
-
case
|
|
1610
|
+
case 3:
|
|
1584
1611
|
case "end":
|
|
1585
1612
|
return _context2.stop();
|
|
1586
1613
|
}
|
|
@@ -1689,7 +1716,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1689
1716
|
|
|
1690
1717
|
case 3:
|
|
1691
1718
|
// Return a list of channels
|
|
1692
|
-
payload = _objectSpread$
|
|
1719
|
+
payload = _objectSpread$6(_objectSpread$6({
|
|
1693
1720
|
filter_conditions: {
|
|
1694
1721
|
cid: this.cid
|
|
1695
1722
|
}
|
|
@@ -1786,7 +1813,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1786
1813
|
|
|
1787
1814
|
_context5.next = 6;
|
|
1788
1815
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
1789
|
-
payload: _objectSpread$
|
|
1816
|
+
payload: _objectSpread$6({
|
|
1790
1817
|
type: type,
|
|
1791
1818
|
id: id,
|
|
1792
1819
|
members: members,
|
|
@@ -1847,7 +1874,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1847
1874
|
|
|
1848
1875
|
case 4:
|
|
1849
1876
|
_context6.next = 6;
|
|
1850
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$
|
|
1877
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
|
|
1851
1878
|
reaction: reaction
|
|
1852
1879
|
}, options));
|
|
1853
1880
|
|
|
@@ -1928,7 +1955,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1928
1955
|
delete channelData[key];
|
|
1929
1956
|
});
|
|
1930
1957
|
_context7.next = 7;
|
|
1931
|
-
return this._update(_objectSpread$
|
|
1958
|
+
return this._update(_objectSpread$6({
|
|
1932
1959
|
message: updateMessage,
|
|
1933
1960
|
data: channelData
|
|
1934
1961
|
}, options));
|
|
@@ -2088,7 +2115,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2088
2115
|
case 0:
|
|
2089
2116
|
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
2090
2117
|
_context11.next = 3;
|
|
2091
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2118
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
|
|
2092
2119
|
|
|
2093
2120
|
case 3:
|
|
2094
2121
|
return _context11.abrupt("return", _context11.sent);
|
|
@@ -2164,7 +2191,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2164
2191
|
case 0:
|
|
2165
2192
|
options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
2166
2193
|
_context13.next = 3;
|
|
2167
|
-
return this._update(_objectSpread$
|
|
2194
|
+
return this._update(_objectSpread$6({
|
|
2168
2195
|
accept_invite: true
|
|
2169
2196
|
}, options));
|
|
2170
2197
|
|
|
@@ -2205,7 +2232,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2205
2232
|
case 0:
|
|
2206
2233
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2207
2234
|
_context14.next = 3;
|
|
2208
|
-
return this._update(_objectSpread$
|
|
2235
|
+
return this._update(_objectSpread$6({
|
|
2209
2236
|
reject_invite: true
|
|
2210
2237
|
}, options));
|
|
2211
2238
|
|
|
@@ -2247,7 +2274,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2247
2274
|
case 0:
|
|
2248
2275
|
options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
2249
2276
|
_context15.next = 3;
|
|
2250
|
-
return this._update(_objectSpread$
|
|
2277
|
+
return this._update(_objectSpread$6({
|
|
2251
2278
|
add_members: members,
|
|
2252
2279
|
message: message
|
|
2253
2280
|
}, options));
|
|
@@ -2290,7 +2317,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2290
2317
|
case 0:
|
|
2291
2318
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2292
2319
|
_context16.next = 3;
|
|
2293
|
-
return this._update(_objectSpread$
|
|
2320
|
+
return this._update(_objectSpread$6({
|
|
2294
2321
|
add_moderators: members,
|
|
2295
2322
|
message: message
|
|
2296
2323
|
}, options));
|
|
@@ -2333,7 +2360,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2333
2360
|
case 0:
|
|
2334
2361
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2335
2362
|
_context17.next = 3;
|
|
2336
|
-
return this._update(_objectSpread$
|
|
2363
|
+
return this._update(_objectSpread$6({
|
|
2337
2364
|
assign_roles: roles,
|
|
2338
2365
|
message: message
|
|
2339
2366
|
}, options));
|
|
@@ -2376,7 +2403,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2376
2403
|
case 0:
|
|
2377
2404
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2378
2405
|
_context18.next = 3;
|
|
2379
|
-
return this._update(_objectSpread$
|
|
2406
|
+
return this._update(_objectSpread$6({
|
|
2380
2407
|
invites: members,
|
|
2381
2408
|
message: message
|
|
2382
2409
|
}, options));
|
|
@@ -2419,7 +2446,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2419
2446
|
case 0:
|
|
2420
2447
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2421
2448
|
_context19.next = 3;
|
|
2422
|
-
return this._update(_objectSpread$
|
|
2449
|
+
return this._update(_objectSpread$6({
|
|
2423
2450
|
remove_members: members,
|
|
2424
2451
|
message: message
|
|
2425
2452
|
}, options));
|
|
@@ -2462,7 +2489,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2462
2489
|
case 0:
|
|
2463
2490
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
2464
2491
|
_context20.next = 3;
|
|
2465
|
-
return this._update(_objectSpread$
|
|
2492
|
+
return this._update(_objectSpread$6({
|
|
2466
2493
|
demote_moderators: members,
|
|
2467
2494
|
message: message
|
|
2468
2495
|
}, options));
|
|
@@ -2547,7 +2574,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2547
2574
|
case 0:
|
|
2548
2575
|
opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
2549
2576
|
_context22.next = 3;
|
|
2550
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
2577
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
|
|
2551
2578
|
channel_cid: this.cid
|
|
2552
2579
|
}, opts));
|
|
2553
2580
|
|
|
@@ -2589,7 +2616,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2589
2616
|
case 0:
|
|
2590
2617
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
2591
2618
|
_context23.next = 3;
|
|
2592
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
2619
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
|
|
2593
2620
|
channel_cid: this.cid
|
|
2594
2621
|
}, opts));
|
|
2595
2622
|
|
|
@@ -2648,7 +2675,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2648
2675
|
}, {
|
|
2649
2676
|
key: "keystroke",
|
|
2650
2677
|
value: function () {
|
|
2651
|
-
var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id) {
|
|
2678
|
+
var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
|
|
2652
2679
|
var _this$getConfig;
|
|
2653
2680
|
|
|
2654
2681
|
var now, diff;
|
|
@@ -2676,10 +2703,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2676
2703
|
|
|
2677
2704
|
this.lastTypingEvent = new Date();
|
|
2678
2705
|
_context24.next = 10;
|
|
2679
|
-
return this.sendEvent({
|
|
2706
|
+
return this.sendEvent(_objectSpread$6({
|
|
2680
2707
|
type: 'typing.start',
|
|
2681
2708
|
parent_id: parent_id
|
|
2682
|
-
});
|
|
2709
|
+
}, options || {}));
|
|
2683
2710
|
|
|
2684
2711
|
case 10:
|
|
2685
2712
|
case "end":
|
|
@@ -2689,7 +2716,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2689
2716
|
}, _callee24, this);
|
|
2690
2717
|
}));
|
|
2691
2718
|
|
|
2692
|
-
function keystroke(_x25) {
|
|
2719
|
+
function keystroke(_x25, _x26) {
|
|
2693
2720
|
return _keystroke.apply(this, arguments);
|
|
2694
2721
|
}
|
|
2695
2722
|
|
|
@@ -2704,7 +2731,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2704
2731
|
}, {
|
|
2705
2732
|
key: "stopTyping",
|
|
2706
2733
|
value: function () {
|
|
2707
|
-
var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id) {
|
|
2734
|
+
var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
|
|
2708
2735
|
var _this$getConfig2;
|
|
2709
2736
|
|
|
2710
2737
|
return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
|
|
@@ -2722,10 +2749,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2722
2749
|
this.lastTypingEvent = null;
|
|
2723
2750
|
this.isTyping = false;
|
|
2724
2751
|
_context25.next = 6;
|
|
2725
|
-
return this.sendEvent({
|
|
2752
|
+
return this.sendEvent(_objectSpread$6({
|
|
2726
2753
|
type: 'typing.stop',
|
|
2727
2754
|
parent_id: parent_id
|
|
2728
|
-
});
|
|
2755
|
+
}, options || {}));
|
|
2729
2756
|
|
|
2730
2757
|
case 6:
|
|
2731
2758
|
case "end":
|
|
@@ -2735,7 +2762,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2735
2762
|
}, _callee25, this);
|
|
2736
2763
|
}));
|
|
2737
2764
|
|
|
2738
|
-
function stopTyping(
|
|
2765
|
+
function stopTyping(_x27, _x28) {
|
|
2739
2766
|
return _stopTyping.apply(this, arguments);
|
|
2740
2767
|
}
|
|
2741
2768
|
|
|
@@ -2798,7 +2825,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2798
2825
|
|
|
2799
2826
|
case 4:
|
|
2800
2827
|
_context26.next = 6;
|
|
2801
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
2828
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
|
|
2802
2829
|
|
|
2803
2830
|
case 6:
|
|
2804
2831
|
return _context26.abrupt("return", _context26.sent);
|
|
@@ -2845,7 +2872,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2845
2872
|
|
|
2846
2873
|
case 3:
|
|
2847
2874
|
_context27.next = 5;
|
|
2848
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
2875
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
|
|
2849
2876
|
|
|
2850
2877
|
case 5:
|
|
2851
2878
|
return _context27.abrupt("return", _context27.sent);
|
|
@@ -2858,7 +2885,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2858
2885
|
}, _callee27, this);
|
|
2859
2886
|
}));
|
|
2860
2887
|
|
|
2861
|
-
function markUnread(
|
|
2888
|
+
function markUnread(_x29) {
|
|
2862
2889
|
return _markUnread.apply(this, arguments);
|
|
2863
2890
|
}
|
|
2864
2891
|
|
|
@@ -2913,7 +2940,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2913
2940
|
defaultOptions.watch = false;
|
|
2914
2941
|
}
|
|
2915
2942
|
|
|
2916
|
-
combined = _objectSpread$
|
|
2943
|
+
combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
|
|
2917
2944
|
_context28.next = 7;
|
|
2918
2945
|
return this.query(combined, 'latest');
|
|
2919
2946
|
|
|
@@ -2937,7 +2964,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2937
2964
|
}, _callee28, this);
|
|
2938
2965
|
}));
|
|
2939
2966
|
|
|
2940
|
-
function watch(
|
|
2967
|
+
function watch(_x30) {
|
|
2941
2968
|
return _watch.apply(this, arguments);
|
|
2942
2969
|
}
|
|
2943
2970
|
|
|
@@ -3004,7 +3031,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3004
3031
|
switch (_context30.prev = _context30.next) {
|
|
3005
3032
|
case 0:
|
|
3006
3033
|
_context30.next = 2;
|
|
3007
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$
|
|
3034
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
|
|
3008
3035
|
|
|
3009
3036
|
case 2:
|
|
3010
3037
|
data = _context30.sent;
|
|
@@ -3024,7 +3051,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3024
3051
|
}, _callee30, this);
|
|
3025
3052
|
}));
|
|
3026
3053
|
|
|
3027
|
-
function getReplies(
|
|
3054
|
+
function getReplies(_x31, _x32) {
|
|
3028
3055
|
return _getReplies.apply(this, arguments);
|
|
3029
3056
|
}
|
|
3030
3057
|
|
|
@@ -3052,7 +3079,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3052
3079
|
sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
|
|
3053
3080
|
_context31.next = 3;
|
|
3054
3081
|
return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
|
|
3055
|
-
payload: _objectSpread$
|
|
3082
|
+
payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3056
3083
|
sort: normalizeQuerySort(sort)
|
|
3057
3084
|
})
|
|
3058
3085
|
});
|
|
@@ -3068,7 +3095,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3068
3095
|
}, _callee31, this);
|
|
3069
3096
|
}));
|
|
3070
3097
|
|
|
3071
|
-
function getPinnedMessages(
|
|
3098
|
+
function getPinnedMessages(_x33) {
|
|
3072
3099
|
return _getPinnedMessages.apply(this, arguments);
|
|
3073
3100
|
}
|
|
3074
3101
|
|
|
@@ -3086,7 +3113,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3086
3113
|
}, {
|
|
3087
3114
|
key: "getReactions",
|
|
3088
3115
|
value: function getReactions(message_id, options) {
|
|
3089
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$
|
|
3116
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
|
|
3090
3117
|
}
|
|
3091
3118
|
/**
|
|
3092
3119
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -3233,7 +3260,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3233
3260
|
}
|
|
3234
3261
|
|
|
3235
3262
|
_context32.next = 7;
|
|
3236
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
3263
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$6({
|
|
3237
3264
|
data: this._data,
|
|
3238
3265
|
state: true
|
|
3239
3266
|
}, options));
|
|
@@ -3297,7 +3324,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3297
3324
|
}, _callee32, this);
|
|
3298
3325
|
}));
|
|
3299
3326
|
|
|
3300
|
-
function query(
|
|
3327
|
+
function query(_x34) {
|
|
3301
3328
|
return _query.apply(this, arguments);
|
|
3302
3329
|
}
|
|
3303
3330
|
|
|
@@ -3322,7 +3349,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3322
3349
|
this._checkInitialized();
|
|
3323
3350
|
|
|
3324
3351
|
_context33.next = 3;
|
|
3325
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
3352
|
+
return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3326
3353
|
type: this.type,
|
|
3327
3354
|
id: this.id
|
|
3328
3355
|
}));
|
|
@@ -3338,7 +3365,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3338
3365
|
}, _callee33, this);
|
|
3339
3366
|
}));
|
|
3340
3367
|
|
|
3341
|
-
function banUser(
|
|
3368
|
+
function banUser(_x35, _x36) {
|
|
3342
3369
|
return _banUser.apply(this, arguments);
|
|
3343
3370
|
}
|
|
3344
3371
|
|
|
@@ -3469,7 +3496,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3469
3496
|
}, _callee36, this);
|
|
3470
3497
|
}));
|
|
3471
3498
|
|
|
3472
|
-
function unbanUser(
|
|
3499
|
+
function unbanUser(_x37) {
|
|
3473
3500
|
return _unbanUser.apply(this, arguments);
|
|
3474
3501
|
}
|
|
3475
3502
|
|
|
@@ -3494,7 +3521,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3494
3521
|
this._checkInitialized();
|
|
3495
3522
|
|
|
3496
3523
|
_context37.next = 3;
|
|
3497
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
3524
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3498
3525
|
type: this.type,
|
|
3499
3526
|
id: this.id
|
|
3500
3527
|
}));
|
|
@@ -3510,7 +3537,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3510
3537
|
}, _callee37, this);
|
|
3511
3538
|
}));
|
|
3512
3539
|
|
|
3513
|
-
function shadowBan(
|
|
3540
|
+
function shadowBan(_x38, _x39) {
|
|
3514
3541
|
return _shadowBan.apply(this, arguments);
|
|
3515
3542
|
}
|
|
3516
3543
|
|
|
@@ -3550,7 +3577,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3550
3577
|
}, _callee38, this);
|
|
3551
3578
|
}));
|
|
3552
3579
|
|
|
3553
|
-
function removeShadowBan(
|
|
3580
|
+
function removeShadowBan(_x40) {
|
|
3554
3581
|
return _removeShadowBan.apply(this, arguments);
|
|
3555
3582
|
}
|
|
3556
3583
|
|
|
@@ -3585,7 +3612,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3585
3612
|
}, _callee39, this);
|
|
3586
3613
|
}));
|
|
3587
3614
|
|
|
3588
|
-
function createCall(
|
|
3615
|
+
function createCall(_x41) {
|
|
3589
3616
|
return _createCall.apply(this, arguments);
|
|
3590
3617
|
}
|
|
3591
3618
|
|
|
@@ -3661,7 +3688,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3661
3688
|
}, {
|
|
3662
3689
|
key: "_handleChannelEvent",
|
|
3663
3690
|
value: function _handleChannelEvent(event) {
|
|
3664
|
-
var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9, _event$
|
|
3691
|
+
var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9, _event$user11, _channelState$members, _event$user12, _channelState$members2;
|
|
3665
3692
|
|
|
3666
3693
|
var channel = this;
|
|
3667
3694
|
|
|
@@ -3692,7 +3719,6 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3692
3719
|
var _event$user4, _this$getClient$user;
|
|
3693
3720
|
|
|
3694
3721
|
channelState.read[event.user.id] = {
|
|
3695
|
-
// because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
|
|
3696
3722
|
last_read: new Date(event.created_at),
|
|
3697
3723
|
last_read_message_id: event.last_read_message_id,
|
|
3698
3724
|
user: event.user,
|
|
@@ -3749,7 +3775,13 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3749
3775
|
|
|
3750
3776
|
if (event.message.pinned) {
|
|
3751
3777
|
channelState.addPinnedMessage(event.message);
|
|
3752
|
-
}
|
|
3778
|
+
} // do not increase the unread count - the back-end does not increase the count neither in the following cases:
|
|
3779
|
+
// 1. the message is mine
|
|
3780
|
+
// 2. the message is a thread reply from any user
|
|
3781
|
+
|
|
3782
|
+
|
|
3783
|
+
var preventUnreadCountUpdate = ownMessage || isThreadMessage;
|
|
3784
|
+
if (preventUnreadCountUpdate) break;
|
|
3753
3785
|
|
|
3754
3786
|
if ((_event$user8 = event.user) !== null && _event$user8 !== void 0 && _event$user8.id) {
|
|
3755
3787
|
for (var userId in channelState.read) {
|
|
@@ -3765,9 +3797,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3765
3797
|
}
|
|
3766
3798
|
}
|
|
3767
3799
|
|
|
3768
|
-
if (
|
|
3769
|
-
channelState.unreadCount = 0;
|
|
3770
|
-
} else if (this._countMessageAsUnread(event.message)) {
|
|
3800
|
+
if (this._countMessageAsUnread(event.message)) {
|
|
3771
3801
|
channelState.unreadCount = channelState.unreadCount + 1;
|
|
3772
3802
|
}
|
|
3773
3803
|
}
|
|
@@ -3840,6 +3870,25 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3840
3870
|
|
|
3841
3871
|
break;
|
|
3842
3872
|
|
|
3873
|
+
case 'notification.mark_unread':
|
|
3874
|
+
{
|
|
3875
|
+
var _event$user10, _this$getClient$user3, _event$unread_message;
|
|
3876
|
+
|
|
3877
|
+
var _ownMessage = ((_event$user10 = event.user) === null || _event$user10 === void 0 ? void 0 : _event$user10.id) === ((_this$getClient$user3 = this.getClient().user) === null || _this$getClient$user3 === void 0 ? void 0 : _this$getClient$user3.id);
|
|
3878
|
+
|
|
3879
|
+
if (!(_ownMessage && event.user)) break;
|
|
3880
|
+
var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
|
|
3881
|
+
channelState.read[event.user.id] = {
|
|
3882
|
+
first_unread_message_id: event.first_unread_message_id,
|
|
3883
|
+
last_read: new Date(event.last_read_at),
|
|
3884
|
+
last_read_message_id: event.last_read_message_id,
|
|
3885
|
+
user: event.user,
|
|
3886
|
+
unread_messages: unreadCount
|
|
3887
|
+
};
|
|
3888
|
+
channelState.unreadCount = unreadCount;
|
|
3889
|
+
break;
|
|
3890
|
+
}
|
|
3891
|
+
|
|
3843
3892
|
case 'channel.updated':
|
|
3844
3893
|
if (event.channel) {
|
|
3845
3894
|
var _event$channel2, _channel$data, _event$channel$hidden, _event$channel3, _channel$data2, _event$channel$own_ca, _event$channel4, _channel$data3;
|
|
@@ -3858,7 +3907,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3858
3907
|
});
|
|
3859
3908
|
}
|
|
3860
3909
|
|
|
3861
|
-
channel.data = _objectSpread$
|
|
3910
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
|
|
3862
3911
|
hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
|
|
3863
3912
|
own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
|
|
3864
3913
|
});
|
|
@@ -3889,7 +3938,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3889
3938
|
break;
|
|
3890
3939
|
|
|
3891
3940
|
case 'channel.hidden':
|
|
3892
|
-
channel.data = _objectSpread$
|
|
3941
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3893
3942
|
hidden: true
|
|
3894
3943
|
});
|
|
3895
3944
|
|
|
@@ -3900,26 +3949,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3900
3949
|
break;
|
|
3901
3950
|
|
|
3902
3951
|
case 'channel.visible':
|
|
3903
|
-
channel.data = _objectSpread$
|
|
3952
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3904
3953
|
hidden: false
|
|
3905
3954
|
});
|
|
3906
3955
|
break;
|
|
3907
3956
|
|
|
3908
3957
|
case 'user.banned':
|
|
3909
|
-
if (!((_event$
|
|
3910
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3958
|
+
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
3959
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3911
3960
|
shadow_banned: !!event.shadow,
|
|
3912
3961
|
banned: !event.shadow,
|
|
3913
|
-
user: _objectSpread$
|
|
3962
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
|
|
3914
3963
|
});
|
|
3915
3964
|
break;
|
|
3916
3965
|
|
|
3917
3966
|
case 'user.unbanned':
|
|
3918
|
-
if (!((_event$
|
|
3919
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3967
|
+
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
3968
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3920
3969
|
shadow_banned: false,
|
|
3921
3970
|
banned: false,
|
|
3922
|
-
user: _objectSpread$
|
|
3971
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
3923
3972
|
});
|
|
3924
3973
|
break;
|
|
3925
3974
|
} // any event can send over the online count
|
|
@@ -3949,7 +3998,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3949
3998
|
|
|
3950
3999
|
|
|
3951
4000
|
if (state.members) {
|
|
3952
|
-
var _iterator = _createForOfIteratorHelper$
|
|
4001
|
+
var _iterator = _createForOfIteratorHelper$3(state.members),
|
|
3953
4002
|
_step;
|
|
3954
4003
|
|
|
3955
4004
|
try {
|
|
@@ -3993,7 +4042,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3993
4042
|
|
|
3994
4043
|
|
|
3995
4044
|
if (state.watchers) {
|
|
3996
|
-
var _iterator2 = _createForOfIteratorHelper$
|
|
4045
|
+
var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
|
|
3997
4046
|
_step2;
|
|
3998
4047
|
|
|
3999
4048
|
try {
|
|
@@ -4029,7 +4078,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4029
4078
|
|
|
4030
4079
|
|
|
4031
4080
|
if (state.read) {
|
|
4032
|
-
var _iterator3 = _createForOfIteratorHelper$
|
|
4081
|
+
var _iterator3 = _createForOfIteratorHelper$3(state.read),
|
|
4033
4082
|
_step3;
|
|
4034
4083
|
|
|
4035
4084
|
try {
|
|
@@ -4098,11 +4147,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4098
4147
|
return Channel;
|
|
4099
4148
|
}();
|
|
4100
4149
|
|
|
4101
|
-
function _createForOfIteratorHelper$
|
|
4150
|
+
function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4102
4151
|
|
|
4103
|
-
function _unsupportedIterableToArray$
|
|
4152
|
+
function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
|
|
4104
4153
|
|
|
4105
|
-
function _arrayLikeToArray$
|
|
4154
|
+
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
4106
4155
|
|
|
4107
4156
|
/**
|
|
4108
4157
|
* ClientState - A container class for the client state.
|
|
@@ -4125,7 +4174,7 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4125
4174
|
_createClass__default['default'](ClientState, [{
|
|
4126
4175
|
key: "updateUsers",
|
|
4127
4176
|
value: function updateUsers(users) {
|
|
4128
|
-
var _iterator = _createForOfIteratorHelper$
|
|
4177
|
+
var _iterator = _createForOfIteratorHelper$2(users),
|
|
4129
4178
|
_step;
|
|
4130
4179
|
|
|
4131
4180
|
try {
|
|
@@ -4173,9 +4222,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4173
4222
|
return ClientState;
|
|
4174
4223
|
}();
|
|
4175
4224
|
|
|
4176
|
-
function ownKeys$
|
|
4225
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4177
4226
|
|
|
4178
|
-
function _objectSpread$
|
|
4227
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4179
4228
|
var InsightMetrics = function InsightMetrics() {
|
|
4180
4229
|
_classCallCheck__default['default'](this, InsightMetrics);
|
|
4181
4230
|
|
|
@@ -4254,7 +4303,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
4254
4303
|
};
|
|
4255
4304
|
}();
|
|
4256
4305
|
function buildWsFatalInsight(connection, event) {
|
|
4257
|
-
return _objectSpread$
|
|
4306
|
+
return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
|
|
4258
4307
|
}
|
|
4259
4308
|
|
|
4260
4309
|
function buildWsBaseInsight(connection) {
|
|
@@ -4287,9 +4336,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
4287
4336
|
return buildWsBaseInsight(connection);
|
|
4288
4337
|
}
|
|
4289
4338
|
|
|
4290
|
-
function ownKeys$
|
|
4339
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4291
4340
|
|
|
4292
|
-
function _objectSpread$
|
|
4341
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4293
4342
|
|
|
4294
4343
|
// Type guards to check WebSocket error type
|
|
4295
4344
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -4653,7 +4702,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4653
4702
|
value: function _log(msg) {
|
|
4654
4703
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4655
4704
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
4656
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
4705
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$4({
|
|
4657
4706
|
tags: ['connection']
|
|
4658
4707
|
}, extra));
|
|
4659
4708
|
}
|
|
@@ -5248,9 +5297,9 @@ var jwt = null;
|
|
|
5248
5297
|
|
|
5249
5298
|
var crypto$1 = null;
|
|
5250
5299
|
|
|
5251
|
-
function ownKeys$
|
|
5300
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5252
5301
|
|
|
5253
|
-
function _objectSpread$
|
|
5302
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5254
5303
|
|
|
5255
5304
|
/**
|
|
5256
5305
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -5271,7 +5320,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
5271
5320
|
throw new TypeError('userId should be a string');
|
|
5272
5321
|
}
|
|
5273
5322
|
|
|
5274
|
-
var payload = _objectSpread$
|
|
5323
|
+
var payload = _objectSpread$3({
|
|
5275
5324
|
user_id: userId
|
|
5276
5325
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
5277
5326
|
|
|
@@ -5675,9 +5724,9 @@ function isErrorResponse(res) {
|
|
|
5675
5724
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
5676
5725
|
}
|
|
5677
5726
|
|
|
5678
|
-
function ownKeys$
|
|
5727
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5679
5728
|
|
|
5680
|
-
function _objectSpread$
|
|
5729
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5681
5730
|
var ConnectionState;
|
|
5682
5731
|
|
|
5683
5732
|
(function (ConnectionState) {
|
|
@@ -5740,7 +5789,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5740
5789
|
_context.next = 4;
|
|
5741
5790
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
5742
5791
|
undefined, {
|
|
5743
|
-
config: _objectSpread$
|
|
5792
|
+
config: _objectSpread$2(_objectSpread$2({}, config), {}, {
|
|
5744
5793
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
5745
5794
|
}),
|
|
5746
5795
|
params: params
|
|
@@ -6018,7 +6067,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6018
6067
|
value: function _log(msg) {
|
|
6019
6068
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6020
6069
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
6021
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
6070
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
|
|
6022
6071
|
tags: ['connection_fallback', 'connection']
|
|
6023
6072
|
}, extra));
|
|
6024
6073
|
}
|
|
@@ -6065,6 +6114,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
6065
6114
|
/**
|
|
6066
6115
|
* Response Types
|
|
6067
6116
|
*/
|
|
6117
|
+
// TODO: Figure out a way to strongly type set and unset.
|
|
6068
6118
|
// Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
|
|
6069
6119
|
|
|
6070
6120
|
/**
|
|
@@ -6136,6 +6186,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
|
6136
6186
|
return ErrorFromResponse;
|
|
6137
6187
|
}( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
|
|
6138
6188
|
|
|
6189
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6190
|
+
|
|
6191
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6192
|
+
|
|
6193
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6194
|
+
|
|
6195
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
6196
|
+
|
|
6197
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6198
|
+
var Thread = /*#__PURE__*/function () {
|
|
6199
|
+
function Thread(client, t) {
|
|
6200
|
+
_classCallCheck__default['default'](this, Thread);
|
|
6201
|
+
|
|
6202
|
+
_defineProperty__default['default'](this, "id", void 0);
|
|
6203
|
+
|
|
6204
|
+
_defineProperty__default['default'](this, "latestReplies", []);
|
|
6205
|
+
|
|
6206
|
+
_defineProperty__default['default'](this, "participants", []);
|
|
6207
|
+
|
|
6208
|
+
_defineProperty__default['default'](this, "message", void 0);
|
|
6209
|
+
|
|
6210
|
+
_defineProperty__default['default'](this, "channel", void 0);
|
|
6211
|
+
|
|
6212
|
+
_defineProperty__default['default'](this, "_channel", void 0);
|
|
6213
|
+
|
|
6214
|
+
_defineProperty__default['default'](this, "replyCount", 0);
|
|
6215
|
+
|
|
6216
|
+
_defineProperty__default['default'](this, "_client", void 0);
|
|
6217
|
+
|
|
6218
|
+
_defineProperty__default['default'](this, "read", {});
|
|
6219
|
+
|
|
6220
|
+
this.id = t.parent_message.id;
|
|
6221
|
+
this.message = formatMessage(t.parent_message);
|
|
6222
|
+
this.latestReplies = t.latest_replies.map(formatMessage);
|
|
6223
|
+
this.participants = t.thread_participants;
|
|
6224
|
+
this.replyCount = t.reply_count;
|
|
6225
|
+
this.channel = t.channel;
|
|
6226
|
+
this._channel = client.channel(t.channel.type, t.channel.id);
|
|
6227
|
+
this._client = client;
|
|
6228
|
+
|
|
6229
|
+
var _iterator = _createForOfIteratorHelper$1(t.read),
|
|
6230
|
+
_step;
|
|
6231
|
+
|
|
6232
|
+
try {
|
|
6233
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6234
|
+
var r = _step.value;
|
|
6235
|
+
this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
|
|
6236
|
+
last_read: new Date(r.last_read)
|
|
6237
|
+
});
|
|
6238
|
+
}
|
|
6239
|
+
} catch (err) {
|
|
6240
|
+
_iterator.e(err);
|
|
6241
|
+
} finally {
|
|
6242
|
+
_iterator.f();
|
|
6243
|
+
}
|
|
6244
|
+
}
|
|
6245
|
+
|
|
6246
|
+
_createClass__default['default'](Thread, [{
|
|
6247
|
+
key: "getClient",
|
|
6248
|
+
value: function getClient() {
|
|
6249
|
+
return this._client;
|
|
6250
|
+
}
|
|
6251
|
+
}, {
|
|
6252
|
+
key: "addReply",
|
|
6253
|
+
value: function addReply(message) {
|
|
6254
|
+
this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
|
|
6255
|
+
}
|
|
6256
|
+
}, {
|
|
6257
|
+
key: "updateReply",
|
|
6258
|
+
value: function updateReply(message) {
|
|
6259
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6260
|
+
if (m.id === message.id) {
|
|
6261
|
+
return formatMessage(message);
|
|
6262
|
+
}
|
|
6263
|
+
|
|
6264
|
+
return m;
|
|
6265
|
+
});
|
|
6266
|
+
}
|
|
6267
|
+
}, {
|
|
6268
|
+
key: "updateMessageOrReplyIfExists",
|
|
6269
|
+
value: function updateMessageOrReplyIfExists(message) {
|
|
6270
|
+
if (!message.parent_id && message.id !== this.message.id) {
|
|
6271
|
+
return;
|
|
6272
|
+
}
|
|
6273
|
+
|
|
6274
|
+
if (message.parent_id && message.parent_id !== this.message.id) {
|
|
6275
|
+
return;
|
|
6276
|
+
}
|
|
6277
|
+
|
|
6278
|
+
if (message.parent_id && message.parent_id === this.message.id) {
|
|
6279
|
+
this.updateReply(message);
|
|
6280
|
+
}
|
|
6281
|
+
|
|
6282
|
+
if (!message.parent_id && message.id === this.message.id) {
|
|
6283
|
+
this.message = formatMessage(message);
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6286
|
+
}, {
|
|
6287
|
+
key: "addReaction",
|
|
6288
|
+
value: function addReaction(reaction, message, enforce_unique) {
|
|
6289
|
+
var _this = this;
|
|
6290
|
+
|
|
6291
|
+
if (!message) return;
|
|
6292
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6293
|
+
if (m.id === message.id) {
|
|
6294
|
+
return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
|
|
6295
|
+
}
|
|
6296
|
+
|
|
6297
|
+
return m;
|
|
6298
|
+
});
|
|
6299
|
+
}
|
|
6300
|
+
}, {
|
|
6301
|
+
key: "removeReaction",
|
|
6302
|
+
value: function removeReaction(reaction, message) {
|
|
6303
|
+
var _this2 = this;
|
|
6304
|
+
|
|
6305
|
+
if (!message) return;
|
|
6306
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6307
|
+
if (m.id === message.id) {
|
|
6308
|
+
return formatMessage(_this2._channel.state.removeReaction(reaction, message));
|
|
6309
|
+
}
|
|
6310
|
+
|
|
6311
|
+
return m;
|
|
6312
|
+
});
|
|
6313
|
+
}
|
|
6314
|
+
}]);
|
|
6315
|
+
|
|
6316
|
+
return Thread;
|
|
6317
|
+
}();
|
|
6318
|
+
|
|
6139
6319
|
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
6140
6320
|
_excluded2 = ["params", "headers"];
|
|
6141
6321
|
|
|
@@ -8480,6 +8660,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8480
8660
|
|
|
8481
8661
|
return getDevices;
|
|
8482
8662
|
}()
|
|
8663
|
+
/**
|
|
8664
|
+
* getUnreadCount - Returns unread counts for a single user
|
|
8665
|
+
*
|
|
8666
|
+
* @param {string} [userID] User ID.
|
|
8667
|
+
*
|
|
8668
|
+
* @return {<GetUnreadCountAPIResponse>}
|
|
8669
|
+
*/
|
|
8670
|
+
|
|
8483
8671
|
}, {
|
|
8484
8672
|
key: "getUnreadCount",
|
|
8485
8673
|
value: function () {
|
|
@@ -8501,14 +8689,52 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8501
8689
|
return _context24.stop();
|
|
8502
8690
|
}
|
|
8503
8691
|
}
|
|
8504
|
-
}, _callee24, this);
|
|
8692
|
+
}, _callee24, this);
|
|
8693
|
+
}));
|
|
8694
|
+
|
|
8695
|
+
function getUnreadCount(_x25) {
|
|
8696
|
+
return _getUnreadCount.apply(this, arguments);
|
|
8697
|
+
}
|
|
8698
|
+
|
|
8699
|
+
return getUnreadCount;
|
|
8700
|
+
}()
|
|
8701
|
+
/**
|
|
8702
|
+
* getUnreadCountBatch - Returns unread counts for multiple users at once. Only works server side.
|
|
8703
|
+
*
|
|
8704
|
+
* @param {string[]} [userIDs] List of user IDs to fetch unread counts for.
|
|
8705
|
+
*
|
|
8706
|
+
* @return {<GetUnreadCountBatchAPIResponse>}
|
|
8707
|
+
*/
|
|
8708
|
+
|
|
8709
|
+
}, {
|
|
8710
|
+
key: "getUnreadCountBatch",
|
|
8711
|
+
value: function () {
|
|
8712
|
+
var _getUnreadCountBatch = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(userIDs) {
|
|
8713
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
|
|
8714
|
+
while (1) {
|
|
8715
|
+
switch (_context25.prev = _context25.next) {
|
|
8716
|
+
case 0:
|
|
8717
|
+
_context25.next = 2;
|
|
8718
|
+
return this.post(this.baseURL + '/unread_batch', {
|
|
8719
|
+
user_ids: userIDs
|
|
8720
|
+
});
|
|
8721
|
+
|
|
8722
|
+
case 2:
|
|
8723
|
+
return _context25.abrupt("return", _context25.sent);
|
|
8724
|
+
|
|
8725
|
+
case 3:
|
|
8726
|
+
case "end":
|
|
8727
|
+
return _context25.stop();
|
|
8728
|
+
}
|
|
8729
|
+
}
|
|
8730
|
+
}, _callee25, this);
|
|
8505
8731
|
}));
|
|
8506
8732
|
|
|
8507
|
-
function
|
|
8508
|
-
return
|
|
8733
|
+
function getUnreadCountBatch(_x26) {
|
|
8734
|
+
return _getUnreadCountBatch.apply(this, arguments);
|
|
8509
8735
|
}
|
|
8510
8736
|
|
|
8511
|
-
return
|
|
8737
|
+
return getUnreadCountBatch;
|
|
8512
8738
|
}()
|
|
8513
8739
|
/**
|
|
8514
8740
|
* removeDevice - Removes the device with the given id. Clientside users can only delete their own devices
|
|
@@ -8521,12 +8747,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8521
8747
|
}, {
|
|
8522
8748
|
key: "removeDevice",
|
|
8523
8749
|
value: function () {
|
|
8524
|
-
var _removeDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8525
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8750
|
+
var _removeDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee26(id, userID) {
|
|
8751
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee26$(_context26) {
|
|
8526
8752
|
while (1) {
|
|
8527
|
-
switch (
|
|
8753
|
+
switch (_context26.prev = _context26.next) {
|
|
8528
8754
|
case 0:
|
|
8529
|
-
|
|
8755
|
+
_context26.next = 2;
|
|
8530
8756
|
return this.delete(this.baseURL + '/devices', _objectSpread({
|
|
8531
8757
|
id: id
|
|
8532
8758
|
}, userID ? {
|
|
@@ -8534,17 +8760,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8534
8760
|
} : {}));
|
|
8535
8761
|
|
|
8536
8762
|
case 2:
|
|
8537
|
-
return
|
|
8763
|
+
return _context26.abrupt("return", _context26.sent);
|
|
8538
8764
|
|
|
8539
8765
|
case 3:
|
|
8540
8766
|
case "end":
|
|
8541
|
-
return
|
|
8767
|
+
return _context26.stop();
|
|
8542
8768
|
}
|
|
8543
8769
|
}
|
|
8544
|
-
},
|
|
8770
|
+
}, _callee26, this);
|
|
8545
8771
|
}));
|
|
8546
8772
|
|
|
8547
|
-
function removeDevice(
|
|
8773
|
+
function removeDevice(_x27, _x28) {
|
|
8548
8774
|
return _removeDevice.apply(this, arguments);
|
|
8549
8775
|
}
|
|
8550
8776
|
|
|
@@ -8561,15 +8787,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8561
8787
|
}, {
|
|
8562
8788
|
key: "getRateLimits",
|
|
8563
8789
|
value: function () {
|
|
8564
|
-
var _getRateLimits = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8790
|
+
var _getRateLimits = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee27(params) {
|
|
8565
8791
|
var _ref7, serverSide, web, android, ios, endpoints;
|
|
8566
8792
|
|
|
8567
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8793
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee27$(_context27) {
|
|
8568
8794
|
while (1) {
|
|
8569
|
-
switch (
|
|
8795
|
+
switch (_context27.prev = _context27.next) {
|
|
8570
8796
|
case 0:
|
|
8571
8797
|
_ref7 = params || {}, serverSide = _ref7.serverSide, web = _ref7.web, android = _ref7.android, ios = _ref7.ios, endpoints = _ref7.endpoints;
|
|
8572
|
-
return
|
|
8798
|
+
return _context27.abrupt("return", this.get(this.baseURL + '/rate_limits', {
|
|
8573
8799
|
server_side: serverSide,
|
|
8574
8800
|
web: web,
|
|
8575
8801
|
android: android,
|
|
@@ -8579,13 +8805,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8579
8805
|
|
|
8580
8806
|
case 2:
|
|
8581
8807
|
case "end":
|
|
8582
|
-
return
|
|
8808
|
+
return _context27.stop();
|
|
8583
8809
|
}
|
|
8584
8810
|
}
|
|
8585
|
-
},
|
|
8811
|
+
}, _callee27, this);
|
|
8586
8812
|
}));
|
|
8587
8813
|
|
|
8588
|
-
function getRateLimits(
|
|
8814
|
+
function getRateLimits(_x29) {
|
|
8589
8815
|
return _getRateLimits.apply(this, arguments);
|
|
8590
8816
|
}
|
|
8591
8817
|
|
|
@@ -8676,26 +8902,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8676
8902
|
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
|
|
8677
8903
|
*/
|
|
8678
8904
|
function () {
|
|
8679
|
-
var _partialUpdateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8680
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8905
|
+
var _partialUpdateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee28(partialUserObject) {
|
|
8906
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee28$(_context28) {
|
|
8681
8907
|
while (1) {
|
|
8682
|
-
switch (
|
|
8908
|
+
switch (_context28.prev = _context28.next) {
|
|
8683
8909
|
case 0:
|
|
8684
|
-
|
|
8910
|
+
_context28.next = 2;
|
|
8685
8911
|
return this.partialUpdateUsers([partialUserObject]);
|
|
8686
8912
|
|
|
8687
8913
|
case 2:
|
|
8688
|
-
return
|
|
8914
|
+
return _context28.abrupt("return", _context28.sent);
|
|
8689
8915
|
|
|
8690
8916
|
case 3:
|
|
8691
8917
|
case "end":
|
|
8692
|
-
return
|
|
8918
|
+
return _context28.stop();
|
|
8693
8919
|
}
|
|
8694
8920
|
}
|
|
8695
|
-
},
|
|
8921
|
+
}, _callee28, this);
|
|
8696
8922
|
}));
|
|
8697
8923
|
|
|
8698
|
-
function partialUpdateUser(
|
|
8924
|
+
function partialUpdateUser(_x30) {
|
|
8699
8925
|
return _partialUpdateUser.apply(this, arguments);
|
|
8700
8926
|
}
|
|
8701
8927
|
|
|
@@ -8712,29 +8938,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8712
8938
|
}, {
|
|
8713
8939
|
key: "upsertUsers",
|
|
8714
8940
|
value: function () {
|
|
8715
|
-
var _upsertUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8941
|
+
var _upsertUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee29(users) {
|
|
8716
8942
|
var userMap, _iterator4, _step4, userObject;
|
|
8717
8943
|
|
|
8718
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8944
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee29$(_context29) {
|
|
8719
8945
|
while (1) {
|
|
8720
|
-
switch (
|
|
8946
|
+
switch (_context29.prev = _context29.next) {
|
|
8721
8947
|
case 0:
|
|
8722
8948
|
userMap = {};
|
|
8723
8949
|
_iterator4 = _createForOfIteratorHelper(users);
|
|
8724
|
-
|
|
8950
|
+
_context29.prev = 2;
|
|
8725
8951
|
|
|
8726
8952
|
_iterator4.s();
|
|
8727
8953
|
|
|
8728
8954
|
case 4:
|
|
8729
8955
|
if ((_step4 = _iterator4.n()).done) {
|
|
8730
|
-
|
|
8956
|
+
_context29.next = 11;
|
|
8731
8957
|
break;
|
|
8732
8958
|
}
|
|
8733
8959
|
|
|
8734
8960
|
userObject = _step4.value;
|
|
8735
8961
|
|
|
8736
8962
|
if (userObject.id) {
|
|
8737
|
-
|
|
8963
|
+
_context29.next = 8;
|
|
8738
8964
|
break;
|
|
8739
8965
|
}
|
|
8740
8966
|
|
|
@@ -8744,44 +8970,44 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8744
8970
|
userMap[userObject.id] = userObject;
|
|
8745
8971
|
|
|
8746
8972
|
case 9:
|
|
8747
|
-
|
|
8973
|
+
_context29.next = 4;
|
|
8748
8974
|
break;
|
|
8749
8975
|
|
|
8750
8976
|
case 11:
|
|
8751
|
-
|
|
8977
|
+
_context29.next = 16;
|
|
8752
8978
|
break;
|
|
8753
8979
|
|
|
8754
8980
|
case 13:
|
|
8755
|
-
|
|
8756
|
-
|
|
8981
|
+
_context29.prev = 13;
|
|
8982
|
+
_context29.t0 = _context29["catch"](2);
|
|
8757
8983
|
|
|
8758
|
-
_iterator4.e(
|
|
8984
|
+
_iterator4.e(_context29.t0);
|
|
8759
8985
|
|
|
8760
8986
|
case 16:
|
|
8761
|
-
|
|
8987
|
+
_context29.prev = 16;
|
|
8762
8988
|
|
|
8763
8989
|
_iterator4.f();
|
|
8764
8990
|
|
|
8765
|
-
return
|
|
8991
|
+
return _context29.finish(16);
|
|
8766
8992
|
|
|
8767
8993
|
case 19:
|
|
8768
|
-
|
|
8994
|
+
_context29.next = 21;
|
|
8769
8995
|
return this.post(this.baseURL + '/users', {
|
|
8770
8996
|
users: userMap
|
|
8771
8997
|
});
|
|
8772
8998
|
|
|
8773
8999
|
case 21:
|
|
8774
|
-
return
|
|
9000
|
+
return _context29.abrupt("return", _context29.sent);
|
|
8775
9001
|
|
|
8776
9002
|
case 22:
|
|
8777
9003
|
case "end":
|
|
8778
|
-
return
|
|
9004
|
+
return _context29.stop();
|
|
8779
9005
|
}
|
|
8780
9006
|
}
|
|
8781
|
-
},
|
|
9007
|
+
}, _callee29, this, [[2, 13, 16, 19]]);
|
|
8782
9008
|
}));
|
|
8783
9009
|
|
|
8784
|
-
function upsertUsers(
|
|
9010
|
+
function upsertUsers(_x31) {
|
|
8785
9011
|
return _upsertUsers.apply(this, arguments);
|
|
8786
9012
|
}
|
|
8787
9013
|
|
|
@@ -8829,72 +9055,72 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8829
9055
|
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
8830
9056
|
*/
|
|
8831
9057
|
function () {
|
|
8832
|
-
var _partialUpdateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9058
|
+
var _partialUpdateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee30(users) {
|
|
8833
9059
|
var _iterator5, _step5, userObject;
|
|
8834
9060
|
|
|
8835
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9061
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee30$(_context30) {
|
|
8836
9062
|
while (1) {
|
|
8837
|
-
switch (
|
|
9063
|
+
switch (_context30.prev = _context30.next) {
|
|
8838
9064
|
case 0:
|
|
8839
9065
|
_iterator5 = _createForOfIteratorHelper(users);
|
|
8840
|
-
|
|
9066
|
+
_context30.prev = 1;
|
|
8841
9067
|
|
|
8842
9068
|
_iterator5.s();
|
|
8843
9069
|
|
|
8844
9070
|
case 3:
|
|
8845
9071
|
if ((_step5 = _iterator5.n()).done) {
|
|
8846
|
-
|
|
9072
|
+
_context30.next = 9;
|
|
8847
9073
|
break;
|
|
8848
9074
|
}
|
|
8849
9075
|
|
|
8850
9076
|
userObject = _step5.value;
|
|
8851
9077
|
|
|
8852
9078
|
if (userObject.id) {
|
|
8853
|
-
|
|
9079
|
+
_context30.next = 7;
|
|
8854
9080
|
break;
|
|
8855
9081
|
}
|
|
8856
9082
|
|
|
8857
9083
|
throw Error('User ID is required when updating a user');
|
|
8858
9084
|
|
|
8859
9085
|
case 7:
|
|
8860
|
-
|
|
9086
|
+
_context30.next = 3;
|
|
8861
9087
|
break;
|
|
8862
9088
|
|
|
8863
9089
|
case 9:
|
|
8864
|
-
|
|
9090
|
+
_context30.next = 14;
|
|
8865
9091
|
break;
|
|
8866
9092
|
|
|
8867
9093
|
case 11:
|
|
8868
|
-
|
|
8869
|
-
|
|
9094
|
+
_context30.prev = 11;
|
|
9095
|
+
_context30.t0 = _context30["catch"](1);
|
|
8870
9096
|
|
|
8871
|
-
_iterator5.e(
|
|
9097
|
+
_iterator5.e(_context30.t0);
|
|
8872
9098
|
|
|
8873
9099
|
case 14:
|
|
8874
|
-
|
|
9100
|
+
_context30.prev = 14;
|
|
8875
9101
|
|
|
8876
9102
|
_iterator5.f();
|
|
8877
9103
|
|
|
8878
|
-
return
|
|
9104
|
+
return _context30.finish(14);
|
|
8879
9105
|
|
|
8880
9106
|
case 17:
|
|
8881
|
-
|
|
9107
|
+
_context30.next = 19;
|
|
8882
9108
|
return this.patch(this.baseURL + '/users', {
|
|
8883
9109
|
users: users
|
|
8884
9110
|
});
|
|
8885
9111
|
|
|
8886
9112
|
case 19:
|
|
8887
|
-
return
|
|
9113
|
+
return _context30.abrupt("return", _context30.sent);
|
|
8888
9114
|
|
|
8889
9115
|
case 20:
|
|
8890
9116
|
case "end":
|
|
8891
|
-
return
|
|
9117
|
+
return _context30.stop();
|
|
8892
9118
|
}
|
|
8893
9119
|
}
|
|
8894
|
-
},
|
|
9120
|
+
}, _callee30, this, [[1, 11, 14, 17]]);
|
|
8895
9121
|
}));
|
|
8896
9122
|
|
|
8897
|
-
function partialUpdateUsers(
|
|
9123
|
+
function partialUpdateUsers(_x32) {
|
|
8898
9124
|
return _partialUpdateUsers.apply(this, arguments);
|
|
8899
9125
|
}
|
|
8900
9126
|
|
|
@@ -8903,26 +9129,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8903
9129
|
}, {
|
|
8904
9130
|
key: "deleteUser",
|
|
8905
9131
|
value: function () {
|
|
8906
|
-
var _deleteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8907
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9132
|
+
var _deleteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee31(userID, params) {
|
|
9133
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee31$(_context31) {
|
|
8908
9134
|
while (1) {
|
|
8909
|
-
switch (
|
|
9135
|
+
switch (_context31.prev = _context31.next) {
|
|
8910
9136
|
case 0:
|
|
8911
|
-
|
|
9137
|
+
_context31.next = 2;
|
|
8912
9138
|
return this.delete(this.baseURL + "/users/".concat(userID), params);
|
|
8913
9139
|
|
|
8914
9140
|
case 2:
|
|
8915
|
-
return
|
|
9141
|
+
return _context31.abrupt("return", _context31.sent);
|
|
8916
9142
|
|
|
8917
9143
|
case 3:
|
|
8918
9144
|
case "end":
|
|
8919
|
-
return
|
|
9145
|
+
return _context31.stop();
|
|
8920
9146
|
}
|
|
8921
9147
|
}
|
|
8922
|
-
},
|
|
9148
|
+
}, _callee31, this);
|
|
8923
9149
|
}));
|
|
8924
9150
|
|
|
8925
|
-
function deleteUser(
|
|
9151
|
+
function deleteUser(_x33, _x34) {
|
|
8926
9152
|
return _deleteUser.apply(this, arguments);
|
|
8927
9153
|
}
|
|
8928
9154
|
|
|
@@ -8939,28 +9165,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8939
9165
|
}, {
|
|
8940
9166
|
key: "restoreUsers",
|
|
8941
9167
|
value: function () {
|
|
8942
|
-
var _restoreUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8943
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9168
|
+
var _restoreUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee32(user_ids) {
|
|
9169
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee32$(_context32) {
|
|
8944
9170
|
while (1) {
|
|
8945
|
-
switch (
|
|
9171
|
+
switch (_context32.prev = _context32.next) {
|
|
8946
9172
|
case 0:
|
|
8947
|
-
|
|
9173
|
+
_context32.next = 2;
|
|
8948
9174
|
return this.post(this.baseURL + "/users/restore", {
|
|
8949
9175
|
user_ids: user_ids
|
|
8950
9176
|
});
|
|
8951
9177
|
|
|
8952
9178
|
case 2:
|
|
8953
|
-
return
|
|
9179
|
+
return _context32.abrupt("return", _context32.sent);
|
|
8954
9180
|
|
|
8955
9181
|
case 3:
|
|
8956
9182
|
case "end":
|
|
8957
|
-
return
|
|
9183
|
+
return _context32.stop();
|
|
8958
9184
|
}
|
|
8959
9185
|
}
|
|
8960
|
-
},
|
|
9186
|
+
}, _callee32, this);
|
|
8961
9187
|
}));
|
|
8962
9188
|
|
|
8963
|
-
function restoreUsers(
|
|
9189
|
+
function restoreUsers(_x35) {
|
|
8964
9190
|
return _restoreUsers.apply(this, arguments);
|
|
8965
9191
|
}
|
|
8966
9192
|
|
|
@@ -8978,26 +9204,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8978
9204
|
}, {
|
|
8979
9205
|
key: "reactivateUser",
|
|
8980
9206
|
value: function () {
|
|
8981
|
-
var _reactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8982
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9207
|
+
var _reactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee33(userID, options) {
|
|
9208
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee33$(_context33) {
|
|
8983
9209
|
while (1) {
|
|
8984
|
-
switch (
|
|
9210
|
+
switch (_context33.prev = _context33.next) {
|
|
8985
9211
|
case 0:
|
|
8986
|
-
|
|
9212
|
+
_context33.next = 2;
|
|
8987
9213
|
return this.post(this.baseURL + "/users/".concat(userID, "/reactivate"), _objectSpread({}, options));
|
|
8988
9214
|
|
|
8989
9215
|
case 2:
|
|
8990
|
-
return
|
|
9216
|
+
return _context33.abrupt("return", _context33.sent);
|
|
8991
9217
|
|
|
8992
9218
|
case 3:
|
|
8993
9219
|
case "end":
|
|
8994
|
-
return
|
|
9220
|
+
return _context33.stop();
|
|
8995
9221
|
}
|
|
8996
9222
|
}
|
|
8997
|
-
},
|
|
9223
|
+
}, _callee33, this);
|
|
8998
9224
|
}));
|
|
8999
9225
|
|
|
9000
|
-
function reactivateUser(
|
|
9226
|
+
function reactivateUser(_x36, _x37) {
|
|
9001
9227
|
return _reactivateUser.apply(this, arguments);
|
|
9002
9228
|
}
|
|
9003
9229
|
|
|
@@ -9015,28 +9241,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9015
9241
|
}, {
|
|
9016
9242
|
key: "reactivateUsers",
|
|
9017
9243
|
value: function () {
|
|
9018
|
-
var _reactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9019
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9244
|
+
var _reactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee34(user_ids, options) {
|
|
9245
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee34$(_context34) {
|
|
9020
9246
|
while (1) {
|
|
9021
|
-
switch (
|
|
9247
|
+
switch (_context34.prev = _context34.next) {
|
|
9022
9248
|
case 0:
|
|
9023
|
-
|
|
9249
|
+
_context34.next = 2;
|
|
9024
9250
|
return this.post(this.baseURL + "/users/reactivate", _objectSpread({
|
|
9025
9251
|
user_ids: user_ids
|
|
9026
9252
|
}, options));
|
|
9027
9253
|
|
|
9028
9254
|
case 2:
|
|
9029
|
-
return
|
|
9255
|
+
return _context34.abrupt("return", _context34.sent);
|
|
9030
9256
|
|
|
9031
9257
|
case 3:
|
|
9032
9258
|
case "end":
|
|
9033
|
-
return
|
|
9259
|
+
return _context34.stop();
|
|
9034
9260
|
}
|
|
9035
9261
|
}
|
|
9036
|
-
},
|
|
9262
|
+
}, _callee34, this);
|
|
9037
9263
|
}));
|
|
9038
9264
|
|
|
9039
|
-
function reactivateUsers(
|
|
9265
|
+
function reactivateUsers(_x38, _x39) {
|
|
9040
9266
|
return _reactivateUsers.apply(this, arguments);
|
|
9041
9267
|
}
|
|
9042
9268
|
|
|
@@ -9054,26 +9280,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9054
9280
|
}, {
|
|
9055
9281
|
key: "deactivateUser",
|
|
9056
9282
|
value: function () {
|
|
9057
|
-
var _deactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9058
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9283
|
+
var _deactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee35(userID, options) {
|
|
9284
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee35$(_context35) {
|
|
9059
9285
|
while (1) {
|
|
9060
|
-
switch (
|
|
9286
|
+
switch (_context35.prev = _context35.next) {
|
|
9061
9287
|
case 0:
|
|
9062
|
-
|
|
9288
|
+
_context35.next = 2;
|
|
9063
9289
|
return this.post(this.baseURL + "/users/".concat(userID, "/deactivate"), _objectSpread({}, options));
|
|
9064
9290
|
|
|
9065
9291
|
case 2:
|
|
9066
|
-
return
|
|
9292
|
+
return _context35.abrupt("return", _context35.sent);
|
|
9067
9293
|
|
|
9068
9294
|
case 3:
|
|
9069
9295
|
case "end":
|
|
9070
|
-
return
|
|
9296
|
+
return _context35.stop();
|
|
9071
9297
|
}
|
|
9072
9298
|
}
|
|
9073
|
-
},
|
|
9299
|
+
}, _callee35, this);
|
|
9074
9300
|
}));
|
|
9075
9301
|
|
|
9076
|
-
function deactivateUser(
|
|
9302
|
+
function deactivateUser(_x40, _x41) {
|
|
9077
9303
|
return _deactivateUser.apply(this, arguments);
|
|
9078
9304
|
}
|
|
9079
9305
|
|
|
@@ -9091,28 +9317,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9091
9317
|
}, {
|
|
9092
9318
|
key: "deactivateUsers",
|
|
9093
9319
|
value: function () {
|
|
9094
|
-
var _deactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9095
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9320
|
+
var _deactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee36(user_ids, options) {
|
|
9321
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee36$(_context36) {
|
|
9096
9322
|
while (1) {
|
|
9097
|
-
switch (
|
|
9323
|
+
switch (_context36.prev = _context36.next) {
|
|
9098
9324
|
case 0:
|
|
9099
|
-
|
|
9325
|
+
_context36.next = 2;
|
|
9100
9326
|
return this.post(this.baseURL + "/users/deactivate", _objectSpread({
|
|
9101
9327
|
user_ids: user_ids
|
|
9102
9328
|
}, options));
|
|
9103
9329
|
|
|
9104
9330
|
case 2:
|
|
9105
|
-
return
|
|
9331
|
+
return _context36.abrupt("return", _context36.sent);
|
|
9106
9332
|
|
|
9107
9333
|
case 3:
|
|
9108
9334
|
case "end":
|
|
9109
|
-
return
|
|
9335
|
+
return _context36.stop();
|
|
9110
9336
|
}
|
|
9111
9337
|
}
|
|
9112
|
-
},
|
|
9338
|
+
}, _callee36, this);
|
|
9113
9339
|
}));
|
|
9114
9340
|
|
|
9115
|
-
function deactivateUsers(
|
|
9341
|
+
function deactivateUsers(_x42, _x43) {
|
|
9116
9342
|
return _deactivateUsers.apply(this, arguments);
|
|
9117
9343
|
}
|
|
9118
9344
|
|
|
@@ -9121,26 +9347,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9121
9347
|
}, {
|
|
9122
9348
|
key: "exportUser",
|
|
9123
9349
|
value: function () {
|
|
9124
|
-
var _exportUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9125
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9350
|
+
var _exportUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee37(userID, options) {
|
|
9351
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee37$(_context37) {
|
|
9126
9352
|
while (1) {
|
|
9127
|
-
switch (
|
|
9353
|
+
switch (_context37.prev = _context37.next) {
|
|
9128
9354
|
case 0:
|
|
9129
|
-
|
|
9355
|
+
_context37.next = 2;
|
|
9130
9356
|
return this.get(this.baseURL + "/users/".concat(userID, "/export"), _objectSpread({}, options));
|
|
9131
9357
|
|
|
9132
9358
|
case 2:
|
|
9133
|
-
return
|
|
9359
|
+
return _context37.abrupt("return", _context37.sent);
|
|
9134
9360
|
|
|
9135
9361
|
case 3:
|
|
9136
9362
|
case "end":
|
|
9137
|
-
return
|
|
9363
|
+
return _context37.stop();
|
|
9138
9364
|
}
|
|
9139
9365
|
}
|
|
9140
|
-
},
|
|
9366
|
+
}, _callee37, this);
|
|
9141
9367
|
}));
|
|
9142
9368
|
|
|
9143
|
-
function exportUser(
|
|
9369
|
+
function exportUser(_x44, _x45) {
|
|
9144
9370
|
return _exportUser.apply(this, arguments);
|
|
9145
9371
|
}
|
|
9146
9372
|
|
|
@@ -9156,28 +9382,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9156
9382
|
}, {
|
|
9157
9383
|
key: "banUser",
|
|
9158
9384
|
value: function () {
|
|
9159
|
-
var _banUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9160
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9385
|
+
var _banUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee38(targetUserID, options) {
|
|
9386
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee38$(_context38) {
|
|
9161
9387
|
while (1) {
|
|
9162
|
-
switch (
|
|
9388
|
+
switch (_context38.prev = _context38.next) {
|
|
9163
9389
|
case 0:
|
|
9164
|
-
|
|
9390
|
+
_context38.next = 2;
|
|
9165
9391
|
return this.post(this.baseURL + '/moderation/ban', _objectSpread({
|
|
9166
9392
|
target_user_id: targetUserID
|
|
9167
9393
|
}, options));
|
|
9168
9394
|
|
|
9169
9395
|
case 2:
|
|
9170
|
-
return
|
|
9396
|
+
return _context38.abrupt("return", _context38.sent);
|
|
9171
9397
|
|
|
9172
9398
|
case 3:
|
|
9173
9399
|
case "end":
|
|
9174
|
-
return
|
|
9400
|
+
return _context38.stop();
|
|
9175
9401
|
}
|
|
9176
9402
|
}
|
|
9177
|
-
},
|
|
9403
|
+
}, _callee38, this);
|
|
9178
9404
|
}));
|
|
9179
9405
|
|
|
9180
|
-
function banUser(
|
|
9406
|
+
function banUser(_x46, _x47) {
|
|
9181
9407
|
return _banUser.apply(this, arguments);
|
|
9182
9408
|
}
|
|
9183
9409
|
|
|
@@ -9193,28 +9419,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9193
9419
|
}, {
|
|
9194
9420
|
key: "unbanUser",
|
|
9195
9421
|
value: function () {
|
|
9196
|
-
var _unbanUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9197
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9422
|
+
var _unbanUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee39(targetUserID, options) {
|
|
9423
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee39$(_context39) {
|
|
9198
9424
|
while (1) {
|
|
9199
|
-
switch (
|
|
9425
|
+
switch (_context39.prev = _context39.next) {
|
|
9200
9426
|
case 0:
|
|
9201
|
-
|
|
9427
|
+
_context39.next = 2;
|
|
9202
9428
|
return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
|
|
9203
9429
|
target_user_id: targetUserID
|
|
9204
9430
|
}, options));
|
|
9205
9431
|
|
|
9206
9432
|
case 2:
|
|
9207
|
-
return
|
|
9433
|
+
return _context39.abrupt("return", _context39.sent);
|
|
9208
9434
|
|
|
9209
9435
|
case 3:
|
|
9210
9436
|
case "end":
|
|
9211
|
-
return
|
|
9437
|
+
return _context39.stop();
|
|
9212
9438
|
}
|
|
9213
9439
|
}
|
|
9214
|
-
},
|
|
9440
|
+
}, _callee39, this);
|
|
9215
9441
|
}));
|
|
9216
9442
|
|
|
9217
|
-
function unbanUser(
|
|
9443
|
+
function unbanUser(_x48, _x49) {
|
|
9218
9444
|
return _unbanUser.apply(this, arguments);
|
|
9219
9445
|
}
|
|
9220
9446
|
|
|
@@ -9230,28 +9456,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9230
9456
|
}, {
|
|
9231
9457
|
key: "shadowBan",
|
|
9232
9458
|
value: function () {
|
|
9233
|
-
var _shadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9234
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9459
|
+
var _shadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee40(targetUserID, options) {
|
|
9460
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee40$(_context40) {
|
|
9235
9461
|
while (1) {
|
|
9236
|
-
switch (
|
|
9462
|
+
switch (_context40.prev = _context40.next) {
|
|
9237
9463
|
case 0:
|
|
9238
|
-
|
|
9464
|
+
_context40.next = 2;
|
|
9239
9465
|
return this.banUser(targetUserID, _objectSpread({
|
|
9240
9466
|
shadow: true
|
|
9241
9467
|
}, options));
|
|
9242
9468
|
|
|
9243
9469
|
case 2:
|
|
9244
|
-
return
|
|
9470
|
+
return _context40.abrupt("return", _context40.sent);
|
|
9245
9471
|
|
|
9246
9472
|
case 3:
|
|
9247
9473
|
case "end":
|
|
9248
|
-
return
|
|
9474
|
+
return _context40.stop();
|
|
9249
9475
|
}
|
|
9250
9476
|
}
|
|
9251
|
-
},
|
|
9477
|
+
}, _callee40, this);
|
|
9252
9478
|
}));
|
|
9253
9479
|
|
|
9254
|
-
function shadowBan(
|
|
9480
|
+
function shadowBan(_x50, _x51) {
|
|
9255
9481
|
return _shadowBan.apply(this, arguments);
|
|
9256
9482
|
}
|
|
9257
9483
|
|
|
@@ -9267,28 +9493,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9267
9493
|
}, {
|
|
9268
9494
|
key: "removeShadowBan",
|
|
9269
9495
|
value: function () {
|
|
9270
|
-
var _removeShadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9271
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9496
|
+
var _removeShadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee41(targetUserID, options) {
|
|
9497
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee41$(_context41) {
|
|
9272
9498
|
while (1) {
|
|
9273
|
-
switch (
|
|
9499
|
+
switch (_context41.prev = _context41.next) {
|
|
9274
9500
|
case 0:
|
|
9275
|
-
|
|
9501
|
+
_context41.next = 2;
|
|
9276
9502
|
return this.unbanUser(targetUserID, _objectSpread({
|
|
9277
9503
|
shadow: true
|
|
9278
9504
|
}, options));
|
|
9279
9505
|
|
|
9280
9506
|
case 2:
|
|
9281
|
-
return
|
|
9507
|
+
return _context41.abrupt("return", _context41.sent);
|
|
9282
9508
|
|
|
9283
9509
|
case 3:
|
|
9284
9510
|
case "end":
|
|
9285
|
-
return
|
|
9511
|
+
return _context41.stop();
|
|
9286
9512
|
}
|
|
9287
9513
|
}
|
|
9288
|
-
},
|
|
9514
|
+
}, _callee41, this);
|
|
9289
9515
|
}));
|
|
9290
9516
|
|
|
9291
|
-
function removeShadowBan(
|
|
9517
|
+
function removeShadowBan(_x52, _x53) {
|
|
9292
9518
|
return _removeShadowBan.apply(this, arguments);
|
|
9293
9519
|
}
|
|
9294
9520
|
|
|
@@ -9305,15 +9531,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9305
9531
|
}, {
|
|
9306
9532
|
key: "muteUser",
|
|
9307
9533
|
value: function () {
|
|
9308
|
-
var _muteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9534
|
+
var _muteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee42(targetID, userID) {
|
|
9309
9535
|
var options,
|
|
9310
|
-
|
|
9311
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9536
|
+
_args42 = arguments;
|
|
9537
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee42$(_context42) {
|
|
9312
9538
|
while (1) {
|
|
9313
|
-
switch (
|
|
9539
|
+
switch (_context42.prev = _context42.next) {
|
|
9314
9540
|
case 0:
|
|
9315
|
-
options =
|
|
9316
|
-
|
|
9541
|
+
options = _args42.length > 2 && _args42[2] !== undefined ? _args42[2] : {};
|
|
9542
|
+
_context42.next = 3;
|
|
9317
9543
|
return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
|
|
9318
9544
|
target_id: targetID
|
|
9319
9545
|
}, userID ? {
|
|
@@ -9321,17 +9547,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9321
9547
|
} : {}), options));
|
|
9322
9548
|
|
|
9323
9549
|
case 3:
|
|
9324
|
-
return
|
|
9550
|
+
return _context42.abrupt("return", _context42.sent);
|
|
9325
9551
|
|
|
9326
9552
|
case 4:
|
|
9327
9553
|
case "end":
|
|
9328
|
-
return
|
|
9554
|
+
return _context42.stop();
|
|
9329
9555
|
}
|
|
9330
9556
|
}
|
|
9331
|
-
},
|
|
9557
|
+
}, _callee42, this);
|
|
9332
9558
|
}));
|
|
9333
9559
|
|
|
9334
|
-
function muteUser(
|
|
9560
|
+
function muteUser(_x54, _x55) {
|
|
9335
9561
|
return _muteUser.apply(this, arguments);
|
|
9336
9562
|
}
|
|
9337
9563
|
|
|
@@ -9347,12 +9573,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9347
9573
|
}, {
|
|
9348
9574
|
key: "unmuteUser",
|
|
9349
9575
|
value: function () {
|
|
9350
|
-
var _unmuteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9351
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9576
|
+
var _unmuteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee43(targetID, currentUserID) {
|
|
9577
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee43$(_context43) {
|
|
9352
9578
|
while (1) {
|
|
9353
|
-
switch (
|
|
9579
|
+
switch (_context43.prev = _context43.next) {
|
|
9354
9580
|
case 0:
|
|
9355
|
-
|
|
9581
|
+
_context43.next = 2;
|
|
9356
9582
|
return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
|
|
9357
9583
|
target_id: targetID
|
|
9358
9584
|
}, currentUserID ? {
|
|
@@ -9360,17 +9586,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9360
9586
|
} : {}));
|
|
9361
9587
|
|
|
9362
9588
|
case 2:
|
|
9363
|
-
return
|
|
9589
|
+
return _context43.abrupt("return", _context43.sent);
|
|
9364
9590
|
|
|
9365
9591
|
case 3:
|
|
9366
9592
|
case "end":
|
|
9367
|
-
return
|
|
9593
|
+
return _context43.stop();
|
|
9368
9594
|
}
|
|
9369
9595
|
}
|
|
9370
|
-
},
|
|
9596
|
+
}, _callee43, this);
|
|
9371
9597
|
}));
|
|
9372
9598
|
|
|
9373
|
-
function unmuteUser(
|
|
9599
|
+
function unmuteUser(_x56, _x57) {
|
|
9374
9600
|
return _unmuteUser.apply(this, arguments);
|
|
9375
9601
|
}
|
|
9376
9602
|
|
|
@@ -9405,31 +9631,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9405
9631
|
}, {
|
|
9406
9632
|
key: "flagMessage",
|
|
9407
9633
|
value: function () {
|
|
9408
|
-
var _flagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9634
|
+
var _flagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee44(targetMessageID) {
|
|
9409
9635
|
var options,
|
|
9410
|
-
|
|
9411
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9636
|
+
_args44 = arguments;
|
|
9637
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee44$(_context44) {
|
|
9412
9638
|
while (1) {
|
|
9413
|
-
switch (
|
|
9639
|
+
switch (_context44.prev = _context44.next) {
|
|
9414
9640
|
case 0:
|
|
9415
|
-
options =
|
|
9416
|
-
|
|
9641
|
+
options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
|
|
9642
|
+
_context44.next = 3;
|
|
9417
9643
|
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
9418
9644
|
target_message_id: targetMessageID
|
|
9419
9645
|
}, options));
|
|
9420
9646
|
|
|
9421
9647
|
case 3:
|
|
9422
|
-
return
|
|
9648
|
+
return _context44.abrupt("return", _context44.sent);
|
|
9423
9649
|
|
|
9424
9650
|
case 4:
|
|
9425
9651
|
case "end":
|
|
9426
|
-
return
|
|
9652
|
+
return _context44.stop();
|
|
9427
9653
|
}
|
|
9428
9654
|
}
|
|
9429
|
-
},
|
|
9655
|
+
}, _callee44, this);
|
|
9430
9656
|
}));
|
|
9431
9657
|
|
|
9432
|
-
function flagMessage(
|
|
9658
|
+
function flagMessage(_x58) {
|
|
9433
9659
|
return _flagMessage.apply(this, arguments);
|
|
9434
9660
|
}
|
|
9435
9661
|
|
|
@@ -9445,31 +9671,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9445
9671
|
}, {
|
|
9446
9672
|
key: "flagUser",
|
|
9447
9673
|
value: function () {
|
|
9448
|
-
var _flagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9674
|
+
var _flagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee45(targetID) {
|
|
9449
9675
|
var options,
|
|
9450
|
-
|
|
9451
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9676
|
+
_args45 = arguments;
|
|
9677
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee45$(_context45) {
|
|
9452
9678
|
while (1) {
|
|
9453
|
-
switch (
|
|
9679
|
+
switch (_context45.prev = _context45.next) {
|
|
9454
9680
|
case 0:
|
|
9455
|
-
options =
|
|
9456
|
-
|
|
9681
|
+
options = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {};
|
|
9682
|
+
_context45.next = 3;
|
|
9457
9683
|
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
9458
9684
|
target_user_id: targetID
|
|
9459
9685
|
}, options));
|
|
9460
9686
|
|
|
9461
9687
|
case 3:
|
|
9462
|
-
return
|
|
9688
|
+
return _context45.abrupt("return", _context45.sent);
|
|
9463
9689
|
|
|
9464
9690
|
case 4:
|
|
9465
9691
|
case "end":
|
|
9466
|
-
return
|
|
9692
|
+
return _context45.stop();
|
|
9467
9693
|
}
|
|
9468
9694
|
}
|
|
9469
|
-
},
|
|
9695
|
+
}, _callee45, this);
|
|
9470
9696
|
}));
|
|
9471
9697
|
|
|
9472
|
-
function flagUser(
|
|
9698
|
+
function flagUser(_x59) {
|
|
9473
9699
|
return _flagUser.apply(this, arguments);
|
|
9474
9700
|
}
|
|
9475
9701
|
|
|
@@ -9485,31 +9711,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9485
9711
|
}, {
|
|
9486
9712
|
key: "unflagMessage",
|
|
9487
9713
|
value: function () {
|
|
9488
|
-
var _unflagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9714
|
+
var _unflagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee46(targetMessageID) {
|
|
9489
9715
|
var options,
|
|
9490
|
-
|
|
9491
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9716
|
+
_args46 = arguments;
|
|
9717
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee46$(_context46) {
|
|
9492
9718
|
while (1) {
|
|
9493
|
-
switch (
|
|
9719
|
+
switch (_context46.prev = _context46.next) {
|
|
9494
9720
|
case 0:
|
|
9495
|
-
options =
|
|
9496
|
-
|
|
9721
|
+
options = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
|
|
9722
|
+
_context46.next = 3;
|
|
9497
9723
|
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
9498
9724
|
target_message_id: targetMessageID
|
|
9499
9725
|
}, options));
|
|
9500
9726
|
|
|
9501
9727
|
case 3:
|
|
9502
|
-
return
|
|
9728
|
+
return _context46.abrupt("return", _context46.sent);
|
|
9503
9729
|
|
|
9504
9730
|
case 4:
|
|
9505
9731
|
case "end":
|
|
9506
|
-
return
|
|
9732
|
+
return _context46.stop();
|
|
9507
9733
|
}
|
|
9508
9734
|
}
|
|
9509
|
-
},
|
|
9735
|
+
}, _callee46, this);
|
|
9510
9736
|
}));
|
|
9511
9737
|
|
|
9512
|
-
function unflagMessage(
|
|
9738
|
+
function unflagMessage(_x60) {
|
|
9513
9739
|
return _unflagMessage.apply(this, arguments);
|
|
9514
9740
|
}
|
|
9515
9741
|
|
|
@@ -9525,31 +9751,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9525
9751
|
}, {
|
|
9526
9752
|
key: "unflagUser",
|
|
9527
9753
|
value: function () {
|
|
9528
|
-
var _unflagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9754
|
+
var _unflagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee47(targetID) {
|
|
9529
9755
|
var options,
|
|
9530
|
-
|
|
9531
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9756
|
+
_args47 = arguments;
|
|
9757
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee47$(_context47) {
|
|
9532
9758
|
while (1) {
|
|
9533
|
-
switch (
|
|
9759
|
+
switch (_context47.prev = _context47.next) {
|
|
9534
9760
|
case 0:
|
|
9535
|
-
options =
|
|
9536
|
-
|
|
9761
|
+
options = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {};
|
|
9762
|
+
_context47.next = 3;
|
|
9537
9763
|
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
9538
9764
|
target_user_id: targetID
|
|
9539
9765
|
}, options));
|
|
9540
9766
|
|
|
9541
9767
|
case 3:
|
|
9542
|
-
return
|
|
9768
|
+
return _context47.abrupt("return", _context47.sent);
|
|
9543
9769
|
|
|
9544
9770
|
case 4:
|
|
9545
9771
|
case "end":
|
|
9546
|
-
return
|
|
9772
|
+
return _context47.stop();
|
|
9547
9773
|
}
|
|
9548
9774
|
}
|
|
9549
|
-
},
|
|
9775
|
+
}, _callee47, this);
|
|
9550
9776
|
}));
|
|
9551
9777
|
|
|
9552
|
-
function unflagUser(
|
|
9778
|
+
function unflagUser(_x61) {
|
|
9553
9779
|
return _unflagUser.apply(this, arguments);
|
|
9554
9780
|
}
|
|
9555
9781
|
|
|
@@ -9566,29 +9792,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9566
9792
|
}, {
|
|
9567
9793
|
key: "getCallToken",
|
|
9568
9794
|
value: function () {
|
|
9569
|
-
var _getCallToken = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9795
|
+
var _getCallToken = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee48(callID) {
|
|
9570
9796
|
var options,
|
|
9571
|
-
|
|
9572
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9797
|
+
_args48 = arguments;
|
|
9798
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee48$(_context48) {
|
|
9573
9799
|
while (1) {
|
|
9574
|
-
switch (
|
|
9800
|
+
switch (_context48.prev = _context48.next) {
|
|
9575
9801
|
case 0:
|
|
9576
|
-
options =
|
|
9577
|
-
|
|
9802
|
+
options = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {};
|
|
9803
|
+
_context48.next = 3;
|
|
9578
9804
|
return this.post(this.baseURL + "/calls/".concat(callID), _objectSpread({}, options));
|
|
9579
9805
|
|
|
9580
9806
|
case 3:
|
|
9581
|
-
return
|
|
9807
|
+
return _context48.abrupt("return", _context48.sent);
|
|
9582
9808
|
|
|
9583
9809
|
case 4:
|
|
9584
9810
|
case "end":
|
|
9585
|
-
return
|
|
9811
|
+
return _context48.stop();
|
|
9586
9812
|
}
|
|
9587
9813
|
}
|
|
9588
|
-
},
|
|
9814
|
+
}, _callee48, this);
|
|
9589
9815
|
}));
|
|
9590
9816
|
|
|
9591
|
-
function getCallToken(
|
|
9817
|
+
function getCallToken(_x62) {
|
|
9592
9818
|
return _getCallToken.apply(this, arguments);
|
|
9593
9819
|
}
|
|
9594
9820
|
|
|
@@ -9611,30 +9837,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9611
9837
|
}, {
|
|
9612
9838
|
key: "_queryFlags",
|
|
9613
9839
|
value: function () {
|
|
9614
|
-
var _queryFlags2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9840
|
+
var _queryFlags2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee49() {
|
|
9615
9841
|
var filterConditions,
|
|
9616
9842
|
options,
|
|
9617
|
-
|
|
9618
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9843
|
+
_args49 = arguments;
|
|
9844
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee49$(_context49) {
|
|
9619
9845
|
while (1) {
|
|
9620
|
-
switch (
|
|
9846
|
+
switch (_context49.prev = _context49.next) {
|
|
9621
9847
|
case 0:
|
|
9622
|
-
filterConditions =
|
|
9623
|
-
options =
|
|
9624
|
-
|
|
9848
|
+
filterConditions = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : {};
|
|
9849
|
+
options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
|
|
9850
|
+
_context49.next = 4;
|
|
9625
9851
|
return this.post(this.baseURL + '/moderation/flags', _objectSpread({
|
|
9626
9852
|
filter_conditions: filterConditions
|
|
9627
9853
|
}, options));
|
|
9628
9854
|
|
|
9629
9855
|
case 4:
|
|
9630
|
-
return
|
|
9856
|
+
return _context49.abrupt("return", _context49.sent);
|
|
9631
9857
|
|
|
9632
9858
|
case 5:
|
|
9633
9859
|
case "end":
|
|
9634
|
-
return
|
|
9860
|
+
return _context49.stop();
|
|
9635
9861
|
}
|
|
9636
9862
|
}
|
|
9637
|
-
},
|
|
9863
|
+
}, _callee49, this);
|
|
9638
9864
|
}));
|
|
9639
9865
|
|
|
9640
9866
|
function _queryFlags() {
|
|
@@ -9660,30 +9886,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9660
9886
|
}, {
|
|
9661
9887
|
key: "_queryFlagReports",
|
|
9662
9888
|
value: function () {
|
|
9663
|
-
var _queryFlagReports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9889
|
+
var _queryFlagReports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee50() {
|
|
9664
9890
|
var filterConditions,
|
|
9665
9891
|
options,
|
|
9666
|
-
|
|
9667
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9892
|
+
_args50 = arguments;
|
|
9893
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee50$(_context50) {
|
|
9668
9894
|
while (1) {
|
|
9669
|
-
switch (
|
|
9895
|
+
switch (_context50.prev = _context50.next) {
|
|
9670
9896
|
case 0:
|
|
9671
|
-
filterConditions =
|
|
9672
|
-
options =
|
|
9673
|
-
|
|
9897
|
+
filterConditions = _args50.length > 0 && _args50[0] !== undefined ? _args50[0] : {};
|
|
9898
|
+
options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
|
|
9899
|
+
_context50.next = 4;
|
|
9674
9900
|
return this.post(this.baseURL + '/moderation/reports', _objectSpread({
|
|
9675
9901
|
filter_conditions: filterConditions
|
|
9676
9902
|
}, options));
|
|
9677
9903
|
|
|
9678
9904
|
case 4:
|
|
9679
|
-
return
|
|
9905
|
+
return _context50.abrupt("return", _context50.sent);
|
|
9680
9906
|
|
|
9681
9907
|
case 5:
|
|
9682
9908
|
case "end":
|
|
9683
|
-
return
|
|
9909
|
+
return _context50.stop();
|
|
9684
9910
|
}
|
|
9685
9911
|
}
|
|
9686
|
-
},
|
|
9912
|
+
}, _callee50, this);
|
|
9687
9913
|
}));
|
|
9688
9914
|
|
|
9689
9915
|
function _queryFlagReports() {
|
|
@@ -9710,31 +9936,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9710
9936
|
}, {
|
|
9711
9937
|
key: "_reviewFlagReport",
|
|
9712
9938
|
value: function () {
|
|
9713
|
-
var _reviewFlagReport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9939
|
+
var _reviewFlagReport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee51(id, reviewResult) {
|
|
9714
9940
|
var options,
|
|
9715
|
-
|
|
9716
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9941
|
+
_args51 = arguments;
|
|
9942
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee51$(_context51) {
|
|
9717
9943
|
while (1) {
|
|
9718
|
-
switch (
|
|
9944
|
+
switch (_context51.prev = _context51.next) {
|
|
9719
9945
|
case 0:
|
|
9720
|
-
options =
|
|
9721
|
-
|
|
9946
|
+
options = _args51.length > 2 && _args51[2] !== undefined ? _args51[2] : {};
|
|
9947
|
+
_context51.next = 3;
|
|
9722
9948
|
return this.patch(this.baseURL + "/moderation/reports/".concat(id), _objectSpread({
|
|
9723
9949
|
review_result: reviewResult
|
|
9724
9950
|
}, options));
|
|
9725
9951
|
|
|
9726
9952
|
case 3:
|
|
9727
|
-
return
|
|
9953
|
+
return _context51.abrupt("return", _context51.sent);
|
|
9728
9954
|
|
|
9729
9955
|
case 4:
|
|
9730
9956
|
case "end":
|
|
9731
|
-
return
|
|
9957
|
+
return _context51.stop();
|
|
9732
9958
|
}
|
|
9733
9959
|
}
|
|
9734
|
-
},
|
|
9960
|
+
}, _callee51, this);
|
|
9735
9961
|
}));
|
|
9736
9962
|
|
|
9737
|
-
function _reviewFlagReport(
|
|
9963
|
+
function _reviewFlagReport(_x63, _x64) {
|
|
9738
9964
|
return _reviewFlagReport2.apply(this, arguments);
|
|
9739
9965
|
}
|
|
9740
9966
|
|
|
@@ -9752,31 +9978,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9752
9978
|
}, {
|
|
9753
9979
|
key: "unblockMessage",
|
|
9754
9980
|
value: function () {
|
|
9755
|
-
var _unblockMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9981
|
+
var _unblockMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee52(targetMessageID) {
|
|
9756
9982
|
var options,
|
|
9757
|
-
|
|
9758
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9983
|
+
_args52 = arguments;
|
|
9984
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee52$(_context52) {
|
|
9759
9985
|
while (1) {
|
|
9760
|
-
switch (
|
|
9986
|
+
switch (_context52.prev = _context52.next) {
|
|
9761
9987
|
case 0:
|
|
9762
|
-
options =
|
|
9763
|
-
|
|
9988
|
+
options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
9989
|
+
_context52.next = 3;
|
|
9764
9990
|
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
|
|
9765
9991
|
target_message_id: targetMessageID
|
|
9766
9992
|
}, options));
|
|
9767
9993
|
|
|
9768
9994
|
case 3:
|
|
9769
|
-
return
|
|
9995
|
+
return _context52.abrupt("return", _context52.sent);
|
|
9770
9996
|
|
|
9771
9997
|
case 4:
|
|
9772
9998
|
case "end":
|
|
9773
|
-
return
|
|
9999
|
+
return _context52.stop();
|
|
9774
10000
|
}
|
|
9775
10001
|
}
|
|
9776
|
-
},
|
|
10002
|
+
}, _callee52, this);
|
|
9777
10003
|
}));
|
|
9778
10004
|
|
|
9779
|
-
function unblockMessage(
|
|
10005
|
+
function unblockMessage(_x65) {
|
|
9780
10006
|
return _unblockMessage.apply(this, arguments);
|
|
9781
10007
|
}
|
|
9782
10008
|
|
|
@@ -9795,23 +10021,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9795
10021
|
* @return {Promise<APIResponse>}
|
|
9796
10022
|
*/
|
|
9797
10023
|
function () {
|
|
9798
|
-
var _markChannelsRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
10024
|
+
var _markChannelsRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee53() {
|
|
9799
10025
|
var data,
|
|
9800
|
-
|
|
9801
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10026
|
+
_args53 = arguments;
|
|
10027
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee53$(_context53) {
|
|
9802
10028
|
while (1) {
|
|
9803
|
-
switch (
|
|
10029
|
+
switch (_context53.prev = _context53.next) {
|
|
9804
10030
|
case 0:
|
|
9805
|
-
data =
|
|
9806
|
-
|
|
10031
|
+
data = _args53.length > 0 && _args53[0] !== undefined ? _args53[0] : {};
|
|
10032
|
+
_context53.next = 3;
|
|
9807
10033
|
return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
|
|
9808
10034
|
|
|
9809
10035
|
case 3:
|
|
9810
10036
|
case "end":
|
|
9811
|
-
return
|
|
10037
|
+
return _context53.stop();
|
|
9812
10038
|
}
|
|
9813
10039
|
}
|
|
9814
|
-
},
|
|
10040
|
+
}, _callee53, this);
|
|
9815
10041
|
}));
|
|
9816
10042
|
|
|
9817
10043
|
function markChannelsRead() {
|
|
@@ -9886,28 +10112,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9886
10112
|
}, {
|
|
9887
10113
|
key: "translateMessage",
|
|
9888
10114
|
value: function () {
|
|
9889
|
-
var _translateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9890
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10115
|
+
var _translateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee54(messageId, language) {
|
|
10116
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee54$(_context54) {
|
|
9891
10117
|
while (1) {
|
|
9892
|
-
switch (
|
|
10118
|
+
switch (_context54.prev = _context54.next) {
|
|
9893
10119
|
case 0:
|
|
9894
|
-
|
|
10120
|
+
_context54.next = 2;
|
|
9895
10121
|
return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
|
|
9896
10122
|
language: language
|
|
9897
10123
|
});
|
|
9898
10124
|
|
|
9899
10125
|
case 2:
|
|
9900
|
-
return
|
|
10126
|
+
return _context54.abrupt("return", _context54.sent);
|
|
9901
10127
|
|
|
9902
10128
|
case 3:
|
|
9903
10129
|
case "end":
|
|
9904
|
-
return
|
|
10130
|
+
return _context54.stop();
|
|
9905
10131
|
}
|
|
9906
10132
|
}
|
|
9907
|
-
},
|
|
10133
|
+
}, _callee54, this);
|
|
9908
10134
|
}));
|
|
9909
10135
|
|
|
9910
|
-
function translateMessage(
|
|
10136
|
+
function translateMessage(_x66, _x67) {
|
|
9911
10137
|
return _translateMessage.apply(this, arguments);
|
|
9912
10138
|
}
|
|
9913
10139
|
|
|
@@ -10009,14 +10235,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10009
10235
|
}, {
|
|
10010
10236
|
key: "updateMessage",
|
|
10011
10237
|
value: function () {
|
|
10012
|
-
var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
10238
|
+
var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee55(message, userId, options) {
|
|
10013
10239
|
var clonedMessage, reservedMessageFields;
|
|
10014
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10240
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee55$(_context55) {
|
|
10015
10241
|
while (1) {
|
|
10016
|
-
switch (
|
|
10242
|
+
switch (_context55.prev = _context55.next) {
|
|
10017
10243
|
case 0:
|
|
10018
10244
|
if (message.id) {
|
|
10019
|
-
|
|
10245
|
+
_context55.next = 2;
|
|
10020
10246
|
break;
|
|
10021
10247
|
}
|
|
10022
10248
|
|
|
@@ -10053,158 +10279,345 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10053
10279
|
});
|
|
10054
10280
|
}
|
|
10055
10281
|
|
|
10056
|
-
|
|
10282
|
+
_context55.next = 10;
|
|
10057
10283
|
return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
|
|
10058
10284
|
message: clonedMessage
|
|
10059
10285
|
}, options));
|
|
10060
10286
|
|
|
10061
10287
|
case 10:
|
|
10062
|
-
return
|
|
10288
|
+
return _context55.abrupt("return", _context55.sent);
|
|
10063
10289
|
|
|
10064
10290
|
case 11:
|
|
10065
10291
|
case "end":
|
|
10066
|
-
return
|
|
10292
|
+
return _context55.stop();
|
|
10067
10293
|
}
|
|
10068
10294
|
}
|
|
10069
|
-
},
|
|
10295
|
+
}, _callee55, this);
|
|
10296
|
+
}));
|
|
10297
|
+
|
|
10298
|
+
function updateMessage(_x68, _x69, _x70) {
|
|
10299
|
+
return _updateMessage.apply(this, arguments);
|
|
10300
|
+
}
|
|
10301
|
+
|
|
10302
|
+
return updateMessage;
|
|
10303
|
+
}()
|
|
10304
|
+
/**
|
|
10305
|
+
* partialUpdateMessage - Update the given message id while retaining additional properties
|
|
10306
|
+
*
|
|
10307
|
+
* @param {string} id the message id
|
|
10308
|
+
*
|
|
10309
|
+
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
10310
|
+
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
10311
|
+
* @param {string | { id: string }} [userId]
|
|
10312
|
+
*
|
|
10313
|
+
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
10314
|
+
*
|
|
10315
|
+
* @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
|
|
10316
|
+
*/
|
|
10317
|
+
|
|
10318
|
+
}, {
|
|
10319
|
+
key: "partialUpdateMessage",
|
|
10320
|
+
value: function () {
|
|
10321
|
+
var _partialUpdateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee56(id, partialMessageObject, userId, options) {
|
|
10322
|
+
var user;
|
|
10323
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee56$(_context56) {
|
|
10324
|
+
while (1) {
|
|
10325
|
+
switch (_context56.prev = _context56.next) {
|
|
10326
|
+
case 0:
|
|
10327
|
+
if (id) {
|
|
10328
|
+
_context56.next = 2;
|
|
10329
|
+
break;
|
|
10330
|
+
}
|
|
10331
|
+
|
|
10332
|
+
throw Error('Please specify the message id when calling partialUpdateMessage');
|
|
10333
|
+
|
|
10334
|
+
case 2:
|
|
10335
|
+
user = userId;
|
|
10336
|
+
|
|
10337
|
+
if (userId != null && isString(userId)) {
|
|
10338
|
+
user = {
|
|
10339
|
+
id: userId
|
|
10340
|
+
};
|
|
10341
|
+
}
|
|
10342
|
+
|
|
10343
|
+
_context56.next = 6;
|
|
10344
|
+
return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
|
|
10345
|
+
user: user
|
|
10346
|
+
}));
|
|
10347
|
+
|
|
10348
|
+
case 6:
|
|
10349
|
+
return _context56.abrupt("return", _context56.sent);
|
|
10350
|
+
|
|
10351
|
+
case 7:
|
|
10352
|
+
case "end":
|
|
10353
|
+
return _context56.stop();
|
|
10354
|
+
}
|
|
10355
|
+
}
|
|
10356
|
+
}, _callee56, this);
|
|
10357
|
+
}));
|
|
10358
|
+
|
|
10359
|
+
function partialUpdateMessage(_x71, _x72, _x73, _x74) {
|
|
10360
|
+
return _partialUpdateMessage.apply(this, arguments);
|
|
10361
|
+
}
|
|
10362
|
+
|
|
10363
|
+
return partialUpdateMessage;
|
|
10364
|
+
}()
|
|
10365
|
+
}, {
|
|
10366
|
+
key: "deleteMessage",
|
|
10367
|
+
value: function () {
|
|
10368
|
+
var _deleteMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee57(messageID, hardDelete) {
|
|
10369
|
+
var params;
|
|
10370
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee57$(_context57) {
|
|
10371
|
+
while (1) {
|
|
10372
|
+
switch (_context57.prev = _context57.next) {
|
|
10373
|
+
case 0:
|
|
10374
|
+
params = {};
|
|
10375
|
+
|
|
10376
|
+
if (hardDelete) {
|
|
10377
|
+
params = {
|
|
10378
|
+
hard: true
|
|
10379
|
+
};
|
|
10380
|
+
}
|
|
10381
|
+
|
|
10382
|
+
_context57.next = 4;
|
|
10383
|
+
return this.delete(this.baseURL + "/messages/".concat(messageID), params);
|
|
10384
|
+
|
|
10385
|
+
case 4:
|
|
10386
|
+
return _context57.abrupt("return", _context57.sent);
|
|
10387
|
+
|
|
10388
|
+
case 5:
|
|
10389
|
+
case "end":
|
|
10390
|
+
return _context57.stop();
|
|
10391
|
+
}
|
|
10392
|
+
}
|
|
10393
|
+
}, _callee57, this);
|
|
10394
|
+
}));
|
|
10395
|
+
|
|
10396
|
+
function deleteMessage(_x75, _x76) {
|
|
10397
|
+
return _deleteMessage.apply(this, arguments);
|
|
10398
|
+
}
|
|
10399
|
+
|
|
10400
|
+
return deleteMessage;
|
|
10401
|
+
}()
|
|
10402
|
+
}, {
|
|
10403
|
+
key: "getMessage",
|
|
10404
|
+
value: function () {
|
|
10405
|
+
var _getMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee58(messageID) {
|
|
10406
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee58$(_context58) {
|
|
10407
|
+
while (1) {
|
|
10408
|
+
switch (_context58.prev = _context58.next) {
|
|
10409
|
+
case 0:
|
|
10410
|
+
_context58.next = 2;
|
|
10411
|
+
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
|
|
10412
|
+
|
|
10413
|
+
case 2:
|
|
10414
|
+
return _context58.abrupt("return", _context58.sent);
|
|
10415
|
+
|
|
10416
|
+
case 3:
|
|
10417
|
+
case "end":
|
|
10418
|
+
return _context58.stop();
|
|
10419
|
+
}
|
|
10420
|
+
}
|
|
10421
|
+
}, _callee58, this);
|
|
10422
|
+
}));
|
|
10423
|
+
|
|
10424
|
+
function getMessage(_x77) {
|
|
10425
|
+
return _getMessage.apply(this, arguments);
|
|
10426
|
+
}
|
|
10427
|
+
|
|
10428
|
+
return getMessage;
|
|
10429
|
+
}()
|
|
10430
|
+
/**
|
|
10431
|
+
* queryThreads - returns the list of threads of current user.
|
|
10432
|
+
*
|
|
10433
|
+
* @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
|
|
10434
|
+
* @param {number} options.limit Limits the number of threads to be returned.
|
|
10435
|
+
* @param {boolean} options.watch Subscribes the user to the channels of the threads.
|
|
10436
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10437
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10438
|
+
*
|
|
10439
|
+
* @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
|
|
10440
|
+
*/
|
|
10441
|
+
|
|
10442
|
+
}, {
|
|
10443
|
+
key: "queryThreads",
|
|
10444
|
+
value: function () {
|
|
10445
|
+
var _queryThreads = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(options) {
|
|
10446
|
+
var _this5 = this;
|
|
10447
|
+
|
|
10448
|
+
var opts, res;
|
|
10449
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
|
|
10450
|
+
while (1) {
|
|
10451
|
+
switch (_context59.prev = _context59.next) {
|
|
10452
|
+
case 0:
|
|
10453
|
+
opts = _objectSpread({
|
|
10454
|
+
limit: 10,
|
|
10455
|
+
participant_limit: 10,
|
|
10456
|
+
reply_limit: 3,
|
|
10457
|
+
watch: true
|
|
10458
|
+
}, options);
|
|
10459
|
+
_context59.next = 3;
|
|
10460
|
+
return this.post(this.baseURL + "/threads", opts);
|
|
10461
|
+
|
|
10462
|
+
case 3:
|
|
10463
|
+
res = _context59.sent;
|
|
10464
|
+
return _context59.abrupt("return", {
|
|
10465
|
+
threads: res.threads.map(function (thread) {
|
|
10466
|
+
return new Thread(_this5, thread);
|
|
10467
|
+
}),
|
|
10468
|
+
next: res.next
|
|
10469
|
+
});
|
|
10470
|
+
|
|
10471
|
+
case 5:
|
|
10472
|
+
case "end":
|
|
10473
|
+
return _context59.stop();
|
|
10474
|
+
}
|
|
10475
|
+
}
|
|
10476
|
+
}, _callee59, this);
|
|
10070
10477
|
}));
|
|
10071
10478
|
|
|
10072
|
-
function
|
|
10073
|
-
return
|
|
10479
|
+
function queryThreads(_x78) {
|
|
10480
|
+
return _queryThreads.apply(this, arguments);
|
|
10074
10481
|
}
|
|
10075
10482
|
|
|
10076
|
-
return
|
|
10483
|
+
return queryThreads;
|
|
10077
10484
|
}()
|
|
10078
10485
|
/**
|
|
10079
|
-
*
|
|
10080
|
-
*
|
|
10081
|
-
* @param {string} id the message id
|
|
10082
|
-
*
|
|
10083
|
-
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
10084
|
-
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
10085
|
-
* @param {string | { id: string }} [userId]
|
|
10486
|
+
* getThread - returns the thread of a message by its id.
|
|
10086
10487
|
*
|
|
10087
|
-
* @param {
|
|
10488
|
+
* @param {string} messageId The message id
|
|
10489
|
+
* @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
|
|
10490
|
+
* @param {boolean} options.watch Subscribes the user to the channel of the thread.
|
|
10491
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10492
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10088
10493
|
*
|
|
10089
|
-
* @
|
|
10494
|
+
* @returns {Thread<StreamChatGenerics>} Returns the thread.
|
|
10090
10495
|
*/
|
|
10091
10496
|
|
|
10092
10497
|
}, {
|
|
10093
|
-
key: "
|
|
10498
|
+
key: "getThread",
|
|
10094
10499
|
value: function () {
|
|
10095
|
-
var
|
|
10096
|
-
var
|
|
10097
|
-
|
|
10500
|
+
var _getThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(messageId) {
|
|
10501
|
+
var options,
|
|
10502
|
+
opts,
|
|
10503
|
+
res,
|
|
10504
|
+
_args60 = arguments;
|
|
10505
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
|
|
10098
10506
|
while (1) {
|
|
10099
|
-
switch (
|
|
10507
|
+
switch (_context60.prev = _context60.next) {
|
|
10100
10508
|
case 0:
|
|
10101
|
-
|
|
10102
|
-
|
|
10509
|
+
options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
|
|
10510
|
+
|
|
10511
|
+
if (messageId) {
|
|
10512
|
+
_context60.next = 3;
|
|
10103
10513
|
break;
|
|
10104
10514
|
}
|
|
10105
10515
|
|
|
10106
|
-
throw Error('Please specify the message id when calling
|
|
10107
|
-
|
|
10108
|
-
case 2:
|
|
10109
|
-
user = userId;
|
|
10110
|
-
|
|
10111
|
-
if (userId != null && isString(userId)) {
|
|
10112
|
-
user = {
|
|
10113
|
-
id: userId
|
|
10114
|
-
};
|
|
10115
|
-
}
|
|
10516
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10116
10517
|
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10518
|
+
case 3:
|
|
10519
|
+
opts = _objectSpread({
|
|
10520
|
+
participant_limit: 100,
|
|
10521
|
+
reply_limit: 3,
|
|
10522
|
+
watch: true
|
|
10523
|
+
}, options);
|
|
10524
|
+
_context60.next = 6;
|
|
10525
|
+
return this.get(this.baseURL + "/threads/".concat(messageId), opts);
|
|
10121
10526
|
|
|
10122
10527
|
case 6:
|
|
10123
|
-
|
|
10528
|
+
res = _context60.sent;
|
|
10529
|
+
return _context60.abrupt("return", new Thread(this, res.thread));
|
|
10124
10530
|
|
|
10125
|
-
case
|
|
10531
|
+
case 8:
|
|
10126
10532
|
case "end":
|
|
10127
|
-
return
|
|
10533
|
+
return _context60.stop();
|
|
10128
10534
|
}
|
|
10129
10535
|
}
|
|
10130
|
-
},
|
|
10536
|
+
}, _callee60, this);
|
|
10131
10537
|
}));
|
|
10132
10538
|
|
|
10133
|
-
function
|
|
10134
|
-
return
|
|
10539
|
+
function getThread(_x79) {
|
|
10540
|
+
return _getThread.apply(this, arguments);
|
|
10135
10541
|
}
|
|
10136
10542
|
|
|
10137
|
-
return
|
|
10543
|
+
return getThread;
|
|
10138
10544
|
}()
|
|
10545
|
+
/**
|
|
10546
|
+
* partialUpdateThread - updates the given thread
|
|
10547
|
+
*
|
|
10548
|
+
* @param {string} messageId The id of the thread message which needs to be updated.
|
|
10549
|
+
* @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
|
|
10550
|
+
*
|
|
10551
|
+
* @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
|
|
10552
|
+
*/
|
|
10553
|
+
|
|
10139
10554
|
}, {
|
|
10140
|
-
key: "
|
|
10555
|
+
key: "partialUpdateThread",
|
|
10141
10556
|
value: function () {
|
|
10142
|
-
var
|
|
10143
|
-
var
|
|
10144
|
-
|
|
10557
|
+
var _partialUpdateThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(messageId, partialThreadObject) {
|
|
10558
|
+
var reservedThreadFields, _key5;
|
|
10559
|
+
|
|
10560
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
|
|
10145
10561
|
while (1) {
|
|
10146
|
-
switch (
|
|
10562
|
+
switch (_context61.prev = _context61.next) {
|
|
10147
10563
|
case 0:
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
params = {
|
|
10152
|
-
hard: true
|
|
10153
|
-
};
|
|
10564
|
+
if (messageId) {
|
|
10565
|
+
_context61.next = 2;
|
|
10566
|
+
break;
|
|
10154
10567
|
}
|
|
10155
10568
|
|
|
10156
|
-
|
|
10157
|
-
|
|
10569
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10570
|
+
|
|
10571
|
+
case 2:
|
|
10572
|
+
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
10573
|
+
// Throw error if any of the reserved field is found.
|
|
10574
|
+
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
|
|
10575
|
+
_context61.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
10158
10576
|
|
|
10159
10577
|
case 4:
|
|
10160
|
-
|
|
10578
|
+
if ((_context61.t1 = _context61.t0()).done) {
|
|
10579
|
+
_context61.next = 10;
|
|
10580
|
+
break;
|
|
10581
|
+
}
|
|
10161
10582
|
|
|
10162
|
-
|
|
10163
|
-
case "end":
|
|
10164
|
-
return _context56.stop();
|
|
10165
|
-
}
|
|
10166
|
-
}
|
|
10167
|
-
}, _callee56, this);
|
|
10168
|
-
}));
|
|
10583
|
+
_key5 = _context61.t1.value;
|
|
10169
10584
|
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10585
|
+
if (!reservedThreadFields.includes(_key5)) {
|
|
10586
|
+
_context61.next = 8;
|
|
10587
|
+
break;
|
|
10588
|
+
}
|
|
10173
10589
|
|
|
10174
|
-
|
|
10175
|
-
}()
|
|
10176
|
-
}, {
|
|
10177
|
-
key: "getMessage",
|
|
10178
|
-
value: function () {
|
|
10179
|
-
var _getMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee57(messageID) {
|
|
10180
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee57$(_context57) {
|
|
10181
|
-
while (1) {
|
|
10182
|
-
switch (_context57.prev = _context57.next) {
|
|
10183
|
-
case 0:
|
|
10184
|
-
_context57.next = 2;
|
|
10185
|
-
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
|
|
10590
|
+
throw Error("You cannot set ".concat(_key5, " field on Thread object. ").concat(_key5, " is reserved for server-side use. Please omit ").concat(_key5, " from your set object."));
|
|
10186
10591
|
|
|
10187
|
-
case
|
|
10188
|
-
|
|
10592
|
+
case 8:
|
|
10593
|
+
_context61.next = 4;
|
|
10594
|
+
break;
|
|
10189
10595
|
|
|
10190
|
-
case
|
|
10596
|
+
case 10:
|
|
10597
|
+
_context61.next = 12;
|
|
10598
|
+
return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
|
|
10599
|
+
|
|
10600
|
+
case 12:
|
|
10601
|
+
return _context61.abrupt("return", _context61.sent);
|
|
10602
|
+
|
|
10603
|
+
case 13:
|
|
10191
10604
|
case "end":
|
|
10192
|
-
return
|
|
10605
|
+
return _context61.stop();
|
|
10193
10606
|
}
|
|
10194
10607
|
}
|
|
10195
|
-
},
|
|
10608
|
+
}, _callee61, this);
|
|
10196
10609
|
}));
|
|
10197
10610
|
|
|
10198
|
-
function
|
|
10199
|
-
return
|
|
10611
|
+
function partialUpdateThread(_x80, _x81) {
|
|
10612
|
+
return _partialUpdateThread.apply(this, arguments);
|
|
10200
10613
|
}
|
|
10201
10614
|
|
|
10202
|
-
return
|
|
10615
|
+
return partialUpdateThread;
|
|
10203
10616
|
}()
|
|
10204
10617
|
}, {
|
|
10205
10618
|
key: "getUserAgent",
|
|
10206
10619
|
value: function getUserAgent() {
|
|
10207
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
10620
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
|
|
10208
10621
|
}
|
|
10209
10622
|
}, {
|
|
10210
10623
|
key: "setUserAgent",
|
|
@@ -10423,28 +10836,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10423
10836
|
}, {
|
|
10424
10837
|
key: "sendUserCustomEvent",
|
|
10425
10838
|
value: function () {
|
|
10426
|
-
var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
10427
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10839
|
+
var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(targetUserID, event) {
|
|
10840
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
|
|
10428
10841
|
while (1) {
|
|
10429
|
-
switch (
|
|
10842
|
+
switch (_context62.prev = _context62.next) {
|
|
10430
10843
|
case 0:
|
|
10431
|
-
|
|
10844
|
+
_context62.next = 2;
|
|
10432
10845
|
return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
|
|
10433
10846
|
event: event
|
|
10434
10847
|
});
|
|
10435
10848
|
|
|
10436
10849
|
case 2:
|
|
10437
|
-
return
|
|
10850
|
+
return _context62.abrupt("return", _context62.sent);
|
|
10438
10851
|
|
|
10439
10852
|
case 3:
|
|
10440
10853
|
case "end":
|
|
10441
|
-
return
|
|
10854
|
+
return _context62.stop();
|
|
10442
10855
|
}
|
|
10443
10856
|
}
|
|
10444
|
-
},
|
|
10857
|
+
}, _callee62, this);
|
|
10445
10858
|
}));
|
|
10446
10859
|
|
|
10447
|
-
function sendUserCustomEvent(
|
|
10860
|
+
function sendUserCustomEvent(_x82, _x83) {
|
|
10448
10861
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
10449
10862
|
}
|
|
10450
10863
|
|
|
@@ -10502,50 +10915,259 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10502
10915
|
return this.get("".concat(this.baseURL, "/export_channels/").concat(id));
|
|
10503
10916
|
}
|
|
10504
10917
|
/**
|
|
10505
|
-
* createSegment - Creates a
|
|
10918
|
+
* createSegment - Creates a segment
|
|
10919
|
+
*
|
|
10920
|
+
* @private
|
|
10921
|
+
* @param {SegmentType} type Segment type
|
|
10922
|
+
* @param {string} id Segment ID (valid UUID)
|
|
10923
|
+
* @param {string} name Segment name (valid UUID)
|
|
10924
|
+
* @param {SegmentData} params Segment data
|
|
10925
|
+
*
|
|
10926
|
+
* @return {Segment} The created Segment
|
|
10927
|
+
*/
|
|
10928
|
+
|
|
10929
|
+
}, {
|
|
10930
|
+
key: "createSegment",
|
|
10931
|
+
value: function () {
|
|
10932
|
+
var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(type, id, name, data) {
|
|
10933
|
+
var body, _yield$this$post, segment;
|
|
10934
|
+
|
|
10935
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
|
|
10936
|
+
while (1) {
|
|
10937
|
+
switch (_context63.prev = _context63.next) {
|
|
10938
|
+
case 0:
|
|
10939
|
+
body = {
|
|
10940
|
+
id: id,
|
|
10941
|
+
type: type,
|
|
10942
|
+
name: name,
|
|
10943
|
+
data: data
|
|
10944
|
+
};
|
|
10945
|
+
_context63.next = 3;
|
|
10946
|
+
return this.post(this.baseURL + "/segments", body);
|
|
10947
|
+
|
|
10948
|
+
case 3:
|
|
10949
|
+
_yield$this$post = _context63.sent;
|
|
10950
|
+
segment = _yield$this$post.segment;
|
|
10951
|
+
return _context63.abrupt("return", segment);
|
|
10952
|
+
|
|
10953
|
+
case 6:
|
|
10954
|
+
case "end":
|
|
10955
|
+
return _context63.stop();
|
|
10956
|
+
}
|
|
10957
|
+
}
|
|
10958
|
+
}, _callee63, this);
|
|
10959
|
+
}));
|
|
10960
|
+
|
|
10961
|
+
function createSegment(_x84, _x85, _x86, _x87) {
|
|
10962
|
+
return _createSegment.apply(this, arguments);
|
|
10963
|
+
}
|
|
10964
|
+
|
|
10965
|
+
return createSegment;
|
|
10966
|
+
}()
|
|
10967
|
+
/**
|
|
10968
|
+
* createUserSegment - Creates a user segment
|
|
10969
|
+
*
|
|
10970
|
+
* @param {string} id Segment ID (valid UUID)
|
|
10971
|
+
* @param {string} name Segment name
|
|
10972
|
+
* @param {SegmentData} data Segment data
|
|
10973
|
+
*
|
|
10974
|
+
* @return {Segment} The created Segment
|
|
10975
|
+
*/
|
|
10976
|
+
|
|
10977
|
+
}, {
|
|
10978
|
+
key: "createUserSegment",
|
|
10979
|
+
value: function () {
|
|
10980
|
+
var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, name, data) {
|
|
10981
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
|
|
10982
|
+
while (1) {
|
|
10983
|
+
switch (_context64.prev = _context64.next) {
|
|
10984
|
+
case 0:
|
|
10985
|
+
_context64.next = 2;
|
|
10986
|
+
return this.createSegment('user', id, name, data);
|
|
10987
|
+
|
|
10988
|
+
case 2:
|
|
10989
|
+
return _context64.abrupt("return", _context64.sent);
|
|
10990
|
+
|
|
10991
|
+
case 3:
|
|
10992
|
+
case "end":
|
|
10993
|
+
return _context64.stop();
|
|
10994
|
+
}
|
|
10995
|
+
}
|
|
10996
|
+
}, _callee64, this);
|
|
10997
|
+
}));
|
|
10998
|
+
|
|
10999
|
+
function createUserSegment(_x88, _x89, _x90) {
|
|
11000
|
+
return _createUserSegment.apply(this, arguments);
|
|
11001
|
+
}
|
|
11002
|
+
|
|
11003
|
+
return createUserSegment;
|
|
11004
|
+
}()
|
|
11005
|
+
/**
|
|
11006
|
+
* createChannelSegment - Creates a channel segment
|
|
11007
|
+
*
|
|
11008
|
+
* @param {string} id Segment ID (valid UUID)
|
|
11009
|
+
* @param {string} name Segment name
|
|
11010
|
+
* @param {SegmentData} data Segment data
|
|
11011
|
+
*
|
|
11012
|
+
* @return {Segment} The created Segment
|
|
11013
|
+
*/
|
|
11014
|
+
|
|
11015
|
+
}, {
|
|
11016
|
+
key: "createChannelSegment",
|
|
11017
|
+
value: function () {
|
|
11018
|
+
var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
|
|
11019
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
|
|
11020
|
+
while (1) {
|
|
11021
|
+
switch (_context65.prev = _context65.next) {
|
|
11022
|
+
case 0:
|
|
11023
|
+
_context65.next = 2;
|
|
11024
|
+
return this.createSegment('channel', id, name, data);
|
|
11025
|
+
|
|
11026
|
+
case 2:
|
|
11027
|
+
return _context65.abrupt("return", _context65.sent);
|
|
11028
|
+
|
|
11029
|
+
case 3:
|
|
11030
|
+
case "end":
|
|
11031
|
+
return _context65.stop();
|
|
11032
|
+
}
|
|
11033
|
+
}
|
|
11034
|
+
}, _callee65, this);
|
|
11035
|
+
}));
|
|
11036
|
+
|
|
11037
|
+
function createChannelSegment(_x91, _x92, _x93) {
|
|
11038
|
+
return _createChannelSegment.apply(this, arguments);
|
|
11039
|
+
}
|
|
11040
|
+
|
|
11041
|
+
return createChannelSegment;
|
|
11042
|
+
}()
|
|
11043
|
+
/**
|
|
11044
|
+
* updateSegment - Update a segment
|
|
11045
|
+
*
|
|
11046
|
+
* @param {string} id Segment ID
|
|
11047
|
+
* @param {Partial<UpdateSegmentData>} data Data to update
|
|
11048
|
+
*
|
|
11049
|
+
* @return {Segment} Updated Segment
|
|
11050
|
+
*/
|
|
11051
|
+
|
|
11052
|
+
}, {
|
|
11053
|
+
key: "updateSegment",
|
|
11054
|
+
value: function () {
|
|
11055
|
+
var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
|
|
11056
|
+
var _yield$this$put, segment;
|
|
11057
|
+
|
|
11058
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
|
|
11059
|
+
while (1) {
|
|
11060
|
+
switch (_context66.prev = _context66.next) {
|
|
11061
|
+
case 0:
|
|
11062
|
+
_context66.next = 2;
|
|
11063
|
+
return this.put(this.baseURL + "/segments/".concat(id), data);
|
|
11064
|
+
|
|
11065
|
+
case 2:
|
|
11066
|
+
_yield$this$put = _context66.sent;
|
|
11067
|
+
segment = _yield$this$put.segment;
|
|
11068
|
+
return _context66.abrupt("return", segment);
|
|
11069
|
+
|
|
11070
|
+
case 5:
|
|
11071
|
+
case "end":
|
|
11072
|
+
return _context66.stop();
|
|
11073
|
+
}
|
|
11074
|
+
}
|
|
11075
|
+
}, _callee66, this);
|
|
11076
|
+
}));
|
|
11077
|
+
|
|
11078
|
+
function updateSegment(_x94, _x95) {
|
|
11079
|
+
return _updateSegment.apply(this, arguments);
|
|
11080
|
+
}
|
|
11081
|
+
|
|
11082
|
+
return updateSegment;
|
|
11083
|
+
}()
|
|
11084
|
+
/**
|
|
11085
|
+
* addSegmentTargets - Add targets to a segment
|
|
11086
|
+
*
|
|
11087
|
+
* @param {string} id Segment ID
|
|
11088
|
+
* @param {string[]} targets Targets to add to the segment
|
|
11089
|
+
*
|
|
11090
|
+
* @return {APIResponse} API response
|
|
11091
|
+
*/
|
|
11092
|
+
|
|
11093
|
+
}, {
|
|
11094
|
+
key: "addSegmentTargets",
|
|
11095
|
+
value: function () {
|
|
11096
|
+
var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id, targets) {
|
|
11097
|
+
var body;
|
|
11098
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
|
|
11099
|
+
while (1) {
|
|
11100
|
+
switch (_context67.prev = _context67.next) {
|
|
11101
|
+
case 0:
|
|
11102
|
+
body = {
|
|
11103
|
+
targets: targets
|
|
11104
|
+
};
|
|
11105
|
+
_context67.next = 3;
|
|
11106
|
+
return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
|
|
11107
|
+
|
|
11108
|
+
case 3:
|
|
11109
|
+
return _context67.abrupt("return", _context67.sent);
|
|
11110
|
+
|
|
11111
|
+
case 4:
|
|
11112
|
+
case "end":
|
|
11113
|
+
return _context67.stop();
|
|
11114
|
+
}
|
|
11115
|
+
}
|
|
11116
|
+
}, _callee67, this);
|
|
11117
|
+
}));
|
|
11118
|
+
|
|
11119
|
+
function addSegmentTargets(_x96, _x97) {
|
|
11120
|
+
return _addSegmentTargets.apply(this, arguments);
|
|
11121
|
+
}
|
|
11122
|
+
|
|
11123
|
+
return addSegmentTargets;
|
|
11124
|
+
}()
|
|
11125
|
+
/**
|
|
11126
|
+
* deleteSegmentTargets - Delete targets from a segment
|
|
10506
11127
|
*
|
|
10507
|
-
* @param {
|
|
11128
|
+
* @param {string} id Segment ID
|
|
11129
|
+
* @param {string[]} targets Targets to add to the segment
|
|
10508
11130
|
*
|
|
10509
|
-
* @return {
|
|
11131
|
+
* @return {APIResponse} API response
|
|
10510
11132
|
*/
|
|
10511
11133
|
|
|
10512
11134
|
}, {
|
|
10513
|
-
key: "
|
|
11135
|
+
key: "deleteSegmentTargets",
|
|
10514
11136
|
value: function () {
|
|
10515
|
-
var
|
|
10516
|
-
var
|
|
10517
|
-
|
|
10518
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
|
|
11137
|
+
var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(id, targets) {
|
|
11138
|
+
var body;
|
|
11139
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
|
|
10519
11140
|
while (1) {
|
|
10520
|
-
switch (
|
|
11141
|
+
switch (_context68.prev = _context68.next) {
|
|
10521
11142
|
case 0:
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
11143
|
+
body = {
|
|
11144
|
+
targets: targets
|
|
11145
|
+
};
|
|
11146
|
+
_context68.next = 3;
|
|
11147
|
+
return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
|
|
10526
11148
|
|
|
10527
|
-
case
|
|
10528
|
-
|
|
10529
|
-
segment = _yield$this$post.segment;
|
|
10530
|
-
return _context59.abrupt("return", segment);
|
|
11149
|
+
case 3:
|
|
11150
|
+
return _context68.abrupt("return", _context68.sent);
|
|
10531
11151
|
|
|
10532
|
-
case
|
|
11152
|
+
case 4:
|
|
10533
11153
|
case "end":
|
|
10534
|
-
return
|
|
11154
|
+
return _context68.stop();
|
|
10535
11155
|
}
|
|
10536
11156
|
}
|
|
10537
|
-
},
|
|
11157
|
+
}, _callee68, this);
|
|
10538
11158
|
}));
|
|
10539
11159
|
|
|
10540
|
-
function
|
|
10541
|
-
return
|
|
11160
|
+
function deleteSegmentTargets(_x98, _x99) {
|
|
11161
|
+
return _deleteSegmentTargets.apply(this, arguments);
|
|
10542
11162
|
}
|
|
10543
11163
|
|
|
10544
|
-
return
|
|
11164
|
+
return deleteSegmentTargets;
|
|
10545
11165
|
}()
|
|
10546
11166
|
/**
|
|
10547
|
-
* querySegments - Query
|
|
11167
|
+
* querySegments - Query Segments
|
|
10548
11168
|
*
|
|
11169
|
+
* @param {filter} filter MongoDB style filter conditions
|
|
11170
|
+
* @param {QuerySegmentsOptions} options Options for sorting/paginating the results
|
|
10549
11171
|
*
|
|
10550
11172
|
* @return {Segment[]} Segments
|
|
10551
11173
|
*/
|
|
@@ -10553,112 +11175,110 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10553
11175
|
}, {
|
|
10554
11176
|
key: "querySegments",
|
|
10555
11177
|
value: function () {
|
|
10556
|
-
var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11178
|
+
var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(filter) {
|
|
10557
11179
|
var options,
|
|
10558
|
-
|
|
10559
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11180
|
+
_args69 = arguments;
|
|
11181
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
|
|
10560
11182
|
while (1) {
|
|
10561
|
-
switch (
|
|
11183
|
+
switch (_context69.prev = _context69.next) {
|
|
10562
11184
|
case 0:
|
|
10563
|
-
options =
|
|
10564
|
-
|
|
11185
|
+
options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
|
|
11186
|
+
_context69.next = 3;
|
|
10565
11187
|
return this.get(this.baseURL + "/segments", {
|
|
10566
11188
|
payload: _objectSpread({
|
|
10567
|
-
|
|
11189
|
+
filter: filter
|
|
10568
11190
|
}, options)
|
|
10569
11191
|
});
|
|
10570
11192
|
|
|
10571
11193
|
case 3:
|
|
10572
|
-
return
|
|
11194
|
+
return _context69.abrupt("return", _context69.sent);
|
|
10573
11195
|
|
|
10574
11196
|
case 4:
|
|
10575
11197
|
case "end":
|
|
10576
|
-
return
|
|
11198
|
+
return _context69.stop();
|
|
10577
11199
|
}
|
|
10578
11200
|
}
|
|
10579
|
-
},
|
|
11201
|
+
}, _callee69, this);
|
|
10580
11202
|
}));
|
|
10581
11203
|
|
|
10582
|
-
function querySegments(
|
|
11204
|
+
function querySegments(_x100) {
|
|
10583
11205
|
return _querySegments.apply(this, arguments);
|
|
10584
11206
|
}
|
|
10585
11207
|
|
|
10586
11208
|
return querySegments;
|
|
10587
11209
|
}()
|
|
10588
11210
|
/**
|
|
10589
|
-
*
|
|
11211
|
+
* deleteSegment - Delete a Campaign Segment
|
|
10590
11212
|
*
|
|
10591
11213
|
* @param {string} id Segment ID
|
|
10592
|
-
* @param {Partial<SegmentData>} params Segment data
|
|
10593
11214
|
*
|
|
10594
|
-
* @return {
|
|
11215
|
+
* @return {Promise<APIResponse>} The Server Response
|
|
10595
11216
|
*/
|
|
10596
11217
|
|
|
10597
11218
|
}, {
|
|
10598
|
-
key: "
|
|
11219
|
+
key: "deleteSegment",
|
|
10599
11220
|
value: function () {
|
|
10600
|
-
var
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
|
|
11221
|
+
var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(id) {
|
|
11222
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
|
|
10604
11223
|
while (1) {
|
|
10605
|
-
switch (
|
|
11224
|
+
switch (_context70.prev = _context70.next) {
|
|
10606
11225
|
case 0:
|
|
10607
|
-
|
|
10608
|
-
return this.
|
|
10609
|
-
segment: params
|
|
10610
|
-
});
|
|
11226
|
+
_context70.next = 2;
|
|
11227
|
+
return this.delete(this.baseURL + "/segments/".concat(id));
|
|
10611
11228
|
|
|
10612
11229
|
case 2:
|
|
10613
|
-
|
|
10614
|
-
segment = _yield$this$put.segment;
|
|
10615
|
-
return _context61.abrupt("return", segment);
|
|
11230
|
+
return _context70.abrupt("return", _context70.sent);
|
|
10616
11231
|
|
|
10617
|
-
case
|
|
11232
|
+
case 3:
|
|
10618
11233
|
case "end":
|
|
10619
|
-
return
|
|
11234
|
+
return _context70.stop();
|
|
10620
11235
|
}
|
|
10621
11236
|
}
|
|
10622
|
-
},
|
|
11237
|
+
}, _callee70, this);
|
|
10623
11238
|
}));
|
|
10624
11239
|
|
|
10625
|
-
function
|
|
10626
|
-
return
|
|
11240
|
+
function deleteSegment(_x101) {
|
|
11241
|
+
return _deleteSegment.apply(this, arguments);
|
|
10627
11242
|
}
|
|
10628
11243
|
|
|
10629
|
-
return
|
|
11244
|
+
return deleteSegment;
|
|
10630
11245
|
}()
|
|
10631
11246
|
/**
|
|
10632
|
-
*
|
|
11247
|
+
* segmentTargetExists - Check if a target exists in a segment
|
|
10633
11248
|
*
|
|
10634
|
-
* @param {string}
|
|
11249
|
+
* @param {string} segmentId Segment ID
|
|
11250
|
+
* @param {string} targetId Target ID
|
|
10635
11251
|
*
|
|
10636
11252
|
* @return {Promise<APIResponse>} The Server Response
|
|
10637
11253
|
*/
|
|
10638
11254
|
|
|
10639
11255
|
}, {
|
|
10640
|
-
key: "
|
|
11256
|
+
key: "segmentTargetExists",
|
|
10641
11257
|
value: function () {
|
|
10642
|
-
var
|
|
10643
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11258
|
+
var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(segmentId, targetId) {
|
|
11259
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
|
|
10644
11260
|
while (1) {
|
|
10645
|
-
switch (
|
|
11261
|
+
switch (_context71.prev = _context71.next) {
|
|
10646
11262
|
case 0:
|
|
10647
|
-
|
|
11263
|
+
_context71.next = 2;
|
|
11264
|
+
return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
|
|
10648
11265
|
|
|
10649
|
-
case
|
|
11266
|
+
case 2:
|
|
11267
|
+
return _context71.abrupt("return", _context71.sent);
|
|
11268
|
+
|
|
11269
|
+
case 3:
|
|
10650
11270
|
case "end":
|
|
10651
|
-
return
|
|
11271
|
+
return _context71.stop();
|
|
10652
11272
|
}
|
|
10653
11273
|
}
|
|
10654
|
-
},
|
|
11274
|
+
}, _callee71, this);
|
|
10655
11275
|
}));
|
|
10656
11276
|
|
|
10657
|
-
function
|
|
10658
|
-
return
|
|
11277
|
+
function segmentTargetExists(_x102, _x103) {
|
|
11278
|
+
return _segmentTargetExists.apply(this, arguments);
|
|
10659
11279
|
}
|
|
10660
11280
|
|
|
10661
|
-
return
|
|
11281
|
+
return segmentTargetExists;
|
|
10662
11282
|
}()
|
|
10663
11283
|
/**
|
|
10664
11284
|
* createCampaign - Creates a Campaign
|
|
@@ -10671,32 +11291,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10671
11291
|
}, {
|
|
10672
11292
|
key: "createCampaign",
|
|
10673
11293
|
value: function () {
|
|
10674
|
-
var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11294
|
+
var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(params) {
|
|
10675
11295
|
var _yield$this$post2, campaign;
|
|
10676
11296
|
|
|
10677
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11297
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
|
|
10678
11298
|
while (1) {
|
|
10679
|
-
switch (
|
|
11299
|
+
switch (_context72.prev = _context72.next) {
|
|
10680
11300
|
case 0:
|
|
10681
|
-
|
|
11301
|
+
_context72.next = 2;
|
|
10682
11302
|
return this.post(this.baseURL + "/campaigns", {
|
|
10683
11303
|
campaign: params
|
|
10684
11304
|
});
|
|
10685
11305
|
|
|
10686
11306
|
case 2:
|
|
10687
|
-
_yield$this$post2 =
|
|
11307
|
+
_yield$this$post2 = _context72.sent;
|
|
10688
11308
|
campaign = _yield$this$post2.campaign;
|
|
10689
|
-
return
|
|
11309
|
+
return _context72.abrupt("return", campaign);
|
|
10690
11310
|
|
|
10691
11311
|
case 5:
|
|
10692
11312
|
case "end":
|
|
10693
|
-
return
|
|
11313
|
+
return _context72.stop();
|
|
10694
11314
|
}
|
|
10695
11315
|
}
|
|
10696
|
-
},
|
|
11316
|
+
}, _callee72, this);
|
|
10697
11317
|
}));
|
|
10698
11318
|
|
|
10699
|
-
function createCampaign(
|
|
11319
|
+
function createCampaign(_x104) {
|
|
10700
11320
|
return _createCampaign.apply(this, arguments);
|
|
10701
11321
|
}
|
|
10702
11322
|
|
|
@@ -10712,15 +11332,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10712
11332
|
}, {
|
|
10713
11333
|
key: "queryCampaigns",
|
|
10714
11334
|
value: function () {
|
|
10715
|
-
var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11335
|
+
var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(filters) {
|
|
10716
11336
|
var options,
|
|
10717
|
-
|
|
10718
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11337
|
+
_args73 = arguments;
|
|
11338
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
|
|
10719
11339
|
while (1) {
|
|
10720
|
-
switch (
|
|
11340
|
+
switch (_context73.prev = _context73.next) {
|
|
10721
11341
|
case 0:
|
|
10722
|
-
options =
|
|
10723
|
-
|
|
11342
|
+
options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
|
|
11343
|
+
_context73.next = 3;
|
|
10724
11344
|
return this.get(this.baseURL + "/campaigns", {
|
|
10725
11345
|
payload: _objectSpread({
|
|
10726
11346
|
filter_conditions: filters
|
|
@@ -10728,17 +11348,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10728
11348
|
});
|
|
10729
11349
|
|
|
10730
11350
|
case 3:
|
|
10731
|
-
return
|
|
11351
|
+
return _context73.abrupt("return", _context73.sent);
|
|
10732
11352
|
|
|
10733
11353
|
case 4:
|
|
10734
11354
|
case "end":
|
|
10735
|
-
return
|
|
11355
|
+
return _context73.stop();
|
|
10736
11356
|
}
|
|
10737
11357
|
}
|
|
10738
|
-
},
|
|
11358
|
+
}, _callee73, this);
|
|
10739
11359
|
}));
|
|
10740
11360
|
|
|
10741
|
-
function queryCampaigns(
|
|
11361
|
+
function queryCampaigns(_x105) {
|
|
10742
11362
|
return _queryCampaigns.apply(this, arguments);
|
|
10743
11363
|
}
|
|
10744
11364
|
|
|
@@ -10756,32 +11376,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10756
11376
|
}, {
|
|
10757
11377
|
key: "updateCampaign",
|
|
10758
11378
|
value: function () {
|
|
10759
|
-
var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11379
|
+
var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id, params) {
|
|
10760
11380
|
var _yield$this$put2, campaign;
|
|
10761
11381
|
|
|
10762
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11382
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
|
|
10763
11383
|
while (1) {
|
|
10764
|
-
switch (
|
|
11384
|
+
switch (_context74.prev = _context74.next) {
|
|
10765
11385
|
case 0:
|
|
10766
|
-
|
|
11386
|
+
_context74.next = 2;
|
|
10767
11387
|
return this.put(this.baseURL + "/campaigns/".concat(id), {
|
|
10768
11388
|
campaign: params
|
|
10769
11389
|
});
|
|
10770
11390
|
|
|
10771
11391
|
case 2:
|
|
10772
|
-
_yield$this$put2 =
|
|
11392
|
+
_yield$this$put2 = _context74.sent;
|
|
10773
11393
|
campaign = _yield$this$put2.campaign;
|
|
10774
|
-
return
|
|
11394
|
+
return _context74.abrupt("return", campaign);
|
|
10775
11395
|
|
|
10776
11396
|
case 5:
|
|
10777
11397
|
case "end":
|
|
10778
|
-
return
|
|
11398
|
+
return _context74.stop();
|
|
10779
11399
|
}
|
|
10780
11400
|
}
|
|
10781
|
-
},
|
|
11401
|
+
}, _callee74, this);
|
|
10782
11402
|
}));
|
|
10783
11403
|
|
|
10784
|
-
function updateCampaign(
|
|
11404
|
+
function updateCampaign(_x106, _x107) {
|
|
10785
11405
|
return _updateCampaign.apply(this, arguments);
|
|
10786
11406
|
}
|
|
10787
11407
|
|
|
@@ -10798,25 +11418,25 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10798
11418
|
}, {
|
|
10799
11419
|
key: "deleteCampaign",
|
|
10800
11420
|
value: function () {
|
|
10801
|
-
var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11421
|
+
var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
|
|
10802
11422
|
var params,
|
|
10803
|
-
|
|
10804
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11423
|
+
_args75 = arguments;
|
|
11424
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
|
|
10805
11425
|
while (1) {
|
|
10806
|
-
switch (
|
|
11426
|
+
switch (_context75.prev = _context75.next) {
|
|
10807
11427
|
case 0:
|
|
10808
|
-
params =
|
|
10809
|
-
return
|
|
11428
|
+
params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
|
|
11429
|
+
return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
|
|
10810
11430
|
|
|
10811
11431
|
case 2:
|
|
10812
11432
|
case "end":
|
|
10813
|
-
return
|
|
11433
|
+
return _context75.stop();
|
|
10814
11434
|
}
|
|
10815
11435
|
}
|
|
10816
|
-
},
|
|
11436
|
+
}, _callee75, this);
|
|
10817
11437
|
}));
|
|
10818
11438
|
|
|
10819
|
-
function deleteCampaign(
|
|
11439
|
+
function deleteCampaign(_x108) {
|
|
10820
11440
|
return _deleteCampaign.apply(this, arguments);
|
|
10821
11441
|
}
|
|
10822
11442
|
|
|
@@ -10834,33 +11454,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10834
11454
|
}, {
|
|
10835
11455
|
key: "scheduleCampaign",
|
|
10836
11456
|
value: function () {
|
|
10837
|
-
var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11457
|
+
var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
|
|
10838
11458
|
var scheduledFor, _yield$this$patch, campaign;
|
|
10839
11459
|
|
|
10840
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11460
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
|
|
10841
11461
|
while (1) {
|
|
10842
|
-
switch (
|
|
11462
|
+
switch (_context76.prev = _context76.next) {
|
|
10843
11463
|
case 0:
|
|
10844
11464
|
scheduledFor = params.scheduledFor;
|
|
10845
|
-
|
|
11465
|
+
_context76.next = 3;
|
|
10846
11466
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
|
|
10847
11467
|
scheduled_for: scheduledFor
|
|
10848
11468
|
});
|
|
10849
11469
|
|
|
10850
11470
|
case 3:
|
|
10851
|
-
_yield$this$patch =
|
|
11471
|
+
_yield$this$patch = _context76.sent;
|
|
10852
11472
|
campaign = _yield$this$patch.campaign;
|
|
10853
|
-
return
|
|
11473
|
+
return _context76.abrupt("return", campaign);
|
|
10854
11474
|
|
|
10855
11475
|
case 6:
|
|
10856
11476
|
case "end":
|
|
10857
|
-
return
|
|
11477
|
+
return _context76.stop();
|
|
10858
11478
|
}
|
|
10859
11479
|
}
|
|
10860
|
-
},
|
|
11480
|
+
}, _callee76, this);
|
|
10861
11481
|
}));
|
|
10862
11482
|
|
|
10863
|
-
function scheduleCampaign(
|
|
11483
|
+
function scheduleCampaign(_x109, _x110) {
|
|
10864
11484
|
return _scheduleCampaign.apply(this, arguments);
|
|
10865
11485
|
}
|
|
10866
11486
|
|
|
@@ -10877,30 +11497,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10877
11497
|
}, {
|
|
10878
11498
|
key: "stopCampaign",
|
|
10879
11499
|
value: function () {
|
|
10880
|
-
var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11500
|
+
var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(id) {
|
|
10881
11501
|
var _yield$this$patch2, campaign;
|
|
10882
11502
|
|
|
10883
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11503
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
|
|
10884
11504
|
while (1) {
|
|
10885
|
-
switch (
|
|
11505
|
+
switch (_context77.prev = _context77.next) {
|
|
10886
11506
|
case 0:
|
|
10887
|
-
|
|
11507
|
+
_context77.next = 2;
|
|
10888
11508
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
|
|
10889
11509
|
|
|
10890
11510
|
case 2:
|
|
10891
|
-
_yield$this$patch2 =
|
|
11511
|
+
_yield$this$patch2 = _context77.sent;
|
|
10892
11512
|
campaign = _yield$this$patch2.campaign;
|
|
10893
|
-
return
|
|
11513
|
+
return _context77.abrupt("return", campaign);
|
|
10894
11514
|
|
|
10895
11515
|
case 5:
|
|
10896
11516
|
case "end":
|
|
10897
|
-
return
|
|
11517
|
+
return _context77.stop();
|
|
10898
11518
|
}
|
|
10899
11519
|
}
|
|
10900
|
-
},
|
|
11520
|
+
}, _callee77, this);
|
|
10901
11521
|
}));
|
|
10902
11522
|
|
|
10903
|
-
function stopCampaign(
|
|
11523
|
+
function stopCampaign(_x111) {
|
|
10904
11524
|
return _stopCampaign.apply(this, arguments);
|
|
10905
11525
|
}
|
|
10906
11526
|
|
|
@@ -10917,30 +11537,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10917
11537
|
}, {
|
|
10918
11538
|
key: "resumeCampaign",
|
|
10919
11539
|
value: function () {
|
|
10920
|
-
var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11540
|
+
var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
|
|
10921
11541
|
var _yield$this$patch3, campaign;
|
|
10922
11542
|
|
|
10923
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11543
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
|
|
10924
11544
|
while (1) {
|
|
10925
|
-
switch (
|
|
11545
|
+
switch (_context78.prev = _context78.next) {
|
|
10926
11546
|
case 0:
|
|
10927
|
-
|
|
11547
|
+
_context78.next = 2;
|
|
10928
11548
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
|
|
10929
11549
|
|
|
10930
11550
|
case 2:
|
|
10931
|
-
_yield$this$patch3 =
|
|
11551
|
+
_yield$this$patch3 = _context78.sent;
|
|
10932
11552
|
campaign = _yield$this$patch3.campaign;
|
|
10933
|
-
return
|
|
11553
|
+
return _context78.abrupt("return", campaign);
|
|
10934
11554
|
|
|
10935
11555
|
case 5:
|
|
10936
11556
|
case "end":
|
|
10937
|
-
return
|
|
11557
|
+
return _context78.stop();
|
|
10938
11558
|
}
|
|
10939
11559
|
}
|
|
10940
|
-
},
|
|
11560
|
+
}, _callee78, this);
|
|
10941
11561
|
}));
|
|
10942
11562
|
|
|
10943
|
-
function resumeCampaign(
|
|
11563
|
+
function resumeCampaign(_x112) {
|
|
10944
11564
|
return _resumeCampaign.apply(this, arguments);
|
|
10945
11565
|
}
|
|
10946
11566
|
|
|
@@ -10958,77 +11578,35 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10958
11578
|
}, {
|
|
10959
11579
|
key: "testCampaign",
|
|
10960
11580
|
value: function () {
|
|
10961
|
-
var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11581
|
+
var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(id, params) {
|
|
10962
11582
|
var users;
|
|
10963
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11583
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
|
|
10964
11584
|
while (1) {
|
|
10965
|
-
switch (
|
|
11585
|
+
switch (_context79.prev = _context79.next) {
|
|
10966
11586
|
case 0:
|
|
10967
11587
|
users = params.users;
|
|
10968
|
-
|
|
11588
|
+
_context79.next = 3;
|
|
10969
11589
|
return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
|
|
10970
11590
|
users: users
|
|
10971
11591
|
});
|
|
10972
11592
|
|
|
10973
11593
|
case 3:
|
|
10974
|
-
return
|
|
11594
|
+
return _context79.abrupt("return", _context79.sent);
|
|
10975
11595
|
|
|
10976
11596
|
case 4:
|
|
10977
11597
|
case "end":
|
|
10978
|
-
return
|
|
11598
|
+
return _context79.stop();
|
|
10979
11599
|
}
|
|
10980
11600
|
}
|
|
10981
|
-
},
|
|
11601
|
+
}, _callee79, this);
|
|
10982
11602
|
}));
|
|
10983
11603
|
|
|
10984
|
-
function testCampaign(
|
|
11604
|
+
function testCampaign(_x113, _x114) {
|
|
10985
11605
|
return _testCampaign.apply(this, arguments);
|
|
10986
11606
|
}
|
|
10987
11607
|
|
|
10988
11608
|
return testCampaign;
|
|
10989
11609
|
}()
|
|
10990
|
-
/**
|
|
10991
|
-
* queryRecipients - Query Campaign Recipient Results
|
|
10992
|
-
*
|
|
10993
|
-
*
|
|
10994
|
-
* @return {Recipient[]} Recipients
|
|
10995
|
-
*/
|
|
10996
|
-
|
|
10997
|
-
}, {
|
|
10998
|
-
key: "queryRecipients",
|
|
10999
|
-
value: function () {
|
|
11000
|
-
var _queryRecipients = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(filters) {
|
|
11001
|
-
var options,
|
|
11002
|
-
_args71 = arguments;
|
|
11003
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
|
|
11004
|
-
while (1) {
|
|
11005
|
-
switch (_context71.prev = _context71.next) {
|
|
11006
|
-
case 0:
|
|
11007
|
-
options = _args71.length > 1 && _args71[1] !== undefined ? _args71[1] : {};
|
|
11008
|
-
_context71.next = 3;
|
|
11009
|
-
return this.get(this.baseURL + "/recipients", {
|
|
11010
|
-
payload: _objectSpread({
|
|
11011
|
-
filter_conditions: filters
|
|
11012
|
-
}, options)
|
|
11013
|
-
});
|
|
11014
|
-
|
|
11015
|
-
case 3:
|
|
11016
|
-
return _context71.abrupt("return", _context71.sent);
|
|
11017
|
-
|
|
11018
|
-
case 4:
|
|
11019
|
-
case "end":
|
|
11020
|
-
return _context71.stop();
|
|
11021
|
-
}
|
|
11022
|
-
}
|
|
11023
|
-
}, _callee71, this);
|
|
11024
|
-
}));
|
|
11025
|
-
|
|
11026
|
-
function queryRecipients(_x95) {
|
|
11027
|
-
return _queryRecipients.apply(this, arguments);
|
|
11028
|
-
}
|
|
11029
|
-
|
|
11030
|
-
return queryRecipients;
|
|
11031
|
-
}()
|
|
11032
11610
|
/**
|
|
11033
11611
|
* enrichURL - Get OpenGraph data of the given link
|
|
11034
11612
|
*
|
|
@@ -11039,24 +11617,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11039
11617
|
}, {
|
|
11040
11618
|
key: "enrichURL",
|
|
11041
11619
|
value: function () {
|
|
11042
|
-
var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11043
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11620
|
+
var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(url) {
|
|
11621
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
|
|
11044
11622
|
while (1) {
|
|
11045
|
-
switch (
|
|
11623
|
+
switch (_context80.prev = _context80.next) {
|
|
11046
11624
|
case 0:
|
|
11047
|
-
return
|
|
11625
|
+
return _context80.abrupt("return", this.get(this.baseURL + "/og", {
|
|
11048
11626
|
url: url
|
|
11049
11627
|
}));
|
|
11050
11628
|
|
|
11051
11629
|
case 1:
|
|
11052
11630
|
case "end":
|
|
11053
|
-
return
|
|
11631
|
+
return _context80.stop();
|
|
11054
11632
|
}
|
|
11055
11633
|
}
|
|
11056
|
-
},
|
|
11634
|
+
}, _callee80, this);
|
|
11057
11635
|
}));
|
|
11058
11636
|
|
|
11059
|
-
function enrichURL(
|
|
11637
|
+
function enrichURL(_x115) {
|
|
11060
11638
|
return _enrichURL.apply(this, arguments);
|
|
11061
11639
|
}
|
|
11062
11640
|
|
|
@@ -11073,22 +11651,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11073
11651
|
}, {
|
|
11074
11652
|
key: "getTask",
|
|
11075
11653
|
value: function () {
|
|
11076
|
-
var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11077
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11654
|
+
var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
|
|
11655
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
|
|
11078
11656
|
while (1) {
|
|
11079
|
-
switch (
|
|
11657
|
+
switch (_context81.prev = _context81.next) {
|
|
11080
11658
|
case 0:
|
|
11081
|
-
return
|
|
11659
|
+
return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
|
|
11082
11660
|
|
|
11083
11661
|
case 1:
|
|
11084
11662
|
case "end":
|
|
11085
|
-
return
|
|
11663
|
+
return _context81.stop();
|
|
11086
11664
|
}
|
|
11087
11665
|
}
|
|
11088
|
-
},
|
|
11666
|
+
}, _callee81, this);
|
|
11089
11667
|
}));
|
|
11090
11668
|
|
|
11091
|
-
function getTask(
|
|
11669
|
+
function getTask(_x116) {
|
|
11092
11670
|
return _getTask.apply(this, arguments);
|
|
11093
11671
|
}
|
|
11094
11672
|
|
|
@@ -11106,31 +11684,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11106
11684
|
}, {
|
|
11107
11685
|
key: "deleteChannels",
|
|
11108
11686
|
value: function () {
|
|
11109
|
-
var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11687
|
+
var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(cids) {
|
|
11110
11688
|
var options,
|
|
11111
|
-
|
|
11112
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11689
|
+
_args82 = arguments;
|
|
11690
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
|
|
11113
11691
|
while (1) {
|
|
11114
|
-
switch (
|
|
11692
|
+
switch (_context82.prev = _context82.next) {
|
|
11115
11693
|
case 0:
|
|
11116
|
-
options =
|
|
11117
|
-
|
|
11694
|
+
options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
|
|
11695
|
+
_context82.next = 3;
|
|
11118
11696
|
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
11119
11697
|
cids: cids
|
|
11120
11698
|
}, options));
|
|
11121
11699
|
|
|
11122
11700
|
case 3:
|
|
11123
|
-
return
|
|
11701
|
+
return _context82.abrupt("return", _context82.sent);
|
|
11124
11702
|
|
|
11125
11703
|
case 4:
|
|
11126
11704
|
case "end":
|
|
11127
|
-
return
|
|
11705
|
+
return _context82.stop();
|
|
11128
11706
|
}
|
|
11129
11707
|
}
|
|
11130
|
-
},
|
|
11708
|
+
}, _callee82, this);
|
|
11131
11709
|
}));
|
|
11132
11710
|
|
|
11133
|
-
function deleteChannels(
|
|
11711
|
+
function deleteChannels(_x117) {
|
|
11134
11712
|
return _deleteChannels.apply(this, arguments);
|
|
11135
11713
|
}
|
|
11136
11714
|
|
|
@@ -11148,17 +11726,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11148
11726
|
}, {
|
|
11149
11727
|
key: "deleteUsers",
|
|
11150
11728
|
value: function () {
|
|
11151
|
-
var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11729
|
+
var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(user_ids) {
|
|
11152
11730
|
var options,
|
|
11153
|
-
|
|
11154
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11731
|
+
_args83 = arguments;
|
|
11732
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
|
|
11155
11733
|
while (1) {
|
|
11156
|
-
switch (
|
|
11734
|
+
switch (_context83.prev = _context83.next) {
|
|
11157
11735
|
case 0:
|
|
11158
|
-
options =
|
|
11736
|
+
options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
|
|
11159
11737
|
|
|
11160
11738
|
if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
|
|
11161
|
-
|
|
11739
|
+
_context83.next = 3;
|
|
11162
11740
|
break;
|
|
11163
11741
|
}
|
|
11164
11742
|
|
|
@@ -11166,7 +11744,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11166
11744
|
|
|
11167
11745
|
case 3:
|
|
11168
11746
|
if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
|
|
11169
|
-
|
|
11747
|
+
_context83.next = 5;
|
|
11170
11748
|
break;
|
|
11171
11749
|
}
|
|
11172
11750
|
|
|
@@ -11174,30 +11752,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11174
11752
|
|
|
11175
11753
|
case 5:
|
|
11176
11754
|
if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
|
|
11177
|
-
|
|
11755
|
+
_context83.next = 7;
|
|
11178
11756
|
break;
|
|
11179
11757
|
}
|
|
11180
11758
|
|
|
11181
11759
|
throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
|
|
11182
11760
|
|
|
11183
11761
|
case 7:
|
|
11184
|
-
|
|
11762
|
+
_context83.next = 9;
|
|
11185
11763
|
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
11186
11764
|
user_ids: user_ids
|
|
11187
11765
|
}, options));
|
|
11188
11766
|
|
|
11189
11767
|
case 9:
|
|
11190
|
-
return
|
|
11768
|
+
return _context83.abrupt("return", _context83.sent);
|
|
11191
11769
|
|
|
11192
11770
|
case 10:
|
|
11193
11771
|
case "end":
|
|
11194
|
-
return
|
|
11772
|
+
return _context83.stop();
|
|
11195
11773
|
}
|
|
11196
11774
|
}
|
|
11197
|
-
},
|
|
11775
|
+
}, _callee83, this);
|
|
11198
11776
|
}));
|
|
11199
11777
|
|
|
11200
|
-
function deleteUsers(
|
|
11778
|
+
function deleteUsers(_x118) {
|
|
11201
11779
|
return _deleteUsers.apply(this, arguments);
|
|
11202
11780
|
}
|
|
11203
11781
|
|
|
@@ -11218,28 +11796,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11218
11796
|
}, {
|
|
11219
11797
|
key: "_createImportURL",
|
|
11220
11798
|
value: function () {
|
|
11221
|
-
var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11222
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11799
|
+
var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(filename) {
|
|
11800
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
|
|
11223
11801
|
while (1) {
|
|
11224
|
-
switch (
|
|
11802
|
+
switch (_context84.prev = _context84.next) {
|
|
11225
11803
|
case 0:
|
|
11226
|
-
|
|
11804
|
+
_context84.next = 2;
|
|
11227
11805
|
return this.post(this.baseURL + "/import_urls", {
|
|
11228
11806
|
filename: filename
|
|
11229
11807
|
});
|
|
11230
11808
|
|
|
11231
11809
|
case 2:
|
|
11232
|
-
return
|
|
11810
|
+
return _context84.abrupt("return", _context84.sent);
|
|
11233
11811
|
|
|
11234
11812
|
case 3:
|
|
11235
11813
|
case "end":
|
|
11236
|
-
return
|
|
11814
|
+
return _context84.stop();
|
|
11237
11815
|
}
|
|
11238
11816
|
}
|
|
11239
|
-
},
|
|
11817
|
+
}, _callee84, this);
|
|
11240
11818
|
}));
|
|
11241
11819
|
|
|
11242
|
-
function _createImportURL(
|
|
11820
|
+
function _createImportURL(_x119) {
|
|
11243
11821
|
return _createImportURL2.apply(this, arguments);
|
|
11244
11822
|
}
|
|
11245
11823
|
|
|
@@ -11261,33 +11839,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11261
11839
|
}, {
|
|
11262
11840
|
key: "_createImport",
|
|
11263
11841
|
value: function () {
|
|
11264
|
-
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11842
|
+
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(path) {
|
|
11265
11843
|
var options,
|
|
11266
|
-
|
|
11267
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11844
|
+
_args85 = arguments;
|
|
11845
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
|
|
11268
11846
|
while (1) {
|
|
11269
|
-
switch (
|
|
11847
|
+
switch (_context85.prev = _context85.next) {
|
|
11270
11848
|
case 0:
|
|
11271
|
-
options =
|
|
11849
|
+
options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
|
|
11272
11850
|
mode: 'upsert'
|
|
11273
11851
|
};
|
|
11274
|
-
|
|
11852
|
+
_context85.next = 3;
|
|
11275
11853
|
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
11276
11854
|
path: path
|
|
11277
11855
|
}, options));
|
|
11278
11856
|
|
|
11279
11857
|
case 3:
|
|
11280
|
-
return
|
|
11858
|
+
return _context85.abrupt("return", _context85.sent);
|
|
11281
11859
|
|
|
11282
11860
|
case 4:
|
|
11283
11861
|
case "end":
|
|
11284
|
-
return
|
|
11862
|
+
return _context85.stop();
|
|
11285
11863
|
}
|
|
11286
11864
|
}
|
|
11287
|
-
},
|
|
11865
|
+
}, _callee85, this);
|
|
11288
11866
|
}));
|
|
11289
11867
|
|
|
11290
|
-
function _createImport(
|
|
11868
|
+
function _createImport(_x120) {
|
|
11291
11869
|
return _createImport2.apply(this, arguments);
|
|
11292
11870
|
}
|
|
11293
11871
|
|
|
@@ -11309,26 +11887,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11309
11887
|
}, {
|
|
11310
11888
|
key: "_getImport",
|
|
11311
11889
|
value: function () {
|
|
11312
|
-
var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11313
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11890
|
+
var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(id) {
|
|
11891
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
|
|
11314
11892
|
while (1) {
|
|
11315
|
-
switch (
|
|
11893
|
+
switch (_context86.prev = _context86.next) {
|
|
11316
11894
|
case 0:
|
|
11317
|
-
|
|
11895
|
+
_context86.next = 2;
|
|
11318
11896
|
return this.get(this.baseURL + "/imports/".concat(id));
|
|
11319
11897
|
|
|
11320
11898
|
case 2:
|
|
11321
|
-
return
|
|
11899
|
+
return _context86.abrupt("return", _context86.sent);
|
|
11322
11900
|
|
|
11323
11901
|
case 3:
|
|
11324
11902
|
case "end":
|
|
11325
|
-
return
|
|
11903
|
+
return _context86.stop();
|
|
11326
11904
|
}
|
|
11327
11905
|
}
|
|
11328
|
-
},
|
|
11906
|
+
}, _callee86, this);
|
|
11329
11907
|
}));
|
|
11330
11908
|
|
|
11331
|
-
function _getImport(
|
|
11909
|
+
function _getImport(_x121) {
|
|
11332
11910
|
return _getImport2.apply(this, arguments);
|
|
11333
11911
|
}
|
|
11334
11912
|
|
|
@@ -11350,26 +11928,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11350
11928
|
}, {
|
|
11351
11929
|
key: "_listImports",
|
|
11352
11930
|
value: function () {
|
|
11353
|
-
var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11354
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11931
|
+
var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87(options) {
|
|
11932
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
|
|
11355
11933
|
while (1) {
|
|
11356
|
-
switch (
|
|
11934
|
+
switch (_context87.prev = _context87.next) {
|
|
11357
11935
|
case 0:
|
|
11358
|
-
|
|
11936
|
+
_context87.next = 2;
|
|
11359
11937
|
return this.get(this.baseURL + "/imports", options);
|
|
11360
11938
|
|
|
11361
11939
|
case 2:
|
|
11362
|
-
return
|
|
11940
|
+
return _context87.abrupt("return", _context87.sent);
|
|
11363
11941
|
|
|
11364
11942
|
case 3:
|
|
11365
11943
|
case "end":
|
|
11366
|
-
return
|
|
11944
|
+
return _context87.stop();
|
|
11367
11945
|
}
|
|
11368
11946
|
}
|
|
11369
|
-
},
|
|
11947
|
+
}, _callee87, this);
|
|
11370
11948
|
}));
|
|
11371
11949
|
|
|
11372
|
-
function _listImports(
|
|
11950
|
+
function _listImports(_x122) {
|
|
11373
11951
|
return _listImports2.apply(this, arguments);
|
|
11374
11952
|
}
|
|
11375
11953
|
|
|
@@ -11388,28 +11966,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11388
11966
|
}, {
|
|
11389
11967
|
key: "upsertPushProvider",
|
|
11390
11968
|
value: function () {
|
|
11391
|
-
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11392
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11969
|
+
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(pushProvider) {
|
|
11970
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
|
|
11393
11971
|
while (1) {
|
|
11394
|
-
switch (
|
|
11972
|
+
switch (_context88.prev = _context88.next) {
|
|
11395
11973
|
case 0:
|
|
11396
|
-
|
|
11974
|
+
_context88.next = 2;
|
|
11397
11975
|
return this.post(this.baseURL + "/push_providers", {
|
|
11398
11976
|
push_provider: pushProvider
|
|
11399
11977
|
});
|
|
11400
11978
|
|
|
11401
11979
|
case 2:
|
|
11402
|
-
return
|
|
11980
|
+
return _context88.abrupt("return", _context88.sent);
|
|
11403
11981
|
|
|
11404
11982
|
case 3:
|
|
11405
11983
|
case "end":
|
|
11406
|
-
return
|
|
11984
|
+
return _context88.stop();
|
|
11407
11985
|
}
|
|
11408
11986
|
}
|
|
11409
|
-
},
|
|
11987
|
+
}, _callee88, this);
|
|
11410
11988
|
}));
|
|
11411
11989
|
|
|
11412
|
-
function upsertPushProvider(
|
|
11990
|
+
function upsertPushProvider(_x123) {
|
|
11413
11991
|
return _upsertPushProvider.apply(this, arguments);
|
|
11414
11992
|
}
|
|
11415
11993
|
|
|
@@ -11428,28 +12006,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11428
12006
|
}, {
|
|
11429
12007
|
key: "deletePushProvider",
|
|
11430
12008
|
value: function () {
|
|
11431
|
-
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12009
|
+
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee89(_ref10) {
|
|
11432
12010
|
var type, name;
|
|
11433
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12011
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee89$(_context89) {
|
|
11434
12012
|
while (1) {
|
|
11435
|
-
switch (
|
|
12013
|
+
switch (_context89.prev = _context89.next) {
|
|
11436
12014
|
case 0:
|
|
11437
12015
|
type = _ref10.type, name = _ref10.name;
|
|
11438
|
-
|
|
12016
|
+
_context89.next = 3;
|
|
11439
12017
|
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
11440
12018
|
|
|
11441
12019
|
case 3:
|
|
11442
|
-
return
|
|
12020
|
+
return _context89.abrupt("return", _context89.sent);
|
|
11443
12021
|
|
|
11444
12022
|
case 4:
|
|
11445
12023
|
case "end":
|
|
11446
|
-
return
|
|
12024
|
+
return _context89.stop();
|
|
11447
12025
|
}
|
|
11448
12026
|
}
|
|
11449
|
-
},
|
|
12027
|
+
}, _callee89, this);
|
|
11450
12028
|
}));
|
|
11451
12029
|
|
|
11452
|
-
function deletePushProvider(
|
|
12030
|
+
function deletePushProvider(_x124) {
|
|
11453
12031
|
return _deletePushProvider.apply(this, arguments);
|
|
11454
12032
|
}
|
|
11455
12033
|
|
|
@@ -11466,23 +12044,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11466
12044
|
}, {
|
|
11467
12045
|
key: "listPushProviders",
|
|
11468
12046
|
value: function () {
|
|
11469
|
-
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11470
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12047
|
+
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee90() {
|
|
12048
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee90$(_context90) {
|
|
11471
12049
|
while (1) {
|
|
11472
|
-
switch (
|
|
12050
|
+
switch (_context90.prev = _context90.next) {
|
|
11473
12051
|
case 0:
|
|
11474
|
-
|
|
12052
|
+
_context90.next = 2;
|
|
11475
12053
|
return this.get(this.baseURL + "/push_providers");
|
|
11476
12054
|
|
|
11477
12055
|
case 2:
|
|
11478
|
-
return
|
|
12056
|
+
return _context90.abrupt("return", _context90.sent);
|
|
11479
12057
|
|
|
11480
12058
|
case 3:
|
|
11481
12059
|
case "end":
|
|
11482
|
-
return
|
|
12060
|
+
return _context90.stop();
|
|
11483
12061
|
}
|
|
11484
12062
|
}
|
|
11485
|
-
},
|
|
12063
|
+
}, _callee90, this);
|
|
11486
12064
|
}));
|
|
11487
12065
|
|
|
11488
12066
|
function listPushProviders() {
|
|
@@ -11510,26 +12088,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11510
12088
|
}, {
|
|
11511
12089
|
key: "commitMessage",
|
|
11512
12090
|
value: function () {
|
|
11513
|
-
var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11514
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12091
|
+
var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee91(id) {
|
|
12092
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee91$(_context91) {
|
|
11515
12093
|
while (1) {
|
|
11516
|
-
switch (
|
|
12094
|
+
switch (_context91.prev = _context91.next) {
|
|
11517
12095
|
case 0:
|
|
11518
|
-
|
|
12096
|
+
_context91.next = 2;
|
|
11519
12097
|
return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
|
|
11520
12098
|
|
|
11521
12099
|
case 2:
|
|
11522
|
-
return
|
|
12100
|
+
return _context91.abrupt("return", _context91.sent);
|
|
11523
12101
|
|
|
11524
12102
|
case 3:
|
|
11525
12103
|
case "end":
|
|
11526
|
-
return
|
|
12104
|
+
return _context91.stop();
|
|
11527
12105
|
}
|
|
11528
12106
|
}
|
|
11529
|
-
},
|
|
12107
|
+
}, _callee91, this);
|
|
11530
12108
|
}));
|
|
11531
12109
|
|
|
11532
|
-
function commitMessage(
|
|
12110
|
+
function commitMessage(_x125) {
|
|
11533
12111
|
return _commitMessage.apply(this, arguments);
|
|
11534
12112
|
}
|
|
11535
12113
|
|
|
@@ -11581,9 +12159,11 @@ var EVENT_MAP = {
|
|
|
11581
12159
|
'notification.invite_rejected': true,
|
|
11582
12160
|
'notification.invited': true,
|
|
11583
12161
|
'notification.mark_read': true,
|
|
12162
|
+
'notification.mark_unread': true,
|
|
11584
12163
|
'notification.message_new': true,
|
|
11585
12164
|
'notification.mutes_updated': true,
|
|
11586
12165
|
'notification.removed_from_channel': true,
|
|
12166
|
+
'notification.thread_message_new': true,
|
|
11587
12167
|
'reaction.deleted': true,
|
|
11588
12168
|
'reaction.new': true,
|
|
11589
12169
|
'reaction.updated': true,
|
|
@@ -11702,6 +12282,7 @@ exports.MinPriority = MinPriority;
|
|
|
11702
12282
|
exports.Permission = Permission;
|
|
11703
12283
|
exports.StableWSConnection = StableWSConnection;
|
|
11704
12284
|
exports.StreamChat = StreamChat;
|
|
12285
|
+
exports.Thread = Thread;
|
|
11705
12286
|
exports.TokenManager = TokenManager;
|
|
11706
12287
|
exports.UserFromToken = UserFromToken;
|
|
11707
12288
|
exports.buildWsFatalInsight = buildWsFatalInsight;
|
|
@@ -11709,6 +12290,7 @@ exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
|
|
|
11709
12290
|
exports.chatCodes = chatCodes;
|
|
11710
12291
|
exports.decodeBase64 = decodeBase64;
|
|
11711
12292
|
exports.encodeBase64 = encodeBase64;
|
|
12293
|
+
exports.formatMessage = formatMessage;
|
|
11712
12294
|
exports.isOwnUser = isOwnUser;
|
|
11713
12295
|
exports.logChatPromiseExecution = logChatPromiseExecution;
|
|
11714
12296
|
exports.postInsights = postInsights;
|