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/index.js
CHANGED
|
@@ -122,9 +122,347 @@ var decodeBase64 = function decodeBase64(s) {
|
|
|
122
122
|
return r;
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
function ownKeys$
|
|
125
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
126
126
|
|
|
127
|
-
function _objectSpread$
|
|
127
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
128
|
+
|
|
129
|
+
function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
130
|
+
|
|
131
|
+
function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
|
|
132
|
+
|
|
133
|
+
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
137
|
+
* use this when you want to run the promise and handle errors by logging a warning
|
|
138
|
+
*
|
|
139
|
+
* @param {Promise<T>} promise The promise you want to run and log
|
|
140
|
+
* @param {string} name A descriptive name of what the promise does for log output
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
function logChatPromiseExecution(promise, name) {
|
|
144
|
+
promise.then().catch(function (error) {
|
|
145
|
+
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
var sleep = function sleep(m) {
|
|
149
|
+
return new Promise(function (r) {
|
|
150
|
+
return setTimeout(r, m);
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
function isFunction(value) {
|
|
154
|
+
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
155
|
+
}
|
|
156
|
+
var chatCodes = {
|
|
157
|
+
TOKEN_EXPIRED: 40,
|
|
158
|
+
WS_CLOSED_SUCCESS: 1000
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
function isReadableStream(obj) {
|
|
162
|
+
return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function isBuffer(obj) {
|
|
166
|
+
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
167
|
+
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
168
|
+
obj.constructor.isBuffer(obj);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function isFileWebAPI(uri) {
|
|
172
|
+
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function isOwnUser(user) {
|
|
176
|
+
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function isBlobWebAPI(uri) {
|
|
180
|
+
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function isOwnUserBaseProperty(property) {
|
|
184
|
+
var ownUserBaseProperties = {
|
|
185
|
+
channel_mutes: true,
|
|
186
|
+
devices: true,
|
|
187
|
+
mutes: true,
|
|
188
|
+
total_unread_count: true,
|
|
189
|
+
unread_channels: true,
|
|
190
|
+
unread_count: true,
|
|
191
|
+
invisible: true,
|
|
192
|
+
roles: true
|
|
193
|
+
};
|
|
194
|
+
return ownUserBaseProperties[property];
|
|
195
|
+
}
|
|
196
|
+
function addFileToFormData(uri, name, contentType) {
|
|
197
|
+
var data = new FormData__default['default']();
|
|
198
|
+
|
|
199
|
+
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
200
|
+
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
201
|
+
} else {
|
|
202
|
+
data.append('file', {
|
|
203
|
+
uri: uri,
|
|
204
|
+
name: name || uri.split('/').reverse()[0],
|
|
205
|
+
contentType: contentType || undefined,
|
|
206
|
+
type: contentType || undefined
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return data;
|
|
211
|
+
}
|
|
212
|
+
function normalizeQuerySort(sort) {
|
|
213
|
+
var sortFields = [];
|
|
214
|
+
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
215
|
+
|
|
216
|
+
var _iterator = _createForOfIteratorHelper$4(sortArr),
|
|
217
|
+
_step;
|
|
218
|
+
|
|
219
|
+
try {
|
|
220
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
221
|
+
var item = _step.value;
|
|
222
|
+
var entries = Object.entries(item);
|
|
223
|
+
|
|
224
|
+
if (entries.length > 1) {
|
|
225
|
+
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
229
|
+
var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
|
|
230
|
+
field = _entries$_i[0],
|
|
231
|
+
direction = _entries$_i[1];
|
|
232
|
+
|
|
233
|
+
sortFields.push({
|
|
234
|
+
field: field,
|
|
235
|
+
direction: direction
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
} catch (err) {
|
|
240
|
+
_iterator.e(err);
|
|
241
|
+
} finally {
|
|
242
|
+
_iterator.f();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return sortFields;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* retryInterval - A retry interval which increases acc to number of failures
|
|
249
|
+
*
|
|
250
|
+
* @return {number} Duration to wait in milliseconds
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
function retryInterval(numberOfFailures) {
|
|
254
|
+
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
255
|
+
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
256
|
+
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
257
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
258
|
+
}
|
|
259
|
+
function randomId() {
|
|
260
|
+
return generateUUIDv4();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function hex(bytes) {
|
|
264
|
+
var s = '';
|
|
265
|
+
|
|
266
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
267
|
+
s += bytes[i].toString(16).padStart(2, '0');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return s;
|
|
271
|
+
} // https://tools.ietf.org/html/rfc4122
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
function generateUUIDv4() {
|
|
275
|
+
var bytes = getRandomBytes(16);
|
|
276
|
+
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
277
|
+
|
|
278
|
+
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
279
|
+
|
|
280
|
+
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function getRandomValuesWithMathRandom(bytes) {
|
|
284
|
+
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
285
|
+
|
|
286
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
287
|
+
bytes[i] = Math.random() * max;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
var getRandomValues = function () {
|
|
292
|
+
var _crypto;
|
|
293
|
+
|
|
294
|
+
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
295
|
+
return crypto.getRandomValues.bind(crypto);
|
|
296
|
+
} else if (typeof msCrypto !== 'undefined') {
|
|
297
|
+
return msCrypto.getRandomValues.bind(msCrypto);
|
|
298
|
+
} else {
|
|
299
|
+
return getRandomValuesWithMathRandom;
|
|
300
|
+
}
|
|
301
|
+
}();
|
|
302
|
+
|
|
303
|
+
function getRandomBytes(length) {
|
|
304
|
+
var bytes = new Uint8Array(length);
|
|
305
|
+
getRandomValues(bytes);
|
|
306
|
+
return bytes;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function convertErrorToJson(err) {
|
|
310
|
+
var jsonObj = {};
|
|
311
|
+
if (!err) return jsonObj;
|
|
312
|
+
|
|
313
|
+
try {
|
|
314
|
+
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
315
|
+
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
316
|
+
});
|
|
317
|
+
} catch (_) {
|
|
318
|
+
return {
|
|
319
|
+
error: 'failed to serialize the error'
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return jsonObj;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* isOnline safely return the navigator.online value for browser env
|
|
327
|
+
* if navigator is not in global object, it always return true
|
|
328
|
+
*/
|
|
329
|
+
|
|
330
|
+
function isOnline() {
|
|
331
|
+
var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
|
|
332
|
+
|
|
333
|
+
if (!nav) {
|
|
334
|
+
console.warn('isOnline failed to access window.navigator and assume browser is online');
|
|
335
|
+
return true;
|
|
336
|
+
} // RN navigator has undefined for onLine
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
if (typeof nav.onLine !== 'boolean') {
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return nav.onLine;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
function addConnectionEventListeners(cb) {
|
|
350
|
+
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
351
|
+
window.addEventListener('offline', cb);
|
|
352
|
+
window.addEventListener('online', cb);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function removeConnectionEventListeners(cb) {
|
|
356
|
+
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
357
|
+
window.removeEventListener('offline', cb);
|
|
358
|
+
window.removeEventListener('online', cb);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
362
|
+
var newParams = [];
|
|
363
|
+
|
|
364
|
+
for (var k in params) {
|
|
365
|
+
// Stream backend doesn't treat "undefined" value same as value not being present.
|
|
366
|
+
// So, we need to skip the undefined values.
|
|
367
|
+
if (params[k] === undefined) continue;
|
|
368
|
+
|
|
369
|
+
if (Array.isArray(params[k]) || _typeof__default['default'](params[k]) === 'object') {
|
|
370
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
|
|
371
|
+
} else {
|
|
372
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return newParams.join('&');
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
380
|
+
* and sets the status to received if missing. Returns a message object
|
|
381
|
+
*
|
|
382
|
+
* @param {MessageResponse<StreamChatGenerics>} message a message object
|
|
383
|
+
*
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
function formatMessage(message) {
|
|
387
|
+
return _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
388
|
+
/**
|
|
389
|
+
* @deprecated please use `html`
|
|
390
|
+
*/
|
|
391
|
+
__html: message.html,
|
|
392
|
+
// parse the date..
|
|
393
|
+
pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
|
|
394
|
+
created_at: message.created_at ? new Date(message.created_at) : new Date(),
|
|
395
|
+
updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
|
|
396
|
+
status: message.status || 'received'
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
function addToMessageList(messages, message) {
|
|
400
|
+
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
401
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
402
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
403
|
+
var addMessageToList = addIfDoesNotExist || timestampChanged;
|
|
404
|
+
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
405
|
+
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
406
|
+
|
|
407
|
+
if (timestampChanged) {
|
|
408
|
+
messageArr = messageArr.filter(function (msg) {
|
|
409
|
+
return !(msg.id && message.id === msg.id);
|
|
410
|
+
});
|
|
411
|
+
} // Get array length after filtering
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
415
|
+
|
|
416
|
+
if (messageArrayLength === 0 && addMessageToList) {
|
|
417
|
+
return messageArr.concat(message);
|
|
418
|
+
} else if (messageArrayLength === 0) {
|
|
419
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
var messageTime = message[sortBy].getTime();
|
|
423
|
+
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
424
|
+
|
|
425
|
+
if (messageIsNewest && addMessageToList) {
|
|
426
|
+
return messageArr.concat(message);
|
|
427
|
+
} else if (messageIsNewest) {
|
|
428
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
429
|
+
} // find the closest index to push the new message
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
var left = 0;
|
|
433
|
+
var middle = 0;
|
|
434
|
+
var right = messageArrayLength - 1;
|
|
435
|
+
|
|
436
|
+
while (left <= right) {
|
|
437
|
+
middle = Math.floor((right + left) / 2);
|
|
438
|
+
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
439
|
+
} // message already exists and not filtered due to timestampChanged, update and return
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
if (!timestampChanged && message.id) {
|
|
443
|
+
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
444
|
+
messageArr[left] = message;
|
|
445
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
449
|
+
messageArr[left - 1] = message;
|
|
450
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
451
|
+
}
|
|
452
|
+
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
453
|
+
// or have a timestamp change.
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
if (addMessageToList) {
|
|
457
|
+
messageArr.splice(left, 0, message);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
return _toConsumableArray__default['default'](messageArr);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
464
|
+
|
|
465
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
128
466
|
|
|
129
467
|
/**
|
|
130
468
|
* ChannelState - A container class for the channel state.
|
|
@@ -201,7 +539,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
201
539
|
var m = messages[i];
|
|
202
540
|
|
|
203
541
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
204
|
-
messages[i] = _objectSpread$
|
|
542
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
205
543
|
user: user
|
|
206
544
|
});
|
|
207
545
|
}
|
|
@@ -256,7 +594,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
256
594
|
user: m.user
|
|
257
595
|
};
|
|
258
596
|
} else {
|
|
259
|
-
messages[i] = _objectSpread$
|
|
597
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
260
598
|
type: 'deleted',
|
|
261
599
|
deleted_at: user.deleted_at
|
|
262
600
|
});
|
|
@@ -363,7 +701,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
363
701
|
}, {
|
|
364
702
|
key: "formatMessage",
|
|
365
703
|
value: function formatMessage(message) {
|
|
366
|
-
return _objectSpread$
|
|
704
|
+
return _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
367
705
|
/**
|
|
368
706
|
* @deprecated please use `html`
|
|
369
707
|
*/
|
|
@@ -581,7 +919,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
581
919
|
var parseMessage = function parseMessage(m) {
|
|
582
920
|
var _m$pinned_at, _m$updated_at;
|
|
583
921
|
|
|
584
|
-
return _objectSpread$
|
|
922
|
+
return _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
585
923
|
created_at: m.created_at.toISOString(),
|
|
586
924
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
587
925
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -592,8 +930,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
592
930
|
var updatedMessages = set.messages.filter(function (msg) {
|
|
593
931
|
return msg.quoted_message_id === message.id;
|
|
594
932
|
}).map(parseMessage).map(function (msg) {
|
|
595
|
-
return _objectSpread$
|
|
596
|
-
quoted_message: _objectSpread$
|
|
933
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
934
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
597
935
|
attachments: []
|
|
598
936
|
})
|
|
599
937
|
});
|
|
@@ -674,66 +1012,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
674
1012
|
*/
|
|
675
1013
|
function _addToMessageList(messages, message) {
|
|
676
1014
|
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
677
|
-
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
678
|
-
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
679
|
-
|
|
680
|
-
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
681
|
-
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
682
|
-
|
|
683
|
-
if (timestampChanged) {
|
|
684
|
-
messageArr = messageArr.filter(function (msg) {
|
|
685
|
-
return !(msg.id && message.id === msg.id);
|
|
686
|
-
});
|
|
687
|
-
} // Get array length after filtering
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
691
|
-
|
|
692
|
-
if (messageArrayLength === 0 && addMessageToList) {
|
|
693
|
-
return messageArr.concat(message);
|
|
694
|
-
} else if (messageArrayLength === 0) {
|
|
695
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
var messageTime = message[sortBy].getTime();
|
|
699
|
-
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
700
|
-
|
|
701
|
-
if (messageIsNewest && addMessageToList) {
|
|
702
|
-
return messageArr.concat(message);
|
|
703
|
-
} else if (messageIsNewest) {
|
|
704
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
705
|
-
} // find the closest index to push the new message
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
var left = 0;
|
|
709
|
-
var middle = 0;
|
|
710
|
-
var right = messageArrayLength - 1;
|
|
711
|
-
|
|
712
|
-
while (left <= right) {
|
|
713
|
-
middle = Math.floor((right + left) / 2);
|
|
714
|
-
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
715
|
-
} // message already exists and not filtered due to timestampChanged, update and return
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (!timestampChanged && message.id) {
|
|
719
|
-
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
720
|
-
messageArr[left] = message;
|
|
721
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
725
|
-
messageArr[left - 1] = message;
|
|
726
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
727
|
-
}
|
|
728
|
-
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
729
|
-
// or have a timestamp change.
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
if (addMessageToList) {
|
|
733
|
-
messageArr.splice(left, 0, message);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
return _toConsumableArray__default['default'](messageArr);
|
|
1015
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
1016
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
1017
|
+
return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
|
|
737
1018
|
}
|
|
738
1019
|
/**
|
|
739
1020
|
* removeMessage - Description
|
|
@@ -1045,328 +1326,78 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1045
1326
|
isLatest: false
|
|
1046
1327
|
});
|
|
1047
1328
|
targetMessageSetIndex = this.messageSets.length - 1;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
break;
|
|
1051
|
-
|
|
1052
|
-
case 'current':
|
|
1053
|
-
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1054
|
-
return s.isCurrent;
|
|
1055
|
-
});
|
|
1056
|
-
break;
|
|
1057
|
-
|
|
1058
|
-
case 'latest':
|
|
1059
|
-
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1060
|
-
return s.isLatest;
|
|
1061
|
-
});
|
|
1062
|
-
break;
|
|
1063
|
-
|
|
1064
|
-
default:
|
|
1065
|
-
targetMessageSetIndex = -1;
|
|
1066
|
-
} // when merging the target set will be the first one from the overlapping message sets
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1070
|
-
|
|
1071
|
-
var mergeSourceMessageSetIndices = _toConsumableArray__default['default'](overlappingMessageSetIndices);
|
|
1072
|
-
|
|
1073
|
-
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1074
|
-
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1075
|
-
} // merge message sets
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1079
|
-
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1080
|
-
var sources = this.messageSets.filter(function (_, i) {
|
|
1081
|
-
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1082
|
-
});
|
|
1083
|
-
sources.forEach(function (messageSet) {
|
|
1084
|
-
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1085
|
-
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1086
|
-
messagesToAdd = [].concat(_toConsumableArray__default['default'](messagesToAdd), _toConsumableArray__default['default'](messageSet.messages));
|
|
1087
|
-
});
|
|
1088
|
-
sources.forEach(function (s) {
|
|
1089
|
-
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1090
|
-
});
|
|
1091
|
-
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1092
|
-
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1093
|
-
});
|
|
1094
|
-
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1095
|
-
}
|
|
1096
|
-
} else {
|
|
1097
|
-
// assumes that all new messages belong to the same set
|
|
1098
|
-
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
return {
|
|
1102
|
-
targetMessageSetIndex: targetMessageSetIndex,
|
|
1103
|
-
messagesToAdd: messagesToAdd
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
}]);
|
|
1107
|
-
|
|
1108
|
-
return ChannelState;
|
|
1109
|
-
}();
|
|
1110
|
-
|
|
1111
|
-
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1112
|
-
|
|
1113
|
-
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1114
|
-
|
|
1115
|
-
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
1119
|
-
* use this when you want to run the promise and handle errors by logging a warning
|
|
1120
|
-
*
|
|
1121
|
-
* @param {Promise<T>} promise The promise you want to run and log
|
|
1122
|
-
* @param {string} name A descriptive name of what the promise does for log output
|
|
1123
|
-
*
|
|
1124
|
-
*/
|
|
1125
|
-
function logChatPromiseExecution(promise, name) {
|
|
1126
|
-
promise.then().catch(function (error) {
|
|
1127
|
-
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
var sleep = function sleep(m) {
|
|
1131
|
-
return new Promise(function (r) {
|
|
1132
|
-
return setTimeout(r, m);
|
|
1133
|
-
});
|
|
1134
|
-
};
|
|
1135
|
-
function isFunction(value) {
|
|
1136
|
-
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
1137
|
-
}
|
|
1138
|
-
var chatCodes = {
|
|
1139
|
-
TOKEN_EXPIRED: 40,
|
|
1140
|
-
WS_CLOSED_SUCCESS: 1000
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
|
-
function isReadableStream(obj) {
|
|
1144
|
-
return obj !== null && _typeof__default['default'](obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
function isBuffer(obj) {
|
|
1148
|
-
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
1149
|
-
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
1150
|
-
obj.constructor.isBuffer(obj);
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
function isFileWebAPI(uri) {
|
|
1154
|
-
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
function isOwnUser(user) {
|
|
1158
|
-
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
function isBlobWebAPI(uri) {
|
|
1162
|
-
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
function isOwnUserBaseProperty(property) {
|
|
1166
|
-
var ownUserBaseProperties = {
|
|
1167
|
-
channel_mutes: true,
|
|
1168
|
-
devices: true,
|
|
1169
|
-
mutes: true,
|
|
1170
|
-
total_unread_count: true,
|
|
1171
|
-
unread_channels: true,
|
|
1172
|
-
unread_count: true,
|
|
1173
|
-
invisible: true,
|
|
1174
|
-
roles: true
|
|
1175
|
-
};
|
|
1176
|
-
return ownUserBaseProperties[property];
|
|
1177
|
-
}
|
|
1178
|
-
function addFileToFormData(uri, name, contentType) {
|
|
1179
|
-
var data = new FormData__default['default']();
|
|
1180
|
-
|
|
1181
|
-
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
1182
|
-
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
1183
|
-
} else {
|
|
1184
|
-
data.append('file', {
|
|
1185
|
-
uri: uri,
|
|
1186
|
-
name: name || uri.split('/').reverse()[0],
|
|
1187
|
-
contentType: contentType || undefined,
|
|
1188
|
-
type: contentType || undefined
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
return data;
|
|
1193
|
-
}
|
|
1194
|
-
function normalizeQuerySort(sort) {
|
|
1195
|
-
var sortFields = [];
|
|
1196
|
-
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
1197
|
-
|
|
1198
|
-
var _iterator = _createForOfIteratorHelper$3(sortArr),
|
|
1199
|
-
_step;
|
|
1200
|
-
|
|
1201
|
-
try {
|
|
1202
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1203
|
-
var item = _step.value;
|
|
1204
|
-
var entries = Object.entries(item);
|
|
1205
|
-
|
|
1206
|
-
if (entries.length > 1) {
|
|
1207
|
-
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
1211
|
-
var _entries$_i = _slicedToArray__default['default'](_entries[_i], 2),
|
|
1212
|
-
field = _entries$_i[0],
|
|
1213
|
-
direction = _entries$_i[1];
|
|
1214
|
-
|
|
1215
|
-
sortFields.push({
|
|
1216
|
-
field: field,
|
|
1217
|
-
direction: direction
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
} catch (err) {
|
|
1222
|
-
_iterator.e(err);
|
|
1223
|
-
} finally {
|
|
1224
|
-
_iterator.f();
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
return sortFields;
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* retryInterval - A retry interval which increases acc to number of failures
|
|
1231
|
-
*
|
|
1232
|
-
* @return {number} Duration to wait in milliseconds
|
|
1233
|
-
*/
|
|
1234
|
-
|
|
1235
|
-
function retryInterval(numberOfFailures) {
|
|
1236
|
-
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
1237
|
-
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
1238
|
-
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
1239
|
-
return Math.floor(Math.random() * (max - min) + min);
|
|
1240
|
-
}
|
|
1241
|
-
function randomId() {
|
|
1242
|
-
return generateUUIDv4();
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
function hex(bytes) {
|
|
1246
|
-
var s = '';
|
|
1247
|
-
|
|
1248
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1249
|
-
s += bytes[i].toString(16).padStart(2, '0');
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
return s;
|
|
1253
|
-
} // https://tools.ietf.org/html/rfc4122
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
function generateUUIDv4() {
|
|
1257
|
-
var bytes = getRandomBytes(16);
|
|
1258
|
-
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
1259
|
-
|
|
1260
|
-
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
1261
|
-
|
|
1262
|
-
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
function getRandomValuesWithMathRandom(bytes) {
|
|
1266
|
-
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
1267
|
-
|
|
1268
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1269
|
-
bytes[i] = Math.random() * max;
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
var getRandomValues = function () {
|
|
1274
|
-
var _crypto;
|
|
1275
|
-
|
|
1276
|
-
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
1277
|
-
return crypto.getRandomValues.bind(crypto);
|
|
1278
|
-
} else if (typeof msCrypto !== 'undefined') {
|
|
1279
|
-
return msCrypto.getRandomValues.bind(msCrypto);
|
|
1280
|
-
} else {
|
|
1281
|
-
return getRandomValuesWithMathRandom;
|
|
1282
|
-
}
|
|
1283
|
-
}();
|
|
1284
|
-
|
|
1285
|
-
function getRandomBytes(length) {
|
|
1286
|
-
var bytes = new Uint8Array(length);
|
|
1287
|
-
getRandomValues(bytes);
|
|
1288
|
-
return bytes;
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
function convertErrorToJson(err) {
|
|
1292
|
-
var jsonObj = {};
|
|
1293
|
-
if (!err) return jsonObj;
|
|
1294
|
-
|
|
1295
|
-
try {
|
|
1296
|
-
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
1297
|
-
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
1298
|
-
});
|
|
1299
|
-
} catch (_) {
|
|
1300
|
-
return {
|
|
1301
|
-
error: 'failed to serialize the error'
|
|
1302
|
-
};
|
|
1303
|
-
}
|
|
1329
|
+
}
|
|
1304
1330
|
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
/**
|
|
1308
|
-
* isOnline safely return the navigator.online value for browser env
|
|
1309
|
-
* if navigator is not in global object, it always return true
|
|
1310
|
-
*/
|
|
1331
|
+
break;
|
|
1311
1332
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1333
|
+
case 'current':
|
|
1334
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1335
|
+
return s.isCurrent;
|
|
1336
|
+
});
|
|
1337
|
+
break;
|
|
1314
1338
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1339
|
+
case 'latest':
|
|
1340
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1341
|
+
return s.isLatest;
|
|
1342
|
+
});
|
|
1343
|
+
break;
|
|
1319
1344
|
|
|
1345
|
+
default:
|
|
1346
|
+
targetMessageSetIndex = -1;
|
|
1347
|
+
} // when merging the target set will be the first one from the overlapping message sets
|
|
1320
1348
|
|
|
1321
|
-
if (typeof nav.onLine !== 'boolean') {
|
|
1322
|
-
return true;
|
|
1323
|
-
}
|
|
1324
1349
|
|
|
1325
|
-
|
|
1326
|
-
}
|
|
1327
|
-
/**
|
|
1328
|
-
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
1329
|
-
*/
|
|
1350
|
+
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1330
1351
|
|
|
1331
|
-
|
|
1332
|
-
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
1333
|
-
window.addEventListener('offline', cb);
|
|
1334
|
-
window.addEventListener('online', cb);
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
function removeConnectionEventListeners(cb) {
|
|
1338
|
-
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
1339
|
-
window.removeEventListener('offline', cb);
|
|
1340
|
-
window.removeEventListener('online', cb);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
1344
|
-
var newParams = [];
|
|
1352
|
+
var mergeSourceMessageSetIndices = _toConsumableArray__default['default'](overlappingMessageSetIndices);
|
|
1345
1353
|
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
if (params[k] === undefined) continue;
|
|
1354
|
+
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1355
|
+
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1356
|
+
} // merge message sets
|
|
1350
1357
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1358
|
+
|
|
1359
|
+
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1360
|
+
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1361
|
+
var sources = this.messageSets.filter(function (_, i) {
|
|
1362
|
+
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1363
|
+
});
|
|
1364
|
+
sources.forEach(function (messageSet) {
|
|
1365
|
+
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1366
|
+
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1367
|
+
messagesToAdd = [].concat(_toConsumableArray__default['default'](messagesToAdd), _toConsumableArray__default['default'](messageSet.messages));
|
|
1368
|
+
});
|
|
1369
|
+
sources.forEach(function (s) {
|
|
1370
|
+
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1371
|
+
});
|
|
1372
|
+
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1373
|
+
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1374
|
+
});
|
|
1375
|
+
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1376
|
+
}
|
|
1377
|
+
} else {
|
|
1378
|
+
// assumes that all new messages belong to the same set
|
|
1379
|
+
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
return {
|
|
1383
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1384
|
+
messagesToAdd: messagesToAdd
|
|
1385
|
+
};
|
|
1355
1386
|
}
|
|
1356
|
-
}
|
|
1387
|
+
}]);
|
|
1357
1388
|
|
|
1358
|
-
return
|
|
1359
|
-
};
|
|
1389
|
+
return ChannelState;
|
|
1390
|
+
}();
|
|
1360
1391
|
|
|
1361
|
-
function _createForOfIteratorHelper$
|
|
1392
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1362
1393
|
|
|
1363
|
-
function _unsupportedIterableToArray$
|
|
1394
|
+
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1364
1395
|
|
|
1365
|
-
function _arrayLikeToArray$
|
|
1396
|
+
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1366
1397
|
|
|
1367
|
-
function ownKeys$
|
|
1398
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1368
1399
|
|
|
1369
|
-
function _objectSpread$
|
|
1400
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1370
1401
|
|
|
1371
1402
|
/**
|
|
1372
1403
|
* Channel - The Channel class manages it's own state.
|
|
@@ -1439,7 +1470,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1439
1470
|
while (1) {
|
|
1440
1471
|
switch (_context.prev = _context.next) {
|
|
1441
1472
|
case 0:
|
|
1442
|
-
defaultOptions = _objectSpread$
|
|
1473
|
+
defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
1443
1474
|
watch: false,
|
|
1444
1475
|
state: false,
|
|
1445
1476
|
presence: false
|
|
@@ -1511,7 +1542,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1511
1542
|
|
|
1512
1543
|
this.data = data; // this._data is used for the requests...
|
|
1513
1544
|
|
|
1514
|
-
this._data = _objectSpread$
|
|
1545
|
+
this._data = _objectSpread$6({}, data);
|
|
1515
1546
|
this.cid = "".concat(type, ":").concat(id);
|
|
1516
1547
|
this.listeners = {}; // perhaps the state variable should be private
|
|
1517
1548
|
|
|
@@ -1568,23 +1599,19 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1568
1599
|
key: "sendMessage",
|
|
1569
1600
|
value: function () {
|
|
1570
1601
|
var _sendMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(message, options) {
|
|
1571
|
-
var sendMessageResponse;
|
|
1572
1602
|
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
1573
1603
|
while (1) {
|
|
1574
1604
|
switch (_context2.prev = _context2.next) {
|
|
1575
1605
|
case 0:
|
|
1576
1606
|
_context2.next = 2;
|
|
1577
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
1607
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
|
|
1578
1608
|
message: message
|
|
1579
1609
|
}, options));
|
|
1580
1610
|
|
|
1581
1611
|
case 2:
|
|
1582
|
-
|
|
1583
|
-
// Reset unreadCount to 0.
|
|
1584
|
-
this.state.unreadCount = 0;
|
|
1585
|
-
return _context2.abrupt("return", sendMessageResponse);
|
|
1612
|
+
return _context2.abrupt("return", _context2.sent);
|
|
1586
1613
|
|
|
1587
|
-
case
|
|
1614
|
+
case 3:
|
|
1588
1615
|
case "end":
|
|
1589
1616
|
return _context2.stop();
|
|
1590
1617
|
}
|
|
@@ -1693,7 +1720,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1693
1720
|
|
|
1694
1721
|
case 3:
|
|
1695
1722
|
// Return a list of channels
|
|
1696
|
-
payload = _objectSpread$
|
|
1723
|
+
payload = _objectSpread$6(_objectSpread$6({
|
|
1697
1724
|
filter_conditions: {
|
|
1698
1725
|
cid: this.cid
|
|
1699
1726
|
}
|
|
@@ -1790,7 +1817,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1790
1817
|
|
|
1791
1818
|
_context5.next = 6;
|
|
1792
1819
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
1793
|
-
payload: _objectSpread$
|
|
1820
|
+
payload: _objectSpread$6({
|
|
1794
1821
|
type: type,
|
|
1795
1822
|
id: id,
|
|
1796
1823
|
members: members,
|
|
@@ -1851,7 +1878,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1851
1878
|
|
|
1852
1879
|
case 4:
|
|
1853
1880
|
_context6.next = 6;
|
|
1854
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$
|
|
1881
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
|
|
1855
1882
|
reaction: reaction
|
|
1856
1883
|
}, options));
|
|
1857
1884
|
|
|
@@ -1932,7 +1959,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1932
1959
|
delete channelData[key];
|
|
1933
1960
|
});
|
|
1934
1961
|
_context7.next = 7;
|
|
1935
|
-
return this._update(_objectSpread$
|
|
1962
|
+
return this._update(_objectSpread$6({
|
|
1936
1963
|
message: updateMessage,
|
|
1937
1964
|
data: channelData
|
|
1938
1965
|
}, options));
|
|
@@ -2092,7 +2119,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2092
2119
|
case 0:
|
|
2093
2120
|
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
2094
2121
|
_context11.next = 3;
|
|
2095
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2122
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
|
|
2096
2123
|
|
|
2097
2124
|
case 3:
|
|
2098
2125
|
return _context11.abrupt("return", _context11.sent);
|
|
@@ -2168,7 +2195,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2168
2195
|
case 0:
|
|
2169
2196
|
options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
2170
2197
|
_context13.next = 3;
|
|
2171
|
-
return this._update(_objectSpread$
|
|
2198
|
+
return this._update(_objectSpread$6({
|
|
2172
2199
|
accept_invite: true
|
|
2173
2200
|
}, options));
|
|
2174
2201
|
|
|
@@ -2209,7 +2236,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2209
2236
|
case 0:
|
|
2210
2237
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2211
2238
|
_context14.next = 3;
|
|
2212
|
-
return this._update(_objectSpread$
|
|
2239
|
+
return this._update(_objectSpread$6({
|
|
2213
2240
|
reject_invite: true
|
|
2214
2241
|
}, options));
|
|
2215
2242
|
|
|
@@ -2251,7 +2278,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2251
2278
|
case 0:
|
|
2252
2279
|
options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
2253
2280
|
_context15.next = 3;
|
|
2254
|
-
return this._update(_objectSpread$
|
|
2281
|
+
return this._update(_objectSpread$6({
|
|
2255
2282
|
add_members: members,
|
|
2256
2283
|
message: message
|
|
2257
2284
|
}, options));
|
|
@@ -2294,7 +2321,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2294
2321
|
case 0:
|
|
2295
2322
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2296
2323
|
_context16.next = 3;
|
|
2297
|
-
return this._update(_objectSpread$
|
|
2324
|
+
return this._update(_objectSpread$6({
|
|
2298
2325
|
add_moderators: members,
|
|
2299
2326
|
message: message
|
|
2300
2327
|
}, options));
|
|
@@ -2337,7 +2364,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2337
2364
|
case 0:
|
|
2338
2365
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2339
2366
|
_context17.next = 3;
|
|
2340
|
-
return this._update(_objectSpread$
|
|
2367
|
+
return this._update(_objectSpread$6({
|
|
2341
2368
|
assign_roles: roles,
|
|
2342
2369
|
message: message
|
|
2343
2370
|
}, options));
|
|
@@ -2380,7 +2407,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2380
2407
|
case 0:
|
|
2381
2408
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2382
2409
|
_context18.next = 3;
|
|
2383
|
-
return this._update(_objectSpread$
|
|
2410
|
+
return this._update(_objectSpread$6({
|
|
2384
2411
|
invites: members,
|
|
2385
2412
|
message: message
|
|
2386
2413
|
}, options));
|
|
@@ -2423,7 +2450,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2423
2450
|
case 0:
|
|
2424
2451
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2425
2452
|
_context19.next = 3;
|
|
2426
|
-
return this._update(_objectSpread$
|
|
2453
|
+
return this._update(_objectSpread$6({
|
|
2427
2454
|
remove_members: members,
|
|
2428
2455
|
message: message
|
|
2429
2456
|
}, options));
|
|
@@ -2466,7 +2493,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2466
2493
|
case 0:
|
|
2467
2494
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
2468
2495
|
_context20.next = 3;
|
|
2469
|
-
return this._update(_objectSpread$
|
|
2496
|
+
return this._update(_objectSpread$6({
|
|
2470
2497
|
demote_moderators: members,
|
|
2471
2498
|
message: message
|
|
2472
2499
|
}, options));
|
|
@@ -2551,7 +2578,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2551
2578
|
case 0:
|
|
2552
2579
|
opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
2553
2580
|
_context22.next = 3;
|
|
2554
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
2581
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
|
|
2555
2582
|
channel_cid: this.cid
|
|
2556
2583
|
}, opts));
|
|
2557
2584
|
|
|
@@ -2593,7 +2620,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2593
2620
|
case 0:
|
|
2594
2621
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
2595
2622
|
_context23.next = 3;
|
|
2596
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
2623
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
|
|
2597
2624
|
channel_cid: this.cid
|
|
2598
2625
|
}, opts));
|
|
2599
2626
|
|
|
@@ -2652,7 +2679,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2652
2679
|
}, {
|
|
2653
2680
|
key: "keystroke",
|
|
2654
2681
|
value: function () {
|
|
2655
|
-
var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id) {
|
|
2682
|
+
var _keystroke = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee24(parent_id, options) {
|
|
2656
2683
|
var _this$getConfig;
|
|
2657
2684
|
|
|
2658
2685
|
var now, diff;
|
|
@@ -2680,10 +2707,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2680
2707
|
|
|
2681
2708
|
this.lastTypingEvent = new Date();
|
|
2682
2709
|
_context24.next = 10;
|
|
2683
|
-
return this.sendEvent({
|
|
2710
|
+
return this.sendEvent(_objectSpread$6({
|
|
2684
2711
|
type: 'typing.start',
|
|
2685
2712
|
parent_id: parent_id
|
|
2686
|
-
});
|
|
2713
|
+
}, options || {}));
|
|
2687
2714
|
|
|
2688
2715
|
case 10:
|
|
2689
2716
|
case "end":
|
|
@@ -2693,7 +2720,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2693
2720
|
}, _callee24, this);
|
|
2694
2721
|
}));
|
|
2695
2722
|
|
|
2696
|
-
function keystroke(_x25) {
|
|
2723
|
+
function keystroke(_x25, _x26) {
|
|
2697
2724
|
return _keystroke.apply(this, arguments);
|
|
2698
2725
|
}
|
|
2699
2726
|
|
|
@@ -2708,7 +2735,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2708
2735
|
}, {
|
|
2709
2736
|
key: "stopTyping",
|
|
2710
2737
|
value: function () {
|
|
2711
|
-
var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id) {
|
|
2738
|
+
var _stopTyping = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(parent_id, options) {
|
|
2712
2739
|
var _this$getConfig2;
|
|
2713
2740
|
|
|
2714
2741
|
return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
|
|
@@ -2726,10 +2753,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2726
2753
|
this.lastTypingEvent = null;
|
|
2727
2754
|
this.isTyping = false;
|
|
2728
2755
|
_context25.next = 6;
|
|
2729
|
-
return this.sendEvent({
|
|
2756
|
+
return this.sendEvent(_objectSpread$6({
|
|
2730
2757
|
type: 'typing.stop',
|
|
2731
2758
|
parent_id: parent_id
|
|
2732
|
-
});
|
|
2759
|
+
}, options || {}));
|
|
2733
2760
|
|
|
2734
2761
|
case 6:
|
|
2735
2762
|
case "end":
|
|
@@ -2739,7 +2766,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2739
2766
|
}, _callee25, this);
|
|
2740
2767
|
}));
|
|
2741
2768
|
|
|
2742
|
-
function stopTyping(
|
|
2769
|
+
function stopTyping(_x27, _x28) {
|
|
2743
2770
|
return _stopTyping.apply(this, arguments);
|
|
2744
2771
|
}
|
|
2745
2772
|
|
|
@@ -2802,7 +2829,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2802
2829
|
|
|
2803
2830
|
case 4:
|
|
2804
2831
|
_context26.next = 6;
|
|
2805
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
2832
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
|
|
2806
2833
|
|
|
2807
2834
|
case 6:
|
|
2808
2835
|
return _context26.abrupt("return", _context26.sent);
|
|
@@ -2849,7 +2876,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2849
2876
|
|
|
2850
2877
|
case 3:
|
|
2851
2878
|
_context27.next = 5;
|
|
2852
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
2879
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
|
|
2853
2880
|
|
|
2854
2881
|
case 5:
|
|
2855
2882
|
return _context27.abrupt("return", _context27.sent);
|
|
@@ -2862,7 +2889,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2862
2889
|
}, _callee27, this);
|
|
2863
2890
|
}));
|
|
2864
2891
|
|
|
2865
|
-
function markUnread(
|
|
2892
|
+
function markUnread(_x29) {
|
|
2866
2893
|
return _markUnread.apply(this, arguments);
|
|
2867
2894
|
}
|
|
2868
2895
|
|
|
@@ -2917,7 +2944,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2917
2944
|
defaultOptions.watch = false;
|
|
2918
2945
|
}
|
|
2919
2946
|
|
|
2920
|
-
combined = _objectSpread$
|
|
2947
|
+
combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
|
|
2921
2948
|
_context28.next = 7;
|
|
2922
2949
|
return this.query(combined, 'latest');
|
|
2923
2950
|
|
|
@@ -2941,7 +2968,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2941
2968
|
}, _callee28, this);
|
|
2942
2969
|
}));
|
|
2943
2970
|
|
|
2944
|
-
function watch(
|
|
2971
|
+
function watch(_x30) {
|
|
2945
2972
|
return _watch.apply(this, arguments);
|
|
2946
2973
|
}
|
|
2947
2974
|
|
|
@@ -3008,7 +3035,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3008
3035
|
switch (_context30.prev = _context30.next) {
|
|
3009
3036
|
case 0:
|
|
3010
3037
|
_context30.next = 2;
|
|
3011
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$
|
|
3038
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
|
|
3012
3039
|
|
|
3013
3040
|
case 2:
|
|
3014
3041
|
data = _context30.sent;
|
|
@@ -3028,7 +3055,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3028
3055
|
}, _callee30, this);
|
|
3029
3056
|
}));
|
|
3030
3057
|
|
|
3031
|
-
function getReplies(
|
|
3058
|
+
function getReplies(_x31, _x32) {
|
|
3032
3059
|
return _getReplies.apply(this, arguments);
|
|
3033
3060
|
}
|
|
3034
3061
|
|
|
@@ -3056,7 +3083,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3056
3083
|
sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
|
|
3057
3084
|
_context31.next = 3;
|
|
3058
3085
|
return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
|
|
3059
|
-
payload: _objectSpread$
|
|
3086
|
+
payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3060
3087
|
sort: normalizeQuerySort(sort)
|
|
3061
3088
|
})
|
|
3062
3089
|
});
|
|
@@ -3072,7 +3099,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3072
3099
|
}, _callee31, this);
|
|
3073
3100
|
}));
|
|
3074
3101
|
|
|
3075
|
-
function getPinnedMessages(
|
|
3102
|
+
function getPinnedMessages(_x33) {
|
|
3076
3103
|
return _getPinnedMessages.apply(this, arguments);
|
|
3077
3104
|
}
|
|
3078
3105
|
|
|
@@ -3090,7 +3117,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3090
3117
|
}, {
|
|
3091
3118
|
key: "getReactions",
|
|
3092
3119
|
value: function getReactions(message_id, options) {
|
|
3093
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$
|
|
3120
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
|
|
3094
3121
|
}
|
|
3095
3122
|
/**
|
|
3096
3123
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -3237,7 +3264,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3237
3264
|
}
|
|
3238
3265
|
|
|
3239
3266
|
_context32.next = 7;
|
|
3240
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
3267
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$6({
|
|
3241
3268
|
data: this._data,
|
|
3242
3269
|
state: true
|
|
3243
3270
|
}, options));
|
|
@@ -3301,7 +3328,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3301
3328
|
}, _callee32, this);
|
|
3302
3329
|
}));
|
|
3303
3330
|
|
|
3304
|
-
function query(
|
|
3331
|
+
function query(_x34) {
|
|
3305
3332
|
return _query.apply(this, arguments);
|
|
3306
3333
|
}
|
|
3307
3334
|
|
|
@@ -3326,7 +3353,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3326
3353
|
this._checkInitialized();
|
|
3327
3354
|
|
|
3328
3355
|
_context33.next = 3;
|
|
3329
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
3356
|
+
return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3330
3357
|
type: this.type,
|
|
3331
3358
|
id: this.id
|
|
3332
3359
|
}));
|
|
@@ -3342,7 +3369,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3342
3369
|
}, _callee33, this);
|
|
3343
3370
|
}));
|
|
3344
3371
|
|
|
3345
|
-
function banUser(
|
|
3372
|
+
function banUser(_x35, _x36) {
|
|
3346
3373
|
return _banUser.apply(this, arguments);
|
|
3347
3374
|
}
|
|
3348
3375
|
|
|
@@ -3473,7 +3500,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3473
3500
|
}, _callee36, this);
|
|
3474
3501
|
}));
|
|
3475
3502
|
|
|
3476
|
-
function unbanUser(
|
|
3503
|
+
function unbanUser(_x37) {
|
|
3477
3504
|
return _unbanUser.apply(this, arguments);
|
|
3478
3505
|
}
|
|
3479
3506
|
|
|
@@ -3498,7 +3525,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3498
3525
|
this._checkInitialized();
|
|
3499
3526
|
|
|
3500
3527
|
_context37.next = 3;
|
|
3501
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
3528
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3502
3529
|
type: this.type,
|
|
3503
3530
|
id: this.id
|
|
3504
3531
|
}));
|
|
@@ -3514,7 +3541,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3514
3541
|
}, _callee37, this);
|
|
3515
3542
|
}));
|
|
3516
3543
|
|
|
3517
|
-
function shadowBan(
|
|
3544
|
+
function shadowBan(_x38, _x39) {
|
|
3518
3545
|
return _shadowBan.apply(this, arguments);
|
|
3519
3546
|
}
|
|
3520
3547
|
|
|
@@ -3554,7 +3581,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3554
3581
|
}, _callee38, this);
|
|
3555
3582
|
}));
|
|
3556
3583
|
|
|
3557
|
-
function removeShadowBan(
|
|
3584
|
+
function removeShadowBan(_x40) {
|
|
3558
3585
|
return _removeShadowBan.apply(this, arguments);
|
|
3559
3586
|
}
|
|
3560
3587
|
|
|
@@ -3589,7 +3616,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3589
3616
|
}, _callee39, this);
|
|
3590
3617
|
}));
|
|
3591
3618
|
|
|
3592
|
-
function createCall(
|
|
3619
|
+
function createCall(_x41) {
|
|
3593
3620
|
return _createCall.apply(this, arguments);
|
|
3594
3621
|
}
|
|
3595
3622
|
|
|
@@ -3665,7 +3692,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3665
3692
|
}, {
|
|
3666
3693
|
key: "_handleChannelEvent",
|
|
3667
3694
|
value: function _handleChannelEvent(event) {
|
|
3668
|
-
var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9, _event$
|
|
3695
|
+
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;
|
|
3669
3696
|
|
|
3670
3697
|
var channel = this;
|
|
3671
3698
|
|
|
@@ -3696,7 +3723,6 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3696
3723
|
var _event$user4, _this$getClient$user;
|
|
3697
3724
|
|
|
3698
3725
|
channelState.read[event.user.id] = {
|
|
3699
|
-
// because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
|
|
3700
3726
|
last_read: new Date(event.created_at),
|
|
3701
3727
|
last_read_message_id: event.last_read_message_id,
|
|
3702
3728
|
user: event.user,
|
|
@@ -3753,7 +3779,13 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3753
3779
|
|
|
3754
3780
|
if (event.message.pinned) {
|
|
3755
3781
|
channelState.addPinnedMessage(event.message);
|
|
3756
|
-
}
|
|
3782
|
+
} // do not increase the unread count - the back-end does not increase the count neither in the following cases:
|
|
3783
|
+
// 1. the message is mine
|
|
3784
|
+
// 2. the message is a thread reply from any user
|
|
3785
|
+
|
|
3786
|
+
|
|
3787
|
+
var preventUnreadCountUpdate = ownMessage || isThreadMessage;
|
|
3788
|
+
if (preventUnreadCountUpdate) break;
|
|
3757
3789
|
|
|
3758
3790
|
if ((_event$user8 = event.user) !== null && _event$user8 !== void 0 && _event$user8.id) {
|
|
3759
3791
|
for (var userId in channelState.read) {
|
|
@@ -3769,9 +3801,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3769
3801
|
}
|
|
3770
3802
|
}
|
|
3771
3803
|
|
|
3772
|
-
if (
|
|
3773
|
-
channelState.unreadCount = 0;
|
|
3774
|
-
} else if (this._countMessageAsUnread(event.message)) {
|
|
3804
|
+
if (this._countMessageAsUnread(event.message)) {
|
|
3775
3805
|
channelState.unreadCount = channelState.unreadCount + 1;
|
|
3776
3806
|
}
|
|
3777
3807
|
}
|
|
@@ -3844,6 +3874,25 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3844
3874
|
|
|
3845
3875
|
break;
|
|
3846
3876
|
|
|
3877
|
+
case 'notification.mark_unread':
|
|
3878
|
+
{
|
|
3879
|
+
var _event$user10, _this$getClient$user3, _event$unread_message;
|
|
3880
|
+
|
|
3881
|
+
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);
|
|
3882
|
+
|
|
3883
|
+
if (!(_ownMessage && event.user)) break;
|
|
3884
|
+
var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
|
|
3885
|
+
channelState.read[event.user.id] = {
|
|
3886
|
+
first_unread_message_id: event.first_unread_message_id,
|
|
3887
|
+
last_read: new Date(event.last_read_at),
|
|
3888
|
+
last_read_message_id: event.last_read_message_id,
|
|
3889
|
+
user: event.user,
|
|
3890
|
+
unread_messages: unreadCount
|
|
3891
|
+
};
|
|
3892
|
+
channelState.unreadCount = unreadCount;
|
|
3893
|
+
break;
|
|
3894
|
+
}
|
|
3895
|
+
|
|
3847
3896
|
case 'channel.updated':
|
|
3848
3897
|
if (event.channel) {
|
|
3849
3898
|
var _event$channel2, _channel$data, _event$channel$hidden, _event$channel3, _channel$data2, _event$channel$own_ca, _event$channel4, _channel$data3;
|
|
@@ -3862,7 +3911,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3862
3911
|
});
|
|
3863
3912
|
}
|
|
3864
3913
|
|
|
3865
|
-
channel.data = _objectSpread$
|
|
3914
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
|
|
3866
3915
|
hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
|
|
3867
3916
|
own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
|
|
3868
3917
|
});
|
|
@@ -3893,7 +3942,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3893
3942
|
break;
|
|
3894
3943
|
|
|
3895
3944
|
case 'channel.hidden':
|
|
3896
|
-
channel.data = _objectSpread$
|
|
3945
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3897
3946
|
hidden: true
|
|
3898
3947
|
});
|
|
3899
3948
|
|
|
@@ -3904,26 +3953,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3904
3953
|
break;
|
|
3905
3954
|
|
|
3906
3955
|
case 'channel.visible':
|
|
3907
|
-
channel.data = _objectSpread$
|
|
3956
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3908
3957
|
hidden: false
|
|
3909
3958
|
});
|
|
3910
3959
|
break;
|
|
3911
3960
|
|
|
3912
3961
|
case 'user.banned':
|
|
3913
|
-
if (!((_event$
|
|
3914
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3962
|
+
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
3963
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3915
3964
|
shadow_banned: !!event.shadow,
|
|
3916
3965
|
banned: !event.shadow,
|
|
3917
|
-
user: _objectSpread$
|
|
3966
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
|
|
3918
3967
|
});
|
|
3919
3968
|
break;
|
|
3920
3969
|
|
|
3921
3970
|
case 'user.unbanned':
|
|
3922
|
-
if (!((_event$
|
|
3923
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3971
|
+
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
3972
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3924
3973
|
shadow_banned: false,
|
|
3925
3974
|
banned: false,
|
|
3926
|
-
user: _objectSpread$
|
|
3975
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
3927
3976
|
});
|
|
3928
3977
|
break;
|
|
3929
3978
|
} // any event can send over the online count
|
|
@@ -3953,7 +4002,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3953
4002
|
|
|
3954
4003
|
|
|
3955
4004
|
if (state.members) {
|
|
3956
|
-
var _iterator = _createForOfIteratorHelper$
|
|
4005
|
+
var _iterator = _createForOfIteratorHelper$3(state.members),
|
|
3957
4006
|
_step;
|
|
3958
4007
|
|
|
3959
4008
|
try {
|
|
@@ -3997,7 +4046,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3997
4046
|
|
|
3998
4047
|
|
|
3999
4048
|
if (state.watchers) {
|
|
4000
|
-
var _iterator2 = _createForOfIteratorHelper$
|
|
4049
|
+
var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
|
|
4001
4050
|
_step2;
|
|
4002
4051
|
|
|
4003
4052
|
try {
|
|
@@ -4033,7 +4082,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4033
4082
|
|
|
4034
4083
|
|
|
4035
4084
|
if (state.read) {
|
|
4036
|
-
var _iterator3 = _createForOfIteratorHelper$
|
|
4085
|
+
var _iterator3 = _createForOfIteratorHelper$3(state.read),
|
|
4037
4086
|
_step3;
|
|
4038
4087
|
|
|
4039
4088
|
try {
|
|
@@ -4102,11 +4151,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4102
4151
|
return Channel;
|
|
4103
4152
|
}();
|
|
4104
4153
|
|
|
4105
|
-
function _createForOfIteratorHelper$
|
|
4154
|
+
function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4106
4155
|
|
|
4107
|
-
function _unsupportedIterableToArray$
|
|
4156
|
+
function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
|
|
4108
4157
|
|
|
4109
|
-
function _arrayLikeToArray$
|
|
4158
|
+
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
4110
4159
|
|
|
4111
4160
|
/**
|
|
4112
4161
|
* ClientState - A container class for the client state.
|
|
@@ -4129,7 +4178,7 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4129
4178
|
_createClass__default['default'](ClientState, [{
|
|
4130
4179
|
key: "updateUsers",
|
|
4131
4180
|
value: function updateUsers(users) {
|
|
4132
|
-
var _iterator = _createForOfIteratorHelper$
|
|
4181
|
+
var _iterator = _createForOfIteratorHelper$2(users),
|
|
4133
4182
|
_step;
|
|
4134
4183
|
|
|
4135
4184
|
try {
|
|
@@ -4177,9 +4226,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4177
4226
|
return ClientState;
|
|
4178
4227
|
}();
|
|
4179
4228
|
|
|
4180
|
-
function ownKeys$
|
|
4229
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4181
4230
|
|
|
4182
|
-
function _objectSpread$
|
|
4231
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4183
4232
|
var InsightMetrics = function InsightMetrics() {
|
|
4184
4233
|
_classCallCheck__default['default'](this, InsightMetrics);
|
|
4185
4234
|
|
|
@@ -4258,7 +4307,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
4258
4307
|
};
|
|
4259
4308
|
}();
|
|
4260
4309
|
function buildWsFatalInsight(connection, event) {
|
|
4261
|
-
return _objectSpread$
|
|
4310
|
+
return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
|
|
4262
4311
|
}
|
|
4263
4312
|
|
|
4264
4313
|
function buildWsBaseInsight(connection) {
|
|
@@ -4291,9 +4340,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
4291
4340
|
return buildWsBaseInsight(connection);
|
|
4292
4341
|
}
|
|
4293
4342
|
|
|
4294
|
-
function ownKeys$
|
|
4343
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4295
4344
|
|
|
4296
|
-
function _objectSpread$
|
|
4345
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4297
4346
|
|
|
4298
4347
|
// Type guards to check WebSocket error type
|
|
4299
4348
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -4657,7 +4706,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4657
4706
|
value: function _log(msg) {
|
|
4658
4707
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4659
4708
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
4660
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
4709
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$4({
|
|
4661
4710
|
tags: ['connection']
|
|
4662
4711
|
}, extra));
|
|
4663
4712
|
}
|
|
@@ -5248,9 +5297,9 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5248
5297
|
return StableWSConnection;
|
|
5249
5298
|
}();
|
|
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
|
|
|
@@ -5681,9 +5730,9 @@ function isErrorResponse(res) {
|
|
|
5681
5730
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
5682
5731
|
}
|
|
5683
5732
|
|
|
5684
|
-
function ownKeys$
|
|
5733
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5685
5734
|
|
|
5686
|
-
function _objectSpread$
|
|
5735
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5687
5736
|
var ConnectionState;
|
|
5688
5737
|
|
|
5689
5738
|
(function (ConnectionState) {
|
|
@@ -5746,7 +5795,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5746
5795
|
_context.next = 4;
|
|
5747
5796
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
5748
5797
|
undefined, {
|
|
5749
|
-
config: _objectSpread$
|
|
5798
|
+
config: _objectSpread$2(_objectSpread$2({}, config), {}, {
|
|
5750
5799
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
5751
5800
|
}),
|
|
5752
5801
|
params: params
|
|
@@ -6024,7 +6073,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6024
6073
|
value: function _log(msg) {
|
|
6025
6074
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6026
6075
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
6027
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
6076
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
|
|
6028
6077
|
tags: ['connection_fallback', 'connection']
|
|
6029
6078
|
}, extra));
|
|
6030
6079
|
}
|
|
@@ -6071,6 +6120,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
6071
6120
|
/**
|
|
6072
6121
|
* Response Types
|
|
6073
6122
|
*/
|
|
6123
|
+
// TODO: Figure out a way to strongly type set and unset.
|
|
6074
6124
|
// Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
|
|
6075
6125
|
|
|
6076
6126
|
/**
|
|
@@ -6142,6 +6192,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
|
6142
6192
|
return ErrorFromResponse;
|
|
6143
6193
|
}( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
|
|
6144
6194
|
|
|
6195
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6196
|
+
|
|
6197
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6198
|
+
|
|
6199
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6200
|
+
|
|
6201
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
6202
|
+
|
|
6203
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6204
|
+
var Thread = /*#__PURE__*/function () {
|
|
6205
|
+
function Thread(client, t) {
|
|
6206
|
+
_classCallCheck__default['default'](this, Thread);
|
|
6207
|
+
|
|
6208
|
+
_defineProperty__default['default'](this, "id", void 0);
|
|
6209
|
+
|
|
6210
|
+
_defineProperty__default['default'](this, "latestReplies", []);
|
|
6211
|
+
|
|
6212
|
+
_defineProperty__default['default'](this, "participants", []);
|
|
6213
|
+
|
|
6214
|
+
_defineProperty__default['default'](this, "message", void 0);
|
|
6215
|
+
|
|
6216
|
+
_defineProperty__default['default'](this, "channel", void 0);
|
|
6217
|
+
|
|
6218
|
+
_defineProperty__default['default'](this, "_channel", void 0);
|
|
6219
|
+
|
|
6220
|
+
_defineProperty__default['default'](this, "replyCount", 0);
|
|
6221
|
+
|
|
6222
|
+
_defineProperty__default['default'](this, "_client", void 0);
|
|
6223
|
+
|
|
6224
|
+
_defineProperty__default['default'](this, "read", {});
|
|
6225
|
+
|
|
6226
|
+
this.id = t.parent_message.id;
|
|
6227
|
+
this.message = formatMessage(t.parent_message);
|
|
6228
|
+
this.latestReplies = t.latest_replies.map(formatMessage);
|
|
6229
|
+
this.participants = t.thread_participants;
|
|
6230
|
+
this.replyCount = t.reply_count;
|
|
6231
|
+
this.channel = t.channel;
|
|
6232
|
+
this._channel = client.channel(t.channel.type, t.channel.id);
|
|
6233
|
+
this._client = client;
|
|
6234
|
+
|
|
6235
|
+
var _iterator = _createForOfIteratorHelper$1(t.read),
|
|
6236
|
+
_step;
|
|
6237
|
+
|
|
6238
|
+
try {
|
|
6239
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6240
|
+
var r = _step.value;
|
|
6241
|
+
this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
|
|
6242
|
+
last_read: new Date(r.last_read)
|
|
6243
|
+
});
|
|
6244
|
+
}
|
|
6245
|
+
} catch (err) {
|
|
6246
|
+
_iterator.e(err);
|
|
6247
|
+
} finally {
|
|
6248
|
+
_iterator.f();
|
|
6249
|
+
}
|
|
6250
|
+
}
|
|
6251
|
+
|
|
6252
|
+
_createClass__default['default'](Thread, [{
|
|
6253
|
+
key: "getClient",
|
|
6254
|
+
value: function getClient() {
|
|
6255
|
+
return this._client;
|
|
6256
|
+
}
|
|
6257
|
+
}, {
|
|
6258
|
+
key: "addReply",
|
|
6259
|
+
value: function addReply(message) {
|
|
6260
|
+
this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
|
|
6261
|
+
}
|
|
6262
|
+
}, {
|
|
6263
|
+
key: "updateReply",
|
|
6264
|
+
value: function updateReply(message) {
|
|
6265
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6266
|
+
if (m.id === message.id) {
|
|
6267
|
+
return formatMessage(message);
|
|
6268
|
+
}
|
|
6269
|
+
|
|
6270
|
+
return m;
|
|
6271
|
+
});
|
|
6272
|
+
}
|
|
6273
|
+
}, {
|
|
6274
|
+
key: "updateMessageOrReplyIfExists",
|
|
6275
|
+
value: function updateMessageOrReplyIfExists(message) {
|
|
6276
|
+
if (!message.parent_id && message.id !== this.message.id) {
|
|
6277
|
+
return;
|
|
6278
|
+
}
|
|
6279
|
+
|
|
6280
|
+
if (message.parent_id && message.parent_id !== this.message.id) {
|
|
6281
|
+
return;
|
|
6282
|
+
}
|
|
6283
|
+
|
|
6284
|
+
if (message.parent_id && message.parent_id === this.message.id) {
|
|
6285
|
+
this.updateReply(message);
|
|
6286
|
+
}
|
|
6287
|
+
|
|
6288
|
+
if (!message.parent_id && message.id === this.message.id) {
|
|
6289
|
+
this.message = formatMessage(message);
|
|
6290
|
+
}
|
|
6291
|
+
}
|
|
6292
|
+
}, {
|
|
6293
|
+
key: "addReaction",
|
|
6294
|
+
value: function addReaction(reaction, message, enforce_unique) {
|
|
6295
|
+
var _this = this;
|
|
6296
|
+
|
|
6297
|
+
if (!message) return;
|
|
6298
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6299
|
+
if (m.id === message.id) {
|
|
6300
|
+
return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
|
|
6301
|
+
}
|
|
6302
|
+
|
|
6303
|
+
return m;
|
|
6304
|
+
});
|
|
6305
|
+
}
|
|
6306
|
+
}, {
|
|
6307
|
+
key: "removeReaction",
|
|
6308
|
+
value: function removeReaction(reaction, message) {
|
|
6309
|
+
var _this2 = this;
|
|
6310
|
+
|
|
6311
|
+
if (!message) return;
|
|
6312
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6313
|
+
if (m.id === message.id) {
|
|
6314
|
+
return formatMessage(_this2._channel.state.removeReaction(reaction, message));
|
|
6315
|
+
}
|
|
6316
|
+
|
|
6317
|
+
return m;
|
|
6318
|
+
});
|
|
6319
|
+
}
|
|
6320
|
+
}]);
|
|
6321
|
+
|
|
6322
|
+
return Thread;
|
|
6323
|
+
}();
|
|
6324
|
+
|
|
6145
6325
|
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
6146
6326
|
_excluded2 = ["params", "headers"];
|
|
6147
6327
|
|
|
@@ -8486,6 +8666,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8486
8666
|
|
|
8487
8667
|
return getDevices;
|
|
8488
8668
|
}()
|
|
8669
|
+
/**
|
|
8670
|
+
* getUnreadCount - Returns unread counts for a single user
|
|
8671
|
+
*
|
|
8672
|
+
* @param {string} [userID] User ID.
|
|
8673
|
+
*
|
|
8674
|
+
* @return {<GetUnreadCountAPIResponse>}
|
|
8675
|
+
*/
|
|
8676
|
+
|
|
8489
8677
|
}, {
|
|
8490
8678
|
key: "getUnreadCount",
|
|
8491
8679
|
value: function () {
|
|
@@ -8507,14 +8695,52 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8507
8695
|
return _context24.stop();
|
|
8508
8696
|
}
|
|
8509
8697
|
}
|
|
8510
|
-
}, _callee24, this);
|
|
8698
|
+
}, _callee24, this);
|
|
8699
|
+
}));
|
|
8700
|
+
|
|
8701
|
+
function getUnreadCount(_x25) {
|
|
8702
|
+
return _getUnreadCount.apply(this, arguments);
|
|
8703
|
+
}
|
|
8704
|
+
|
|
8705
|
+
return getUnreadCount;
|
|
8706
|
+
}()
|
|
8707
|
+
/**
|
|
8708
|
+
* getUnreadCountBatch - Returns unread counts for multiple users at once. Only works server side.
|
|
8709
|
+
*
|
|
8710
|
+
* @param {string[]} [userIDs] List of user IDs to fetch unread counts for.
|
|
8711
|
+
*
|
|
8712
|
+
* @return {<GetUnreadCountBatchAPIResponse>}
|
|
8713
|
+
*/
|
|
8714
|
+
|
|
8715
|
+
}, {
|
|
8716
|
+
key: "getUnreadCountBatch",
|
|
8717
|
+
value: function () {
|
|
8718
|
+
var _getUnreadCountBatch = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee25(userIDs) {
|
|
8719
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee25$(_context25) {
|
|
8720
|
+
while (1) {
|
|
8721
|
+
switch (_context25.prev = _context25.next) {
|
|
8722
|
+
case 0:
|
|
8723
|
+
_context25.next = 2;
|
|
8724
|
+
return this.post(this.baseURL + '/unread_batch', {
|
|
8725
|
+
user_ids: userIDs
|
|
8726
|
+
});
|
|
8727
|
+
|
|
8728
|
+
case 2:
|
|
8729
|
+
return _context25.abrupt("return", _context25.sent);
|
|
8730
|
+
|
|
8731
|
+
case 3:
|
|
8732
|
+
case "end":
|
|
8733
|
+
return _context25.stop();
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8736
|
+
}, _callee25, this);
|
|
8511
8737
|
}));
|
|
8512
8738
|
|
|
8513
|
-
function
|
|
8514
|
-
return
|
|
8739
|
+
function getUnreadCountBatch(_x26) {
|
|
8740
|
+
return _getUnreadCountBatch.apply(this, arguments);
|
|
8515
8741
|
}
|
|
8516
8742
|
|
|
8517
|
-
return
|
|
8743
|
+
return getUnreadCountBatch;
|
|
8518
8744
|
}()
|
|
8519
8745
|
/**
|
|
8520
8746
|
* removeDevice - Removes the device with the given id. Clientside users can only delete their own devices
|
|
@@ -8527,12 +8753,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8527
8753
|
}, {
|
|
8528
8754
|
key: "removeDevice",
|
|
8529
8755
|
value: function () {
|
|
8530
|
-
var _removeDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8531
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8756
|
+
var _removeDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee26(id, userID) {
|
|
8757
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee26$(_context26) {
|
|
8532
8758
|
while (1) {
|
|
8533
|
-
switch (
|
|
8759
|
+
switch (_context26.prev = _context26.next) {
|
|
8534
8760
|
case 0:
|
|
8535
|
-
|
|
8761
|
+
_context26.next = 2;
|
|
8536
8762
|
return this.delete(this.baseURL + '/devices', _objectSpread({
|
|
8537
8763
|
id: id
|
|
8538
8764
|
}, userID ? {
|
|
@@ -8540,17 +8766,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8540
8766
|
} : {}));
|
|
8541
8767
|
|
|
8542
8768
|
case 2:
|
|
8543
|
-
return
|
|
8769
|
+
return _context26.abrupt("return", _context26.sent);
|
|
8544
8770
|
|
|
8545
8771
|
case 3:
|
|
8546
8772
|
case "end":
|
|
8547
|
-
return
|
|
8773
|
+
return _context26.stop();
|
|
8548
8774
|
}
|
|
8549
8775
|
}
|
|
8550
|
-
},
|
|
8776
|
+
}, _callee26, this);
|
|
8551
8777
|
}));
|
|
8552
8778
|
|
|
8553
|
-
function removeDevice(
|
|
8779
|
+
function removeDevice(_x27, _x28) {
|
|
8554
8780
|
return _removeDevice.apply(this, arguments);
|
|
8555
8781
|
}
|
|
8556
8782
|
|
|
@@ -8567,15 +8793,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8567
8793
|
}, {
|
|
8568
8794
|
key: "getRateLimits",
|
|
8569
8795
|
value: function () {
|
|
8570
|
-
var _getRateLimits = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8796
|
+
var _getRateLimits = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee27(params) {
|
|
8571
8797
|
var _ref7, serverSide, web, android, ios, endpoints;
|
|
8572
8798
|
|
|
8573
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8799
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee27$(_context27) {
|
|
8574
8800
|
while (1) {
|
|
8575
|
-
switch (
|
|
8801
|
+
switch (_context27.prev = _context27.next) {
|
|
8576
8802
|
case 0:
|
|
8577
8803
|
_ref7 = params || {}, serverSide = _ref7.serverSide, web = _ref7.web, android = _ref7.android, ios = _ref7.ios, endpoints = _ref7.endpoints;
|
|
8578
|
-
return
|
|
8804
|
+
return _context27.abrupt("return", this.get(this.baseURL + '/rate_limits', {
|
|
8579
8805
|
server_side: serverSide,
|
|
8580
8806
|
web: web,
|
|
8581
8807
|
android: android,
|
|
@@ -8585,13 +8811,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8585
8811
|
|
|
8586
8812
|
case 2:
|
|
8587
8813
|
case "end":
|
|
8588
|
-
return
|
|
8814
|
+
return _context27.stop();
|
|
8589
8815
|
}
|
|
8590
8816
|
}
|
|
8591
|
-
},
|
|
8817
|
+
}, _callee27, this);
|
|
8592
8818
|
}));
|
|
8593
8819
|
|
|
8594
|
-
function getRateLimits(
|
|
8820
|
+
function getRateLimits(_x29) {
|
|
8595
8821
|
return _getRateLimits.apply(this, arguments);
|
|
8596
8822
|
}
|
|
8597
8823
|
|
|
@@ -8682,26 +8908,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8682
8908
|
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
|
|
8683
8909
|
*/
|
|
8684
8910
|
function () {
|
|
8685
|
-
var _partialUpdateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8686
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8911
|
+
var _partialUpdateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee28(partialUserObject) {
|
|
8912
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee28$(_context28) {
|
|
8687
8913
|
while (1) {
|
|
8688
|
-
switch (
|
|
8914
|
+
switch (_context28.prev = _context28.next) {
|
|
8689
8915
|
case 0:
|
|
8690
|
-
|
|
8916
|
+
_context28.next = 2;
|
|
8691
8917
|
return this.partialUpdateUsers([partialUserObject]);
|
|
8692
8918
|
|
|
8693
8919
|
case 2:
|
|
8694
|
-
return
|
|
8920
|
+
return _context28.abrupt("return", _context28.sent);
|
|
8695
8921
|
|
|
8696
8922
|
case 3:
|
|
8697
8923
|
case "end":
|
|
8698
|
-
return
|
|
8924
|
+
return _context28.stop();
|
|
8699
8925
|
}
|
|
8700
8926
|
}
|
|
8701
|
-
},
|
|
8927
|
+
}, _callee28, this);
|
|
8702
8928
|
}));
|
|
8703
8929
|
|
|
8704
|
-
function partialUpdateUser(
|
|
8930
|
+
function partialUpdateUser(_x30) {
|
|
8705
8931
|
return _partialUpdateUser.apply(this, arguments);
|
|
8706
8932
|
}
|
|
8707
8933
|
|
|
@@ -8718,29 +8944,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8718
8944
|
}, {
|
|
8719
8945
|
key: "upsertUsers",
|
|
8720
8946
|
value: function () {
|
|
8721
|
-
var _upsertUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8947
|
+
var _upsertUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee29(users) {
|
|
8722
8948
|
var userMap, _iterator4, _step4, userObject;
|
|
8723
8949
|
|
|
8724
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
8950
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee29$(_context29) {
|
|
8725
8951
|
while (1) {
|
|
8726
|
-
switch (
|
|
8952
|
+
switch (_context29.prev = _context29.next) {
|
|
8727
8953
|
case 0:
|
|
8728
8954
|
userMap = {};
|
|
8729
8955
|
_iterator4 = _createForOfIteratorHelper(users);
|
|
8730
|
-
|
|
8956
|
+
_context29.prev = 2;
|
|
8731
8957
|
|
|
8732
8958
|
_iterator4.s();
|
|
8733
8959
|
|
|
8734
8960
|
case 4:
|
|
8735
8961
|
if ((_step4 = _iterator4.n()).done) {
|
|
8736
|
-
|
|
8962
|
+
_context29.next = 11;
|
|
8737
8963
|
break;
|
|
8738
8964
|
}
|
|
8739
8965
|
|
|
8740
8966
|
userObject = _step4.value;
|
|
8741
8967
|
|
|
8742
8968
|
if (userObject.id) {
|
|
8743
|
-
|
|
8969
|
+
_context29.next = 8;
|
|
8744
8970
|
break;
|
|
8745
8971
|
}
|
|
8746
8972
|
|
|
@@ -8750,44 +8976,44 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8750
8976
|
userMap[userObject.id] = userObject;
|
|
8751
8977
|
|
|
8752
8978
|
case 9:
|
|
8753
|
-
|
|
8979
|
+
_context29.next = 4;
|
|
8754
8980
|
break;
|
|
8755
8981
|
|
|
8756
8982
|
case 11:
|
|
8757
|
-
|
|
8983
|
+
_context29.next = 16;
|
|
8758
8984
|
break;
|
|
8759
8985
|
|
|
8760
8986
|
case 13:
|
|
8761
|
-
|
|
8762
|
-
|
|
8987
|
+
_context29.prev = 13;
|
|
8988
|
+
_context29.t0 = _context29["catch"](2);
|
|
8763
8989
|
|
|
8764
|
-
_iterator4.e(
|
|
8990
|
+
_iterator4.e(_context29.t0);
|
|
8765
8991
|
|
|
8766
8992
|
case 16:
|
|
8767
|
-
|
|
8993
|
+
_context29.prev = 16;
|
|
8768
8994
|
|
|
8769
8995
|
_iterator4.f();
|
|
8770
8996
|
|
|
8771
|
-
return
|
|
8997
|
+
return _context29.finish(16);
|
|
8772
8998
|
|
|
8773
8999
|
case 19:
|
|
8774
|
-
|
|
9000
|
+
_context29.next = 21;
|
|
8775
9001
|
return this.post(this.baseURL + '/users', {
|
|
8776
9002
|
users: userMap
|
|
8777
9003
|
});
|
|
8778
9004
|
|
|
8779
9005
|
case 21:
|
|
8780
|
-
return
|
|
9006
|
+
return _context29.abrupt("return", _context29.sent);
|
|
8781
9007
|
|
|
8782
9008
|
case 22:
|
|
8783
9009
|
case "end":
|
|
8784
|
-
return
|
|
9010
|
+
return _context29.stop();
|
|
8785
9011
|
}
|
|
8786
9012
|
}
|
|
8787
|
-
},
|
|
9013
|
+
}, _callee29, this, [[2, 13, 16, 19]]);
|
|
8788
9014
|
}));
|
|
8789
9015
|
|
|
8790
|
-
function upsertUsers(
|
|
9016
|
+
function upsertUsers(_x31) {
|
|
8791
9017
|
return _upsertUsers.apply(this, arguments);
|
|
8792
9018
|
}
|
|
8793
9019
|
|
|
@@ -8835,72 +9061,72 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8835
9061
|
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
8836
9062
|
*/
|
|
8837
9063
|
function () {
|
|
8838
|
-
var _partialUpdateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9064
|
+
var _partialUpdateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee30(users) {
|
|
8839
9065
|
var _iterator5, _step5, userObject;
|
|
8840
9066
|
|
|
8841
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9067
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee30$(_context30) {
|
|
8842
9068
|
while (1) {
|
|
8843
|
-
switch (
|
|
9069
|
+
switch (_context30.prev = _context30.next) {
|
|
8844
9070
|
case 0:
|
|
8845
9071
|
_iterator5 = _createForOfIteratorHelper(users);
|
|
8846
|
-
|
|
9072
|
+
_context30.prev = 1;
|
|
8847
9073
|
|
|
8848
9074
|
_iterator5.s();
|
|
8849
9075
|
|
|
8850
9076
|
case 3:
|
|
8851
9077
|
if ((_step5 = _iterator5.n()).done) {
|
|
8852
|
-
|
|
9078
|
+
_context30.next = 9;
|
|
8853
9079
|
break;
|
|
8854
9080
|
}
|
|
8855
9081
|
|
|
8856
9082
|
userObject = _step5.value;
|
|
8857
9083
|
|
|
8858
9084
|
if (userObject.id) {
|
|
8859
|
-
|
|
9085
|
+
_context30.next = 7;
|
|
8860
9086
|
break;
|
|
8861
9087
|
}
|
|
8862
9088
|
|
|
8863
9089
|
throw Error('User ID is required when updating a user');
|
|
8864
9090
|
|
|
8865
9091
|
case 7:
|
|
8866
|
-
|
|
9092
|
+
_context30.next = 3;
|
|
8867
9093
|
break;
|
|
8868
9094
|
|
|
8869
9095
|
case 9:
|
|
8870
|
-
|
|
9096
|
+
_context30.next = 14;
|
|
8871
9097
|
break;
|
|
8872
9098
|
|
|
8873
9099
|
case 11:
|
|
8874
|
-
|
|
8875
|
-
|
|
9100
|
+
_context30.prev = 11;
|
|
9101
|
+
_context30.t0 = _context30["catch"](1);
|
|
8876
9102
|
|
|
8877
|
-
_iterator5.e(
|
|
9103
|
+
_iterator5.e(_context30.t0);
|
|
8878
9104
|
|
|
8879
9105
|
case 14:
|
|
8880
|
-
|
|
9106
|
+
_context30.prev = 14;
|
|
8881
9107
|
|
|
8882
9108
|
_iterator5.f();
|
|
8883
9109
|
|
|
8884
|
-
return
|
|
9110
|
+
return _context30.finish(14);
|
|
8885
9111
|
|
|
8886
9112
|
case 17:
|
|
8887
|
-
|
|
9113
|
+
_context30.next = 19;
|
|
8888
9114
|
return this.patch(this.baseURL + '/users', {
|
|
8889
9115
|
users: users
|
|
8890
9116
|
});
|
|
8891
9117
|
|
|
8892
9118
|
case 19:
|
|
8893
|
-
return
|
|
9119
|
+
return _context30.abrupt("return", _context30.sent);
|
|
8894
9120
|
|
|
8895
9121
|
case 20:
|
|
8896
9122
|
case "end":
|
|
8897
|
-
return
|
|
9123
|
+
return _context30.stop();
|
|
8898
9124
|
}
|
|
8899
9125
|
}
|
|
8900
|
-
},
|
|
9126
|
+
}, _callee30, this, [[1, 11, 14, 17]]);
|
|
8901
9127
|
}));
|
|
8902
9128
|
|
|
8903
|
-
function partialUpdateUsers(
|
|
9129
|
+
function partialUpdateUsers(_x32) {
|
|
8904
9130
|
return _partialUpdateUsers.apply(this, arguments);
|
|
8905
9131
|
}
|
|
8906
9132
|
|
|
@@ -8909,26 +9135,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8909
9135
|
}, {
|
|
8910
9136
|
key: "deleteUser",
|
|
8911
9137
|
value: function () {
|
|
8912
|
-
var _deleteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8913
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9138
|
+
var _deleteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee31(userID, params) {
|
|
9139
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee31$(_context31) {
|
|
8914
9140
|
while (1) {
|
|
8915
|
-
switch (
|
|
9141
|
+
switch (_context31.prev = _context31.next) {
|
|
8916
9142
|
case 0:
|
|
8917
|
-
|
|
9143
|
+
_context31.next = 2;
|
|
8918
9144
|
return this.delete(this.baseURL + "/users/".concat(userID), params);
|
|
8919
9145
|
|
|
8920
9146
|
case 2:
|
|
8921
|
-
return
|
|
9147
|
+
return _context31.abrupt("return", _context31.sent);
|
|
8922
9148
|
|
|
8923
9149
|
case 3:
|
|
8924
9150
|
case "end":
|
|
8925
|
-
return
|
|
9151
|
+
return _context31.stop();
|
|
8926
9152
|
}
|
|
8927
9153
|
}
|
|
8928
|
-
},
|
|
9154
|
+
}, _callee31, this);
|
|
8929
9155
|
}));
|
|
8930
9156
|
|
|
8931
|
-
function deleteUser(
|
|
9157
|
+
function deleteUser(_x33, _x34) {
|
|
8932
9158
|
return _deleteUser.apply(this, arguments);
|
|
8933
9159
|
}
|
|
8934
9160
|
|
|
@@ -8945,28 +9171,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8945
9171
|
}, {
|
|
8946
9172
|
key: "restoreUsers",
|
|
8947
9173
|
value: function () {
|
|
8948
|
-
var _restoreUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8949
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9174
|
+
var _restoreUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee32(user_ids) {
|
|
9175
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee32$(_context32) {
|
|
8950
9176
|
while (1) {
|
|
8951
|
-
switch (
|
|
9177
|
+
switch (_context32.prev = _context32.next) {
|
|
8952
9178
|
case 0:
|
|
8953
|
-
|
|
9179
|
+
_context32.next = 2;
|
|
8954
9180
|
return this.post(this.baseURL + "/users/restore", {
|
|
8955
9181
|
user_ids: user_ids
|
|
8956
9182
|
});
|
|
8957
9183
|
|
|
8958
9184
|
case 2:
|
|
8959
|
-
return
|
|
9185
|
+
return _context32.abrupt("return", _context32.sent);
|
|
8960
9186
|
|
|
8961
9187
|
case 3:
|
|
8962
9188
|
case "end":
|
|
8963
|
-
return
|
|
9189
|
+
return _context32.stop();
|
|
8964
9190
|
}
|
|
8965
9191
|
}
|
|
8966
|
-
},
|
|
9192
|
+
}, _callee32, this);
|
|
8967
9193
|
}));
|
|
8968
9194
|
|
|
8969
|
-
function restoreUsers(
|
|
9195
|
+
function restoreUsers(_x35) {
|
|
8970
9196
|
return _restoreUsers.apply(this, arguments);
|
|
8971
9197
|
}
|
|
8972
9198
|
|
|
@@ -8984,26 +9210,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8984
9210
|
}, {
|
|
8985
9211
|
key: "reactivateUser",
|
|
8986
9212
|
value: function () {
|
|
8987
|
-
var _reactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
8988
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9213
|
+
var _reactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee33(userID, options) {
|
|
9214
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee33$(_context33) {
|
|
8989
9215
|
while (1) {
|
|
8990
|
-
switch (
|
|
9216
|
+
switch (_context33.prev = _context33.next) {
|
|
8991
9217
|
case 0:
|
|
8992
|
-
|
|
9218
|
+
_context33.next = 2;
|
|
8993
9219
|
return this.post(this.baseURL + "/users/".concat(userID, "/reactivate"), _objectSpread({}, options));
|
|
8994
9220
|
|
|
8995
9221
|
case 2:
|
|
8996
|
-
return
|
|
9222
|
+
return _context33.abrupt("return", _context33.sent);
|
|
8997
9223
|
|
|
8998
9224
|
case 3:
|
|
8999
9225
|
case "end":
|
|
9000
|
-
return
|
|
9226
|
+
return _context33.stop();
|
|
9001
9227
|
}
|
|
9002
9228
|
}
|
|
9003
|
-
},
|
|
9229
|
+
}, _callee33, this);
|
|
9004
9230
|
}));
|
|
9005
9231
|
|
|
9006
|
-
function reactivateUser(
|
|
9232
|
+
function reactivateUser(_x36, _x37) {
|
|
9007
9233
|
return _reactivateUser.apply(this, arguments);
|
|
9008
9234
|
}
|
|
9009
9235
|
|
|
@@ -9021,28 +9247,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9021
9247
|
}, {
|
|
9022
9248
|
key: "reactivateUsers",
|
|
9023
9249
|
value: function () {
|
|
9024
|
-
var _reactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9025
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9250
|
+
var _reactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee34(user_ids, options) {
|
|
9251
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee34$(_context34) {
|
|
9026
9252
|
while (1) {
|
|
9027
|
-
switch (
|
|
9253
|
+
switch (_context34.prev = _context34.next) {
|
|
9028
9254
|
case 0:
|
|
9029
|
-
|
|
9255
|
+
_context34.next = 2;
|
|
9030
9256
|
return this.post(this.baseURL + "/users/reactivate", _objectSpread({
|
|
9031
9257
|
user_ids: user_ids
|
|
9032
9258
|
}, options));
|
|
9033
9259
|
|
|
9034
9260
|
case 2:
|
|
9035
|
-
return
|
|
9261
|
+
return _context34.abrupt("return", _context34.sent);
|
|
9036
9262
|
|
|
9037
9263
|
case 3:
|
|
9038
9264
|
case "end":
|
|
9039
|
-
return
|
|
9265
|
+
return _context34.stop();
|
|
9040
9266
|
}
|
|
9041
9267
|
}
|
|
9042
|
-
},
|
|
9268
|
+
}, _callee34, this);
|
|
9043
9269
|
}));
|
|
9044
9270
|
|
|
9045
|
-
function reactivateUsers(
|
|
9271
|
+
function reactivateUsers(_x38, _x39) {
|
|
9046
9272
|
return _reactivateUsers.apply(this, arguments);
|
|
9047
9273
|
}
|
|
9048
9274
|
|
|
@@ -9060,26 +9286,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9060
9286
|
}, {
|
|
9061
9287
|
key: "deactivateUser",
|
|
9062
9288
|
value: function () {
|
|
9063
|
-
var _deactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9064
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9289
|
+
var _deactivateUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee35(userID, options) {
|
|
9290
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee35$(_context35) {
|
|
9065
9291
|
while (1) {
|
|
9066
|
-
switch (
|
|
9292
|
+
switch (_context35.prev = _context35.next) {
|
|
9067
9293
|
case 0:
|
|
9068
|
-
|
|
9294
|
+
_context35.next = 2;
|
|
9069
9295
|
return this.post(this.baseURL + "/users/".concat(userID, "/deactivate"), _objectSpread({}, options));
|
|
9070
9296
|
|
|
9071
9297
|
case 2:
|
|
9072
|
-
return
|
|
9298
|
+
return _context35.abrupt("return", _context35.sent);
|
|
9073
9299
|
|
|
9074
9300
|
case 3:
|
|
9075
9301
|
case "end":
|
|
9076
|
-
return
|
|
9302
|
+
return _context35.stop();
|
|
9077
9303
|
}
|
|
9078
9304
|
}
|
|
9079
|
-
},
|
|
9305
|
+
}, _callee35, this);
|
|
9080
9306
|
}));
|
|
9081
9307
|
|
|
9082
|
-
function deactivateUser(
|
|
9308
|
+
function deactivateUser(_x40, _x41) {
|
|
9083
9309
|
return _deactivateUser.apply(this, arguments);
|
|
9084
9310
|
}
|
|
9085
9311
|
|
|
@@ -9097,28 +9323,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9097
9323
|
}, {
|
|
9098
9324
|
key: "deactivateUsers",
|
|
9099
9325
|
value: function () {
|
|
9100
|
-
var _deactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9101
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9326
|
+
var _deactivateUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee36(user_ids, options) {
|
|
9327
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee36$(_context36) {
|
|
9102
9328
|
while (1) {
|
|
9103
|
-
switch (
|
|
9329
|
+
switch (_context36.prev = _context36.next) {
|
|
9104
9330
|
case 0:
|
|
9105
|
-
|
|
9331
|
+
_context36.next = 2;
|
|
9106
9332
|
return this.post(this.baseURL + "/users/deactivate", _objectSpread({
|
|
9107
9333
|
user_ids: user_ids
|
|
9108
9334
|
}, options));
|
|
9109
9335
|
|
|
9110
9336
|
case 2:
|
|
9111
|
-
return
|
|
9337
|
+
return _context36.abrupt("return", _context36.sent);
|
|
9112
9338
|
|
|
9113
9339
|
case 3:
|
|
9114
9340
|
case "end":
|
|
9115
|
-
return
|
|
9341
|
+
return _context36.stop();
|
|
9116
9342
|
}
|
|
9117
9343
|
}
|
|
9118
|
-
},
|
|
9344
|
+
}, _callee36, this);
|
|
9119
9345
|
}));
|
|
9120
9346
|
|
|
9121
|
-
function deactivateUsers(
|
|
9347
|
+
function deactivateUsers(_x42, _x43) {
|
|
9122
9348
|
return _deactivateUsers.apply(this, arguments);
|
|
9123
9349
|
}
|
|
9124
9350
|
|
|
@@ -9127,26 +9353,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9127
9353
|
}, {
|
|
9128
9354
|
key: "exportUser",
|
|
9129
9355
|
value: function () {
|
|
9130
|
-
var _exportUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9131
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9356
|
+
var _exportUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee37(userID, options) {
|
|
9357
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee37$(_context37) {
|
|
9132
9358
|
while (1) {
|
|
9133
|
-
switch (
|
|
9359
|
+
switch (_context37.prev = _context37.next) {
|
|
9134
9360
|
case 0:
|
|
9135
|
-
|
|
9361
|
+
_context37.next = 2;
|
|
9136
9362
|
return this.get(this.baseURL + "/users/".concat(userID, "/export"), _objectSpread({}, options));
|
|
9137
9363
|
|
|
9138
9364
|
case 2:
|
|
9139
|
-
return
|
|
9365
|
+
return _context37.abrupt("return", _context37.sent);
|
|
9140
9366
|
|
|
9141
9367
|
case 3:
|
|
9142
9368
|
case "end":
|
|
9143
|
-
return
|
|
9369
|
+
return _context37.stop();
|
|
9144
9370
|
}
|
|
9145
9371
|
}
|
|
9146
|
-
},
|
|
9372
|
+
}, _callee37, this);
|
|
9147
9373
|
}));
|
|
9148
9374
|
|
|
9149
|
-
function exportUser(
|
|
9375
|
+
function exportUser(_x44, _x45) {
|
|
9150
9376
|
return _exportUser.apply(this, arguments);
|
|
9151
9377
|
}
|
|
9152
9378
|
|
|
@@ -9162,28 +9388,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9162
9388
|
}, {
|
|
9163
9389
|
key: "banUser",
|
|
9164
9390
|
value: function () {
|
|
9165
|
-
var _banUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9166
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9391
|
+
var _banUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee38(targetUserID, options) {
|
|
9392
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee38$(_context38) {
|
|
9167
9393
|
while (1) {
|
|
9168
|
-
switch (
|
|
9394
|
+
switch (_context38.prev = _context38.next) {
|
|
9169
9395
|
case 0:
|
|
9170
|
-
|
|
9396
|
+
_context38.next = 2;
|
|
9171
9397
|
return this.post(this.baseURL + '/moderation/ban', _objectSpread({
|
|
9172
9398
|
target_user_id: targetUserID
|
|
9173
9399
|
}, options));
|
|
9174
9400
|
|
|
9175
9401
|
case 2:
|
|
9176
|
-
return
|
|
9402
|
+
return _context38.abrupt("return", _context38.sent);
|
|
9177
9403
|
|
|
9178
9404
|
case 3:
|
|
9179
9405
|
case "end":
|
|
9180
|
-
return
|
|
9406
|
+
return _context38.stop();
|
|
9181
9407
|
}
|
|
9182
9408
|
}
|
|
9183
|
-
},
|
|
9409
|
+
}, _callee38, this);
|
|
9184
9410
|
}));
|
|
9185
9411
|
|
|
9186
|
-
function banUser(
|
|
9412
|
+
function banUser(_x46, _x47) {
|
|
9187
9413
|
return _banUser.apply(this, arguments);
|
|
9188
9414
|
}
|
|
9189
9415
|
|
|
@@ -9199,28 +9425,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9199
9425
|
}, {
|
|
9200
9426
|
key: "unbanUser",
|
|
9201
9427
|
value: function () {
|
|
9202
|
-
var _unbanUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9203
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9428
|
+
var _unbanUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee39(targetUserID, options) {
|
|
9429
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee39$(_context39) {
|
|
9204
9430
|
while (1) {
|
|
9205
|
-
switch (
|
|
9431
|
+
switch (_context39.prev = _context39.next) {
|
|
9206
9432
|
case 0:
|
|
9207
|
-
|
|
9433
|
+
_context39.next = 2;
|
|
9208
9434
|
return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
|
|
9209
9435
|
target_user_id: targetUserID
|
|
9210
9436
|
}, options));
|
|
9211
9437
|
|
|
9212
9438
|
case 2:
|
|
9213
|
-
return
|
|
9439
|
+
return _context39.abrupt("return", _context39.sent);
|
|
9214
9440
|
|
|
9215
9441
|
case 3:
|
|
9216
9442
|
case "end":
|
|
9217
|
-
return
|
|
9443
|
+
return _context39.stop();
|
|
9218
9444
|
}
|
|
9219
9445
|
}
|
|
9220
|
-
},
|
|
9446
|
+
}, _callee39, this);
|
|
9221
9447
|
}));
|
|
9222
9448
|
|
|
9223
|
-
function unbanUser(
|
|
9449
|
+
function unbanUser(_x48, _x49) {
|
|
9224
9450
|
return _unbanUser.apply(this, arguments);
|
|
9225
9451
|
}
|
|
9226
9452
|
|
|
@@ -9236,28 +9462,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9236
9462
|
}, {
|
|
9237
9463
|
key: "shadowBan",
|
|
9238
9464
|
value: function () {
|
|
9239
|
-
var _shadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9240
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9465
|
+
var _shadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee40(targetUserID, options) {
|
|
9466
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee40$(_context40) {
|
|
9241
9467
|
while (1) {
|
|
9242
|
-
switch (
|
|
9468
|
+
switch (_context40.prev = _context40.next) {
|
|
9243
9469
|
case 0:
|
|
9244
|
-
|
|
9470
|
+
_context40.next = 2;
|
|
9245
9471
|
return this.banUser(targetUserID, _objectSpread({
|
|
9246
9472
|
shadow: true
|
|
9247
9473
|
}, options));
|
|
9248
9474
|
|
|
9249
9475
|
case 2:
|
|
9250
|
-
return
|
|
9476
|
+
return _context40.abrupt("return", _context40.sent);
|
|
9251
9477
|
|
|
9252
9478
|
case 3:
|
|
9253
9479
|
case "end":
|
|
9254
|
-
return
|
|
9480
|
+
return _context40.stop();
|
|
9255
9481
|
}
|
|
9256
9482
|
}
|
|
9257
|
-
},
|
|
9483
|
+
}, _callee40, this);
|
|
9258
9484
|
}));
|
|
9259
9485
|
|
|
9260
|
-
function shadowBan(
|
|
9486
|
+
function shadowBan(_x50, _x51) {
|
|
9261
9487
|
return _shadowBan.apply(this, arguments);
|
|
9262
9488
|
}
|
|
9263
9489
|
|
|
@@ -9273,28 +9499,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9273
9499
|
}, {
|
|
9274
9500
|
key: "removeShadowBan",
|
|
9275
9501
|
value: function () {
|
|
9276
|
-
var _removeShadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9277
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9502
|
+
var _removeShadowBan = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee41(targetUserID, options) {
|
|
9503
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee41$(_context41) {
|
|
9278
9504
|
while (1) {
|
|
9279
|
-
switch (
|
|
9505
|
+
switch (_context41.prev = _context41.next) {
|
|
9280
9506
|
case 0:
|
|
9281
|
-
|
|
9507
|
+
_context41.next = 2;
|
|
9282
9508
|
return this.unbanUser(targetUserID, _objectSpread({
|
|
9283
9509
|
shadow: true
|
|
9284
9510
|
}, options));
|
|
9285
9511
|
|
|
9286
9512
|
case 2:
|
|
9287
|
-
return
|
|
9513
|
+
return _context41.abrupt("return", _context41.sent);
|
|
9288
9514
|
|
|
9289
9515
|
case 3:
|
|
9290
9516
|
case "end":
|
|
9291
|
-
return
|
|
9517
|
+
return _context41.stop();
|
|
9292
9518
|
}
|
|
9293
9519
|
}
|
|
9294
|
-
},
|
|
9520
|
+
}, _callee41, this);
|
|
9295
9521
|
}));
|
|
9296
9522
|
|
|
9297
|
-
function removeShadowBan(
|
|
9523
|
+
function removeShadowBan(_x52, _x53) {
|
|
9298
9524
|
return _removeShadowBan.apply(this, arguments);
|
|
9299
9525
|
}
|
|
9300
9526
|
|
|
@@ -9311,15 +9537,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9311
9537
|
}, {
|
|
9312
9538
|
key: "muteUser",
|
|
9313
9539
|
value: function () {
|
|
9314
|
-
var _muteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9540
|
+
var _muteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee42(targetID, userID) {
|
|
9315
9541
|
var options,
|
|
9316
|
-
|
|
9317
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9542
|
+
_args42 = arguments;
|
|
9543
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee42$(_context42) {
|
|
9318
9544
|
while (1) {
|
|
9319
|
-
switch (
|
|
9545
|
+
switch (_context42.prev = _context42.next) {
|
|
9320
9546
|
case 0:
|
|
9321
|
-
options =
|
|
9322
|
-
|
|
9547
|
+
options = _args42.length > 2 && _args42[2] !== undefined ? _args42[2] : {};
|
|
9548
|
+
_context42.next = 3;
|
|
9323
9549
|
return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
|
|
9324
9550
|
target_id: targetID
|
|
9325
9551
|
}, userID ? {
|
|
@@ -9327,17 +9553,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9327
9553
|
} : {}), options));
|
|
9328
9554
|
|
|
9329
9555
|
case 3:
|
|
9330
|
-
return
|
|
9556
|
+
return _context42.abrupt("return", _context42.sent);
|
|
9331
9557
|
|
|
9332
9558
|
case 4:
|
|
9333
9559
|
case "end":
|
|
9334
|
-
return
|
|
9560
|
+
return _context42.stop();
|
|
9335
9561
|
}
|
|
9336
9562
|
}
|
|
9337
|
-
},
|
|
9563
|
+
}, _callee42, this);
|
|
9338
9564
|
}));
|
|
9339
9565
|
|
|
9340
|
-
function muteUser(
|
|
9566
|
+
function muteUser(_x54, _x55) {
|
|
9341
9567
|
return _muteUser.apply(this, arguments);
|
|
9342
9568
|
}
|
|
9343
9569
|
|
|
@@ -9353,12 +9579,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9353
9579
|
}, {
|
|
9354
9580
|
key: "unmuteUser",
|
|
9355
9581
|
value: function () {
|
|
9356
|
-
var _unmuteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9357
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9582
|
+
var _unmuteUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee43(targetID, currentUserID) {
|
|
9583
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee43$(_context43) {
|
|
9358
9584
|
while (1) {
|
|
9359
|
-
switch (
|
|
9585
|
+
switch (_context43.prev = _context43.next) {
|
|
9360
9586
|
case 0:
|
|
9361
|
-
|
|
9587
|
+
_context43.next = 2;
|
|
9362
9588
|
return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
|
|
9363
9589
|
target_id: targetID
|
|
9364
9590
|
}, currentUserID ? {
|
|
@@ -9366,17 +9592,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9366
9592
|
} : {}));
|
|
9367
9593
|
|
|
9368
9594
|
case 2:
|
|
9369
|
-
return
|
|
9595
|
+
return _context43.abrupt("return", _context43.sent);
|
|
9370
9596
|
|
|
9371
9597
|
case 3:
|
|
9372
9598
|
case "end":
|
|
9373
|
-
return
|
|
9599
|
+
return _context43.stop();
|
|
9374
9600
|
}
|
|
9375
9601
|
}
|
|
9376
|
-
},
|
|
9602
|
+
}, _callee43, this);
|
|
9377
9603
|
}));
|
|
9378
9604
|
|
|
9379
|
-
function unmuteUser(
|
|
9605
|
+
function unmuteUser(_x56, _x57) {
|
|
9380
9606
|
return _unmuteUser.apply(this, arguments);
|
|
9381
9607
|
}
|
|
9382
9608
|
|
|
@@ -9411,31 +9637,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9411
9637
|
}, {
|
|
9412
9638
|
key: "flagMessage",
|
|
9413
9639
|
value: function () {
|
|
9414
|
-
var _flagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9640
|
+
var _flagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee44(targetMessageID) {
|
|
9415
9641
|
var options,
|
|
9416
|
-
|
|
9417
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9642
|
+
_args44 = arguments;
|
|
9643
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee44$(_context44) {
|
|
9418
9644
|
while (1) {
|
|
9419
|
-
switch (
|
|
9645
|
+
switch (_context44.prev = _context44.next) {
|
|
9420
9646
|
case 0:
|
|
9421
|
-
options =
|
|
9422
|
-
|
|
9647
|
+
options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
|
|
9648
|
+
_context44.next = 3;
|
|
9423
9649
|
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
9424
9650
|
target_message_id: targetMessageID
|
|
9425
9651
|
}, options));
|
|
9426
9652
|
|
|
9427
9653
|
case 3:
|
|
9428
|
-
return
|
|
9654
|
+
return _context44.abrupt("return", _context44.sent);
|
|
9429
9655
|
|
|
9430
9656
|
case 4:
|
|
9431
9657
|
case "end":
|
|
9432
|
-
return
|
|
9658
|
+
return _context44.stop();
|
|
9433
9659
|
}
|
|
9434
9660
|
}
|
|
9435
|
-
},
|
|
9661
|
+
}, _callee44, this);
|
|
9436
9662
|
}));
|
|
9437
9663
|
|
|
9438
|
-
function flagMessage(
|
|
9664
|
+
function flagMessage(_x58) {
|
|
9439
9665
|
return _flagMessage.apply(this, arguments);
|
|
9440
9666
|
}
|
|
9441
9667
|
|
|
@@ -9451,31 +9677,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9451
9677
|
}, {
|
|
9452
9678
|
key: "flagUser",
|
|
9453
9679
|
value: function () {
|
|
9454
|
-
var _flagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9680
|
+
var _flagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee45(targetID) {
|
|
9455
9681
|
var options,
|
|
9456
|
-
|
|
9457
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9682
|
+
_args45 = arguments;
|
|
9683
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee45$(_context45) {
|
|
9458
9684
|
while (1) {
|
|
9459
|
-
switch (
|
|
9685
|
+
switch (_context45.prev = _context45.next) {
|
|
9460
9686
|
case 0:
|
|
9461
|
-
options =
|
|
9462
|
-
|
|
9687
|
+
options = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {};
|
|
9688
|
+
_context45.next = 3;
|
|
9463
9689
|
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
9464
9690
|
target_user_id: targetID
|
|
9465
9691
|
}, options));
|
|
9466
9692
|
|
|
9467
9693
|
case 3:
|
|
9468
|
-
return
|
|
9694
|
+
return _context45.abrupt("return", _context45.sent);
|
|
9469
9695
|
|
|
9470
9696
|
case 4:
|
|
9471
9697
|
case "end":
|
|
9472
|
-
return
|
|
9698
|
+
return _context45.stop();
|
|
9473
9699
|
}
|
|
9474
9700
|
}
|
|
9475
|
-
},
|
|
9701
|
+
}, _callee45, this);
|
|
9476
9702
|
}));
|
|
9477
9703
|
|
|
9478
|
-
function flagUser(
|
|
9704
|
+
function flagUser(_x59) {
|
|
9479
9705
|
return _flagUser.apply(this, arguments);
|
|
9480
9706
|
}
|
|
9481
9707
|
|
|
@@ -9491,31 +9717,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9491
9717
|
}, {
|
|
9492
9718
|
key: "unflagMessage",
|
|
9493
9719
|
value: function () {
|
|
9494
|
-
var _unflagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9720
|
+
var _unflagMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee46(targetMessageID) {
|
|
9495
9721
|
var options,
|
|
9496
|
-
|
|
9497
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9722
|
+
_args46 = arguments;
|
|
9723
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee46$(_context46) {
|
|
9498
9724
|
while (1) {
|
|
9499
|
-
switch (
|
|
9725
|
+
switch (_context46.prev = _context46.next) {
|
|
9500
9726
|
case 0:
|
|
9501
|
-
options =
|
|
9502
|
-
|
|
9727
|
+
options = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
|
|
9728
|
+
_context46.next = 3;
|
|
9503
9729
|
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
9504
9730
|
target_message_id: targetMessageID
|
|
9505
9731
|
}, options));
|
|
9506
9732
|
|
|
9507
9733
|
case 3:
|
|
9508
|
-
return
|
|
9734
|
+
return _context46.abrupt("return", _context46.sent);
|
|
9509
9735
|
|
|
9510
9736
|
case 4:
|
|
9511
9737
|
case "end":
|
|
9512
|
-
return
|
|
9738
|
+
return _context46.stop();
|
|
9513
9739
|
}
|
|
9514
9740
|
}
|
|
9515
|
-
},
|
|
9741
|
+
}, _callee46, this);
|
|
9516
9742
|
}));
|
|
9517
9743
|
|
|
9518
|
-
function unflagMessage(
|
|
9744
|
+
function unflagMessage(_x60) {
|
|
9519
9745
|
return _unflagMessage.apply(this, arguments);
|
|
9520
9746
|
}
|
|
9521
9747
|
|
|
@@ -9531,31 +9757,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9531
9757
|
}, {
|
|
9532
9758
|
key: "unflagUser",
|
|
9533
9759
|
value: function () {
|
|
9534
|
-
var _unflagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9760
|
+
var _unflagUser = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee47(targetID) {
|
|
9535
9761
|
var options,
|
|
9536
|
-
|
|
9537
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9762
|
+
_args47 = arguments;
|
|
9763
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee47$(_context47) {
|
|
9538
9764
|
while (1) {
|
|
9539
|
-
switch (
|
|
9765
|
+
switch (_context47.prev = _context47.next) {
|
|
9540
9766
|
case 0:
|
|
9541
|
-
options =
|
|
9542
|
-
|
|
9767
|
+
options = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {};
|
|
9768
|
+
_context47.next = 3;
|
|
9543
9769
|
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
9544
9770
|
target_user_id: targetID
|
|
9545
9771
|
}, options));
|
|
9546
9772
|
|
|
9547
9773
|
case 3:
|
|
9548
|
-
return
|
|
9774
|
+
return _context47.abrupt("return", _context47.sent);
|
|
9549
9775
|
|
|
9550
9776
|
case 4:
|
|
9551
9777
|
case "end":
|
|
9552
|
-
return
|
|
9778
|
+
return _context47.stop();
|
|
9553
9779
|
}
|
|
9554
9780
|
}
|
|
9555
|
-
},
|
|
9781
|
+
}, _callee47, this);
|
|
9556
9782
|
}));
|
|
9557
9783
|
|
|
9558
|
-
function unflagUser(
|
|
9784
|
+
function unflagUser(_x61) {
|
|
9559
9785
|
return _unflagUser.apply(this, arguments);
|
|
9560
9786
|
}
|
|
9561
9787
|
|
|
@@ -9572,29 +9798,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9572
9798
|
}, {
|
|
9573
9799
|
key: "getCallToken",
|
|
9574
9800
|
value: function () {
|
|
9575
|
-
var _getCallToken = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9801
|
+
var _getCallToken = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee48(callID) {
|
|
9576
9802
|
var options,
|
|
9577
|
-
|
|
9578
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9803
|
+
_args48 = arguments;
|
|
9804
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee48$(_context48) {
|
|
9579
9805
|
while (1) {
|
|
9580
|
-
switch (
|
|
9806
|
+
switch (_context48.prev = _context48.next) {
|
|
9581
9807
|
case 0:
|
|
9582
|
-
options =
|
|
9583
|
-
|
|
9808
|
+
options = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {};
|
|
9809
|
+
_context48.next = 3;
|
|
9584
9810
|
return this.post(this.baseURL + "/calls/".concat(callID), _objectSpread({}, options));
|
|
9585
9811
|
|
|
9586
9812
|
case 3:
|
|
9587
|
-
return
|
|
9813
|
+
return _context48.abrupt("return", _context48.sent);
|
|
9588
9814
|
|
|
9589
9815
|
case 4:
|
|
9590
9816
|
case "end":
|
|
9591
|
-
return
|
|
9817
|
+
return _context48.stop();
|
|
9592
9818
|
}
|
|
9593
9819
|
}
|
|
9594
|
-
},
|
|
9820
|
+
}, _callee48, this);
|
|
9595
9821
|
}));
|
|
9596
9822
|
|
|
9597
|
-
function getCallToken(
|
|
9823
|
+
function getCallToken(_x62) {
|
|
9598
9824
|
return _getCallToken.apply(this, arguments);
|
|
9599
9825
|
}
|
|
9600
9826
|
|
|
@@ -9617,30 +9843,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9617
9843
|
}, {
|
|
9618
9844
|
key: "_queryFlags",
|
|
9619
9845
|
value: function () {
|
|
9620
|
-
var _queryFlags2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9846
|
+
var _queryFlags2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee49() {
|
|
9621
9847
|
var filterConditions,
|
|
9622
9848
|
options,
|
|
9623
|
-
|
|
9624
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9849
|
+
_args49 = arguments;
|
|
9850
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee49$(_context49) {
|
|
9625
9851
|
while (1) {
|
|
9626
|
-
switch (
|
|
9852
|
+
switch (_context49.prev = _context49.next) {
|
|
9627
9853
|
case 0:
|
|
9628
|
-
filterConditions =
|
|
9629
|
-
options =
|
|
9630
|
-
|
|
9854
|
+
filterConditions = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : {};
|
|
9855
|
+
options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
|
|
9856
|
+
_context49.next = 4;
|
|
9631
9857
|
return this.post(this.baseURL + '/moderation/flags', _objectSpread({
|
|
9632
9858
|
filter_conditions: filterConditions
|
|
9633
9859
|
}, options));
|
|
9634
9860
|
|
|
9635
9861
|
case 4:
|
|
9636
|
-
return
|
|
9862
|
+
return _context49.abrupt("return", _context49.sent);
|
|
9637
9863
|
|
|
9638
9864
|
case 5:
|
|
9639
9865
|
case "end":
|
|
9640
|
-
return
|
|
9866
|
+
return _context49.stop();
|
|
9641
9867
|
}
|
|
9642
9868
|
}
|
|
9643
|
-
},
|
|
9869
|
+
}, _callee49, this);
|
|
9644
9870
|
}));
|
|
9645
9871
|
|
|
9646
9872
|
function _queryFlags() {
|
|
@@ -9666,30 +9892,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9666
9892
|
}, {
|
|
9667
9893
|
key: "_queryFlagReports",
|
|
9668
9894
|
value: function () {
|
|
9669
|
-
var _queryFlagReports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9895
|
+
var _queryFlagReports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee50() {
|
|
9670
9896
|
var filterConditions,
|
|
9671
9897
|
options,
|
|
9672
|
-
|
|
9673
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9898
|
+
_args50 = arguments;
|
|
9899
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee50$(_context50) {
|
|
9674
9900
|
while (1) {
|
|
9675
|
-
switch (
|
|
9901
|
+
switch (_context50.prev = _context50.next) {
|
|
9676
9902
|
case 0:
|
|
9677
|
-
filterConditions =
|
|
9678
|
-
options =
|
|
9679
|
-
|
|
9903
|
+
filterConditions = _args50.length > 0 && _args50[0] !== undefined ? _args50[0] : {};
|
|
9904
|
+
options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
|
|
9905
|
+
_context50.next = 4;
|
|
9680
9906
|
return this.post(this.baseURL + '/moderation/reports', _objectSpread({
|
|
9681
9907
|
filter_conditions: filterConditions
|
|
9682
9908
|
}, options));
|
|
9683
9909
|
|
|
9684
9910
|
case 4:
|
|
9685
|
-
return
|
|
9911
|
+
return _context50.abrupt("return", _context50.sent);
|
|
9686
9912
|
|
|
9687
9913
|
case 5:
|
|
9688
9914
|
case "end":
|
|
9689
|
-
return
|
|
9915
|
+
return _context50.stop();
|
|
9690
9916
|
}
|
|
9691
9917
|
}
|
|
9692
|
-
},
|
|
9918
|
+
}, _callee50, this);
|
|
9693
9919
|
}));
|
|
9694
9920
|
|
|
9695
9921
|
function _queryFlagReports() {
|
|
@@ -9716,31 +9942,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9716
9942
|
}, {
|
|
9717
9943
|
key: "_reviewFlagReport",
|
|
9718
9944
|
value: function () {
|
|
9719
|
-
var _reviewFlagReport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9945
|
+
var _reviewFlagReport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee51(id, reviewResult) {
|
|
9720
9946
|
var options,
|
|
9721
|
-
|
|
9722
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9947
|
+
_args51 = arguments;
|
|
9948
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee51$(_context51) {
|
|
9723
9949
|
while (1) {
|
|
9724
|
-
switch (
|
|
9950
|
+
switch (_context51.prev = _context51.next) {
|
|
9725
9951
|
case 0:
|
|
9726
|
-
options =
|
|
9727
|
-
|
|
9952
|
+
options = _args51.length > 2 && _args51[2] !== undefined ? _args51[2] : {};
|
|
9953
|
+
_context51.next = 3;
|
|
9728
9954
|
return this.patch(this.baseURL + "/moderation/reports/".concat(id), _objectSpread({
|
|
9729
9955
|
review_result: reviewResult
|
|
9730
9956
|
}, options));
|
|
9731
9957
|
|
|
9732
9958
|
case 3:
|
|
9733
|
-
return
|
|
9959
|
+
return _context51.abrupt("return", _context51.sent);
|
|
9734
9960
|
|
|
9735
9961
|
case 4:
|
|
9736
9962
|
case "end":
|
|
9737
|
-
return
|
|
9963
|
+
return _context51.stop();
|
|
9738
9964
|
}
|
|
9739
9965
|
}
|
|
9740
|
-
},
|
|
9966
|
+
}, _callee51, this);
|
|
9741
9967
|
}));
|
|
9742
9968
|
|
|
9743
|
-
function _reviewFlagReport(
|
|
9969
|
+
function _reviewFlagReport(_x63, _x64) {
|
|
9744
9970
|
return _reviewFlagReport2.apply(this, arguments);
|
|
9745
9971
|
}
|
|
9746
9972
|
|
|
@@ -9758,31 +9984,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9758
9984
|
}, {
|
|
9759
9985
|
key: "unblockMessage",
|
|
9760
9986
|
value: function () {
|
|
9761
|
-
var _unblockMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9987
|
+
var _unblockMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee52(targetMessageID) {
|
|
9762
9988
|
var options,
|
|
9763
|
-
|
|
9764
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
9989
|
+
_args52 = arguments;
|
|
9990
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee52$(_context52) {
|
|
9765
9991
|
while (1) {
|
|
9766
|
-
switch (
|
|
9992
|
+
switch (_context52.prev = _context52.next) {
|
|
9767
9993
|
case 0:
|
|
9768
|
-
options =
|
|
9769
|
-
|
|
9994
|
+
options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
9995
|
+
_context52.next = 3;
|
|
9770
9996
|
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
|
|
9771
9997
|
target_message_id: targetMessageID
|
|
9772
9998
|
}, options));
|
|
9773
9999
|
|
|
9774
10000
|
case 3:
|
|
9775
|
-
return
|
|
10001
|
+
return _context52.abrupt("return", _context52.sent);
|
|
9776
10002
|
|
|
9777
10003
|
case 4:
|
|
9778
10004
|
case "end":
|
|
9779
|
-
return
|
|
10005
|
+
return _context52.stop();
|
|
9780
10006
|
}
|
|
9781
10007
|
}
|
|
9782
|
-
},
|
|
10008
|
+
}, _callee52, this);
|
|
9783
10009
|
}));
|
|
9784
10010
|
|
|
9785
|
-
function unblockMessage(
|
|
10011
|
+
function unblockMessage(_x65) {
|
|
9786
10012
|
return _unblockMessage.apply(this, arguments);
|
|
9787
10013
|
}
|
|
9788
10014
|
|
|
@@ -9801,23 +10027,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9801
10027
|
* @return {Promise<APIResponse>}
|
|
9802
10028
|
*/
|
|
9803
10029
|
function () {
|
|
9804
|
-
var _markChannelsRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
10030
|
+
var _markChannelsRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee53() {
|
|
9805
10031
|
var data,
|
|
9806
|
-
|
|
9807
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10032
|
+
_args53 = arguments;
|
|
10033
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee53$(_context53) {
|
|
9808
10034
|
while (1) {
|
|
9809
|
-
switch (
|
|
10035
|
+
switch (_context53.prev = _context53.next) {
|
|
9810
10036
|
case 0:
|
|
9811
|
-
data =
|
|
9812
|
-
|
|
10037
|
+
data = _args53.length > 0 && _args53[0] !== undefined ? _args53[0] : {};
|
|
10038
|
+
_context53.next = 3;
|
|
9813
10039
|
return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
|
|
9814
10040
|
|
|
9815
10041
|
case 3:
|
|
9816
10042
|
case "end":
|
|
9817
|
-
return
|
|
10043
|
+
return _context53.stop();
|
|
9818
10044
|
}
|
|
9819
10045
|
}
|
|
9820
|
-
},
|
|
10046
|
+
}, _callee53, this);
|
|
9821
10047
|
}));
|
|
9822
10048
|
|
|
9823
10049
|
function markChannelsRead() {
|
|
@@ -9892,28 +10118,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9892
10118
|
}, {
|
|
9893
10119
|
key: "translateMessage",
|
|
9894
10120
|
value: function () {
|
|
9895
|
-
var _translateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
9896
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10121
|
+
var _translateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee54(messageId, language) {
|
|
10122
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee54$(_context54) {
|
|
9897
10123
|
while (1) {
|
|
9898
|
-
switch (
|
|
10124
|
+
switch (_context54.prev = _context54.next) {
|
|
9899
10125
|
case 0:
|
|
9900
|
-
|
|
10126
|
+
_context54.next = 2;
|
|
9901
10127
|
return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
|
|
9902
10128
|
language: language
|
|
9903
10129
|
});
|
|
9904
10130
|
|
|
9905
10131
|
case 2:
|
|
9906
|
-
return
|
|
10132
|
+
return _context54.abrupt("return", _context54.sent);
|
|
9907
10133
|
|
|
9908
10134
|
case 3:
|
|
9909
10135
|
case "end":
|
|
9910
|
-
return
|
|
10136
|
+
return _context54.stop();
|
|
9911
10137
|
}
|
|
9912
10138
|
}
|
|
9913
|
-
},
|
|
10139
|
+
}, _callee54, this);
|
|
9914
10140
|
}));
|
|
9915
10141
|
|
|
9916
|
-
function translateMessage(
|
|
10142
|
+
function translateMessage(_x66, _x67) {
|
|
9917
10143
|
return _translateMessage.apply(this, arguments);
|
|
9918
10144
|
}
|
|
9919
10145
|
|
|
@@ -10015,14 +10241,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10015
10241
|
}, {
|
|
10016
10242
|
key: "updateMessage",
|
|
10017
10243
|
value: function () {
|
|
10018
|
-
var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
10244
|
+
var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee55(message, userId, options) {
|
|
10019
10245
|
var clonedMessage, reservedMessageFields;
|
|
10020
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10246
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee55$(_context55) {
|
|
10021
10247
|
while (1) {
|
|
10022
|
-
switch (
|
|
10248
|
+
switch (_context55.prev = _context55.next) {
|
|
10023
10249
|
case 0:
|
|
10024
10250
|
if (message.id) {
|
|
10025
|
-
|
|
10251
|
+
_context55.next = 2;
|
|
10026
10252
|
break;
|
|
10027
10253
|
}
|
|
10028
10254
|
|
|
@@ -10059,158 +10285,345 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10059
10285
|
});
|
|
10060
10286
|
}
|
|
10061
10287
|
|
|
10062
|
-
|
|
10288
|
+
_context55.next = 10;
|
|
10063
10289
|
return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
|
|
10064
10290
|
message: clonedMessage
|
|
10065
10291
|
}, options));
|
|
10066
10292
|
|
|
10067
10293
|
case 10:
|
|
10068
|
-
return
|
|
10294
|
+
return _context55.abrupt("return", _context55.sent);
|
|
10069
10295
|
|
|
10070
10296
|
case 11:
|
|
10071
10297
|
case "end":
|
|
10072
|
-
return
|
|
10298
|
+
return _context55.stop();
|
|
10073
10299
|
}
|
|
10074
10300
|
}
|
|
10075
|
-
},
|
|
10301
|
+
}, _callee55, this);
|
|
10302
|
+
}));
|
|
10303
|
+
|
|
10304
|
+
function updateMessage(_x68, _x69, _x70) {
|
|
10305
|
+
return _updateMessage.apply(this, arguments);
|
|
10306
|
+
}
|
|
10307
|
+
|
|
10308
|
+
return updateMessage;
|
|
10309
|
+
}()
|
|
10310
|
+
/**
|
|
10311
|
+
* partialUpdateMessage - Update the given message id while retaining additional properties
|
|
10312
|
+
*
|
|
10313
|
+
* @param {string} id the message id
|
|
10314
|
+
*
|
|
10315
|
+
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
10316
|
+
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
10317
|
+
* @param {string | { id: string }} [userId]
|
|
10318
|
+
*
|
|
10319
|
+
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
10320
|
+
*
|
|
10321
|
+
* @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
|
|
10322
|
+
*/
|
|
10323
|
+
|
|
10324
|
+
}, {
|
|
10325
|
+
key: "partialUpdateMessage",
|
|
10326
|
+
value: function () {
|
|
10327
|
+
var _partialUpdateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee56(id, partialMessageObject, userId, options) {
|
|
10328
|
+
var user;
|
|
10329
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee56$(_context56) {
|
|
10330
|
+
while (1) {
|
|
10331
|
+
switch (_context56.prev = _context56.next) {
|
|
10332
|
+
case 0:
|
|
10333
|
+
if (id) {
|
|
10334
|
+
_context56.next = 2;
|
|
10335
|
+
break;
|
|
10336
|
+
}
|
|
10337
|
+
|
|
10338
|
+
throw Error('Please specify the message id when calling partialUpdateMessage');
|
|
10339
|
+
|
|
10340
|
+
case 2:
|
|
10341
|
+
user = userId;
|
|
10342
|
+
|
|
10343
|
+
if (userId != null && isString(userId)) {
|
|
10344
|
+
user = {
|
|
10345
|
+
id: userId
|
|
10346
|
+
};
|
|
10347
|
+
}
|
|
10348
|
+
|
|
10349
|
+
_context56.next = 6;
|
|
10350
|
+
return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
|
|
10351
|
+
user: user
|
|
10352
|
+
}));
|
|
10353
|
+
|
|
10354
|
+
case 6:
|
|
10355
|
+
return _context56.abrupt("return", _context56.sent);
|
|
10356
|
+
|
|
10357
|
+
case 7:
|
|
10358
|
+
case "end":
|
|
10359
|
+
return _context56.stop();
|
|
10360
|
+
}
|
|
10361
|
+
}
|
|
10362
|
+
}, _callee56, this);
|
|
10363
|
+
}));
|
|
10364
|
+
|
|
10365
|
+
function partialUpdateMessage(_x71, _x72, _x73, _x74) {
|
|
10366
|
+
return _partialUpdateMessage.apply(this, arguments);
|
|
10367
|
+
}
|
|
10368
|
+
|
|
10369
|
+
return partialUpdateMessage;
|
|
10370
|
+
}()
|
|
10371
|
+
}, {
|
|
10372
|
+
key: "deleteMessage",
|
|
10373
|
+
value: function () {
|
|
10374
|
+
var _deleteMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee57(messageID, hardDelete) {
|
|
10375
|
+
var params;
|
|
10376
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee57$(_context57) {
|
|
10377
|
+
while (1) {
|
|
10378
|
+
switch (_context57.prev = _context57.next) {
|
|
10379
|
+
case 0:
|
|
10380
|
+
params = {};
|
|
10381
|
+
|
|
10382
|
+
if (hardDelete) {
|
|
10383
|
+
params = {
|
|
10384
|
+
hard: true
|
|
10385
|
+
};
|
|
10386
|
+
}
|
|
10387
|
+
|
|
10388
|
+
_context57.next = 4;
|
|
10389
|
+
return this.delete(this.baseURL + "/messages/".concat(messageID), params);
|
|
10390
|
+
|
|
10391
|
+
case 4:
|
|
10392
|
+
return _context57.abrupt("return", _context57.sent);
|
|
10393
|
+
|
|
10394
|
+
case 5:
|
|
10395
|
+
case "end":
|
|
10396
|
+
return _context57.stop();
|
|
10397
|
+
}
|
|
10398
|
+
}
|
|
10399
|
+
}, _callee57, this);
|
|
10400
|
+
}));
|
|
10401
|
+
|
|
10402
|
+
function deleteMessage(_x75, _x76) {
|
|
10403
|
+
return _deleteMessage.apply(this, arguments);
|
|
10404
|
+
}
|
|
10405
|
+
|
|
10406
|
+
return deleteMessage;
|
|
10407
|
+
}()
|
|
10408
|
+
}, {
|
|
10409
|
+
key: "getMessage",
|
|
10410
|
+
value: function () {
|
|
10411
|
+
var _getMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee58(messageID) {
|
|
10412
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee58$(_context58) {
|
|
10413
|
+
while (1) {
|
|
10414
|
+
switch (_context58.prev = _context58.next) {
|
|
10415
|
+
case 0:
|
|
10416
|
+
_context58.next = 2;
|
|
10417
|
+
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
|
|
10418
|
+
|
|
10419
|
+
case 2:
|
|
10420
|
+
return _context58.abrupt("return", _context58.sent);
|
|
10421
|
+
|
|
10422
|
+
case 3:
|
|
10423
|
+
case "end":
|
|
10424
|
+
return _context58.stop();
|
|
10425
|
+
}
|
|
10426
|
+
}
|
|
10427
|
+
}, _callee58, this);
|
|
10428
|
+
}));
|
|
10429
|
+
|
|
10430
|
+
function getMessage(_x77) {
|
|
10431
|
+
return _getMessage.apply(this, arguments);
|
|
10432
|
+
}
|
|
10433
|
+
|
|
10434
|
+
return getMessage;
|
|
10435
|
+
}()
|
|
10436
|
+
/**
|
|
10437
|
+
* queryThreads - returns the list of threads of current user.
|
|
10438
|
+
*
|
|
10439
|
+
* @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
|
|
10440
|
+
* @param {number} options.limit Limits the number of threads to be returned.
|
|
10441
|
+
* @param {boolean} options.watch Subscribes the user to the channels of the threads.
|
|
10442
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10443
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10444
|
+
*
|
|
10445
|
+
* @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
|
|
10446
|
+
*/
|
|
10447
|
+
|
|
10448
|
+
}, {
|
|
10449
|
+
key: "queryThreads",
|
|
10450
|
+
value: function () {
|
|
10451
|
+
var _queryThreads = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee59(options) {
|
|
10452
|
+
var _this5 = this;
|
|
10453
|
+
|
|
10454
|
+
var opts, res;
|
|
10455
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
|
|
10456
|
+
while (1) {
|
|
10457
|
+
switch (_context59.prev = _context59.next) {
|
|
10458
|
+
case 0:
|
|
10459
|
+
opts = _objectSpread({
|
|
10460
|
+
limit: 10,
|
|
10461
|
+
participant_limit: 10,
|
|
10462
|
+
reply_limit: 3,
|
|
10463
|
+
watch: true
|
|
10464
|
+
}, options);
|
|
10465
|
+
_context59.next = 3;
|
|
10466
|
+
return this.post(this.baseURL + "/threads", opts);
|
|
10467
|
+
|
|
10468
|
+
case 3:
|
|
10469
|
+
res = _context59.sent;
|
|
10470
|
+
return _context59.abrupt("return", {
|
|
10471
|
+
threads: res.threads.map(function (thread) {
|
|
10472
|
+
return new Thread(_this5, thread);
|
|
10473
|
+
}),
|
|
10474
|
+
next: res.next
|
|
10475
|
+
});
|
|
10476
|
+
|
|
10477
|
+
case 5:
|
|
10478
|
+
case "end":
|
|
10479
|
+
return _context59.stop();
|
|
10480
|
+
}
|
|
10481
|
+
}
|
|
10482
|
+
}, _callee59, this);
|
|
10076
10483
|
}));
|
|
10077
10484
|
|
|
10078
|
-
function
|
|
10079
|
-
return
|
|
10485
|
+
function queryThreads(_x78) {
|
|
10486
|
+
return _queryThreads.apply(this, arguments);
|
|
10080
10487
|
}
|
|
10081
10488
|
|
|
10082
|
-
return
|
|
10489
|
+
return queryThreads;
|
|
10083
10490
|
}()
|
|
10084
10491
|
/**
|
|
10085
|
-
*
|
|
10086
|
-
*
|
|
10087
|
-
* @param {string} id the message id
|
|
10088
|
-
*
|
|
10089
|
-
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
10090
|
-
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
10091
|
-
* @param {string | { id: string }} [userId]
|
|
10492
|
+
* getThread - returns the thread of a message by its id.
|
|
10092
10493
|
*
|
|
10093
|
-
* @param {
|
|
10494
|
+
* @param {string} messageId The message id
|
|
10495
|
+
* @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
|
|
10496
|
+
* @param {boolean} options.watch Subscribes the user to the channel of the thread.
|
|
10497
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10498
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10094
10499
|
*
|
|
10095
|
-
* @
|
|
10500
|
+
* @returns {Thread<StreamChatGenerics>} Returns the thread.
|
|
10096
10501
|
*/
|
|
10097
10502
|
|
|
10098
10503
|
}, {
|
|
10099
|
-
key: "
|
|
10504
|
+
key: "getThread",
|
|
10100
10505
|
value: function () {
|
|
10101
|
-
var
|
|
10102
|
-
var
|
|
10103
|
-
|
|
10506
|
+
var _getThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee60(messageId) {
|
|
10507
|
+
var options,
|
|
10508
|
+
opts,
|
|
10509
|
+
res,
|
|
10510
|
+
_args60 = arguments;
|
|
10511
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee60$(_context60) {
|
|
10104
10512
|
while (1) {
|
|
10105
|
-
switch (
|
|
10513
|
+
switch (_context60.prev = _context60.next) {
|
|
10106
10514
|
case 0:
|
|
10107
|
-
|
|
10108
|
-
|
|
10515
|
+
options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
|
|
10516
|
+
|
|
10517
|
+
if (messageId) {
|
|
10518
|
+
_context60.next = 3;
|
|
10109
10519
|
break;
|
|
10110
10520
|
}
|
|
10111
10521
|
|
|
10112
|
-
throw Error('Please specify the message id when calling
|
|
10113
|
-
|
|
10114
|
-
case 2:
|
|
10115
|
-
user = userId;
|
|
10116
|
-
|
|
10117
|
-
if (userId != null && isString(userId)) {
|
|
10118
|
-
user = {
|
|
10119
|
-
id: userId
|
|
10120
|
-
};
|
|
10121
|
-
}
|
|
10522
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10122
10523
|
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10524
|
+
case 3:
|
|
10525
|
+
opts = _objectSpread({
|
|
10526
|
+
participant_limit: 100,
|
|
10527
|
+
reply_limit: 3,
|
|
10528
|
+
watch: true
|
|
10529
|
+
}, options);
|
|
10530
|
+
_context60.next = 6;
|
|
10531
|
+
return this.get(this.baseURL + "/threads/".concat(messageId), opts);
|
|
10127
10532
|
|
|
10128
10533
|
case 6:
|
|
10129
|
-
|
|
10534
|
+
res = _context60.sent;
|
|
10535
|
+
return _context60.abrupt("return", new Thread(this, res.thread));
|
|
10130
10536
|
|
|
10131
|
-
case
|
|
10537
|
+
case 8:
|
|
10132
10538
|
case "end":
|
|
10133
|
-
return
|
|
10539
|
+
return _context60.stop();
|
|
10134
10540
|
}
|
|
10135
10541
|
}
|
|
10136
|
-
},
|
|
10542
|
+
}, _callee60, this);
|
|
10137
10543
|
}));
|
|
10138
10544
|
|
|
10139
|
-
function
|
|
10140
|
-
return
|
|
10545
|
+
function getThread(_x79) {
|
|
10546
|
+
return _getThread.apply(this, arguments);
|
|
10141
10547
|
}
|
|
10142
10548
|
|
|
10143
|
-
return
|
|
10549
|
+
return getThread;
|
|
10144
10550
|
}()
|
|
10551
|
+
/**
|
|
10552
|
+
* partialUpdateThread - updates the given thread
|
|
10553
|
+
*
|
|
10554
|
+
* @param {string} messageId The id of the thread message which needs to be updated.
|
|
10555
|
+
* @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
|
|
10556
|
+
*
|
|
10557
|
+
* @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
|
|
10558
|
+
*/
|
|
10559
|
+
|
|
10145
10560
|
}, {
|
|
10146
|
-
key: "
|
|
10561
|
+
key: "partialUpdateThread",
|
|
10147
10562
|
value: function () {
|
|
10148
|
-
var
|
|
10149
|
-
var
|
|
10150
|
-
|
|
10563
|
+
var _partialUpdateThread = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee61(messageId, partialThreadObject) {
|
|
10564
|
+
var reservedThreadFields, _key5;
|
|
10565
|
+
|
|
10566
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
|
|
10151
10567
|
while (1) {
|
|
10152
|
-
switch (
|
|
10568
|
+
switch (_context61.prev = _context61.next) {
|
|
10153
10569
|
case 0:
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
params = {
|
|
10158
|
-
hard: true
|
|
10159
|
-
};
|
|
10570
|
+
if (messageId) {
|
|
10571
|
+
_context61.next = 2;
|
|
10572
|
+
break;
|
|
10160
10573
|
}
|
|
10161
10574
|
|
|
10162
|
-
|
|
10163
|
-
|
|
10575
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10576
|
+
|
|
10577
|
+
case 2:
|
|
10578
|
+
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
10579
|
+
// Throw error if any of the reserved field is found.
|
|
10580
|
+
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
|
|
10581
|
+
_context61.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
10164
10582
|
|
|
10165
10583
|
case 4:
|
|
10166
|
-
|
|
10584
|
+
if ((_context61.t1 = _context61.t0()).done) {
|
|
10585
|
+
_context61.next = 10;
|
|
10586
|
+
break;
|
|
10587
|
+
}
|
|
10167
10588
|
|
|
10168
|
-
|
|
10169
|
-
case "end":
|
|
10170
|
-
return _context56.stop();
|
|
10171
|
-
}
|
|
10172
|
-
}
|
|
10173
|
-
}, _callee56, this);
|
|
10174
|
-
}));
|
|
10589
|
+
_key5 = _context61.t1.value;
|
|
10175
10590
|
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10591
|
+
if (!reservedThreadFields.includes(_key5)) {
|
|
10592
|
+
_context61.next = 8;
|
|
10593
|
+
break;
|
|
10594
|
+
}
|
|
10179
10595
|
|
|
10180
|
-
|
|
10181
|
-
}()
|
|
10182
|
-
}, {
|
|
10183
|
-
key: "getMessage",
|
|
10184
|
-
value: function () {
|
|
10185
|
-
var _getMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee57(messageID) {
|
|
10186
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee57$(_context57) {
|
|
10187
|
-
while (1) {
|
|
10188
|
-
switch (_context57.prev = _context57.next) {
|
|
10189
|
-
case 0:
|
|
10190
|
-
_context57.next = 2;
|
|
10191
|
-
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
|
|
10596
|
+
throw Error("You cannot set ".concat(_key5, " field on Thread object. ").concat(_key5, " is reserved for server-side use. Please omit ").concat(_key5, " from your set object."));
|
|
10192
10597
|
|
|
10193
|
-
case
|
|
10194
|
-
|
|
10598
|
+
case 8:
|
|
10599
|
+
_context61.next = 4;
|
|
10600
|
+
break;
|
|
10195
10601
|
|
|
10196
|
-
case
|
|
10602
|
+
case 10:
|
|
10603
|
+
_context61.next = 12;
|
|
10604
|
+
return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
|
|
10605
|
+
|
|
10606
|
+
case 12:
|
|
10607
|
+
return _context61.abrupt("return", _context61.sent);
|
|
10608
|
+
|
|
10609
|
+
case 13:
|
|
10197
10610
|
case "end":
|
|
10198
|
-
return
|
|
10611
|
+
return _context61.stop();
|
|
10199
10612
|
}
|
|
10200
10613
|
}
|
|
10201
|
-
},
|
|
10614
|
+
}, _callee61, this);
|
|
10202
10615
|
}));
|
|
10203
10616
|
|
|
10204
|
-
function
|
|
10205
|
-
return
|
|
10617
|
+
function partialUpdateThread(_x80, _x81) {
|
|
10618
|
+
return _partialUpdateThread.apply(this, arguments);
|
|
10206
10619
|
}
|
|
10207
10620
|
|
|
10208
|
-
return
|
|
10621
|
+
return partialUpdateThread;
|
|
10209
10622
|
}()
|
|
10210
10623
|
}, {
|
|
10211
10624
|
key: "getUserAgent",
|
|
10212
10625
|
value: function getUserAgent() {
|
|
10213
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
10626
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
|
|
10214
10627
|
}
|
|
10215
10628
|
}, {
|
|
10216
10629
|
key: "setUserAgent",
|
|
@@ -10429,28 +10842,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10429
10842
|
}, {
|
|
10430
10843
|
key: "sendUserCustomEvent",
|
|
10431
10844
|
value: function () {
|
|
10432
|
-
var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
10433
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
10845
|
+
var _sendUserCustomEvent = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(targetUserID, event) {
|
|
10846
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
|
|
10434
10847
|
while (1) {
|
|
10435
|
-
switch (
|
|
10848
|
+
switch (_context62.prev = _context62.next) {
|
|
10436
10849
|
case 0:
|
|
10437
|
-
|
|
10850
|
+
_context62.next = 2;
|
|
10438
10851
|
return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
|
|
10439
10852
|
event: event
|
|
10440
10853
|
});
|
|
10441
10854
|
|
|
10442
10855
|
case 2:
|
|
10443
|
-
return
|
|
10856
|
+
return _context62.abrupt("return", _context62.sent);
|
|
10444
10857
|
|
|
10445
10858
|
case 3:
|
|
10446
10859
|
case "end":
|
|
10447
|
-
return
|
|
10860
|
+
return _context62.stop();
|
|
10448
10861
|
}
|
|
10449
10862
|
}
|
|
10450
|
-
},
|
|
10863
|
+
}, _callee62, this);
|
|
10451
10864
|
}));
|
|
10452
10865
|
|
|
10453
|
-
function sendUserCustomEvent(
|
|
10866
|
+
function sendUserCustomEvent(_x82, _x83) {
|
|
10454
10867
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
10455
10868
|
}
|
|
10456
10869
|
|
|
@@ -10508,50 +10921,259 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10508
10921
|
return this.get("".concat(this.baseURL, "/export_channels/").concat(id));
|
|
10509
10922
|
}
|
|
10510
10923
|
/**
|
|
10511
|
-
* createSegment - Creates a
|
|
10924
|
+
* createSegment - Creates a segment
|
|
10925
|
+
*
|
|
10926
|
+
* @private
|
|
10927
|
+
* @param {SegmentType} type Segment type
|
|
10928
|
+
* @param {string} id Segment ID (valid UUID)
|
|
10929
|
+
* @param {string} name Segment name (valid UUID)
|
|
10930
|
+
* @param {SegmentData} params Segment data
|
|
10931
|
+
*
|
|
10932
|
+
* @return {Segment} The created Segment
|
|
10933
|
+
*/
|
|
10934
|
+
|
|
10935
|
+
}, {
|
|
10936
|
+
key: "createSegment",
|
|
10937
|
+
value: function () {
|
|
10938
|
+
var _createSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(type, id, name, data) {
|
|
10939
|
+
var body, _yield$this$post, segment;
|
|
10940
|
+
|
|
10941
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
|
|
10942
|
+
while (1) {
|
|
10943
|
+
switch (_context63.prev = _context63.next) {
|
|
10944
|
+
case 0:
|
|
10945
|
+
body = {
|
|
10946
|
+
id: id,
|
|
10947
|
+
type: type,
|
|
10948
|
+
name: name,
|
|
10949
|
+
data: data
|
|
10950
|
+
};
|
|
10951
|
+
_context63.next = 3;
|
|
10952
|
+
return this.post(this.baseURL + "/segments", body);
|
|
10953
|
+
|
|
10954
|
+
case 3:
|
|
10955
|
+
_yield$this$post = _context63.sent;
|
|
10956
|
+
segment = _yield$this$post.segment;
|
|
10957
|
+
return _context63.abrupt("return", segment);
|
|
10958
|
+
|
|
10959
|
+
case 6:
|
|
10960
|
+
case "end":
|
|
10961
|
+
return _context63.stop();
|
|
10962
|
+
}
|
|
10963
|
+
}
|
|
10964
|
+
}, _callee63, this);
|
|
10965
|
+
}));
|
|
10966
|
+
|
|
10967
|
+
function createSegment(_x84, _x85, _x86, _x87) {
|
|
10968
|
+
return _createSegment.apply(this, arguments);
|
|
10969
|
+
}
|
|
10970
|
+
|
|
10971
|
+
return createSegment;
|
|
10972
|
+
}()
|
|
10973
|
+
/**
|
|
10974
|
+
* createUserSegment - Creates a user segment
|
|
10975
|
+
*
|
|
10976
|
+
* @param {string} id Segment ID (valid UUID)
|
|
10977
|
+
* @param {string} name Segment name
|
|
10978
|
+
* @param {SegmentData} data Segment data
|
|
10979
|
+
*
|
|
10980
|
+
* @return {Segment} The created Segment
|
|
10981
|
+
*/
|
|
10982
|
+
|
|
10983
|
+
}, {
|
|
10984
|
+
key: "createUserSegment",
|
|
10985
|
+
value: function () {
|
|
10986
|
+
var _createUserSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(id, name, data) {
|
|
10987
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
|
|
10988
|
+
while (1) {
|
|
10989
|
+
switch (_context64.prev = _context64.next) {
|
|
10990
|
+
case 0:
|
|
10991
|
+
_context64.next = 2;
|
|
10992
|
+
return this.createSegment('user', id, name, data);
|
|
10993
|
+
|
|
10994
|
+
case 2:
|
|
10995
|
+
return _context64.abrupt("return", _context64.sent);
|
|
10996
|
+
|
|
10997
|
+
case 3:
|
|
10998
|
+
case "end":
|
|
10999
|
+
return _context64.stop();
|
|
11000
|
+
}
|
|
11001
|
+
}
|
|
11002
|
+
}, _callee64, this);
|
|
11003
|
+
}));
|
|
11004
|
+
|
|
11005
|
+
function createUserSegment(_x88, _x89, _x90) {
|
|
11006
|
+
return _createUserSegment.apply(this, arguments);
|
|
11007
|
+
}
|
|
11008
|
+
|
|
11009
|
+
return createUserSegment;
|
|
11010
|
+
}()
|
|
11011
|
+
/**
|
|
11012
|
+
* createChannelSegment - Creates a channel segment
|
|
11013
|
+
*
|
|
11014
|
+
* @param {string} id Segment ID (valid UUID)
|
|
11015
|
+
* @param {string} name Segment name
|
|
11016
|
+
* @param {SegmentData} data Segment data
|
|
11017
|
+
*
|
|
11018
|
+
* @return {Segment} The created Segment
|
|
11019
|
+
*/
|
|
11020
|
+
|
|
11021
|
+
}, {
|
|
11022
|
+
key: "createChannelSegment",
|
|
11023
|
+
value: function () {
|
|
11024
|
+
var _createChannelSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(id, name, data) {
|
|
11025
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
|
|
11026
|
+
while (1) {
|
|
11027
|
+
switch (_context65.prev = _context65.next) {
|
|
11028
|
+
case 0:
|
|
11029
|
+
_context65.next = 2;
|
|
11030
|
+
return this.createSegment('channel', id, name, data);
|
|
11031
|
+
|
|
11032
|
+
case 2:
|
|
11033
|
+
return _context65.abrupt("return", _context65.sent);
|
|
11034
|
+
|
|
11035
|
+
case 3:
|
|
11036
|
+
case "end":
|
|
11037
|
+
return _context65.stop();
|
|
11038
|
+
}
|
|
11039
|
+
}
|
|
11040
|
+
}, _callee65, this);
|
|
11041
|
+
}));
|
|
11042
|
+
|
|
11043
|
+
function createChannelSegment(_x91, _x92, _x93) {
|
|
11044
|
+
return _createChannelSegment.apply(this, arguments);
|
|
11045
|
+
}
|
|
11046
|
+
|
|
11047
|
+
return createChannelSegment;
|
|
11048
|
+
}()
|
|
11049
|
+
/**
|
|
11050
|
+
* updateSegment - Update a segment
|
|
11051
|
+
*
|
|
11052
|
+
* @param {string} id Segment ID
|
|
11053
|
+
* @param {Partial<UpdateSegmentData>} data Data to update
|
|
11054
|
+
*
|
|
11055
|
+
* @return {Segment} Updated Segment
|
|
11056
|
+
*/
|
|
11057
|
+
|
|
11058
|
+
}, {
|
|
11059
|
+
key: "updateSegment",
|
|
11060
|
+
value: function () {
|
|
11061
|
+
var _updateSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee66(id, data) {
|
|
11062
|
+
var _yield$this$put, segment;
|
|
11063
|
+
|
|
11064
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee66$(_context66) {
|
|
11065
|
+
while (1) {
|
|
11066
|
+
switch (_context66.prev = _context66.next) {
|
|
11067
|
+
case 0:
|
|
11068
|
+
_context66.next = 2;
|
|
11069
|
+
return this.put(this.baseURL + "/segments/".concat(id), data);
|
|
11070
|
+
|
|
11071
|
+
case 2:
|
|
11072
|
+
_yield$this$put = _context66.sent;
|
|
11073
|
+
segment = _yield$this$put.segment;
|
|
11074
|
+
return _context66.abrupt("return", segment);
|
|
11075
|
+
|
|
11076
|
+
case 5:
|
|
11077
|
+
case "end":
|
|
11078
|
+
return _context66.stop();
|
|
11079
|
+
}
|
|
11080
|
+
}
|
|
11081
|
+
}, _callee66, this);
|
|
11082
|
+
}));
|
|
11083
|
+
|
|
11084
|
+
function updateSegment(_x94, _x95) {
|
|
11085
|
+
return _updateSegment.apply(this, arguments);
|
|
11086
|
+
}
|
|
11087
|
+
|
|
11088
|
+
return updateSegment;
|
|
11089
|
+
}()
|
|
11090
|
+
/**
|
|
11091
|
+
* addSegmentTargets - Add targets to a segment
|
|
11092
|
+
*
|
|
11093
|
+
* @param {string} id Segment ID
|
|
11094
|
+
* @param {string[]} targets Targets to add to the segment
|
|
11095
|
+
*
|
|
11096
|
+
* @return {APIResponse} API response
|
|
11097
|
+
*/
|
|
11098
|
+
|
|
11099
|
+
}, {
|
|
11100
|
+
key: "addSegmentTargets",
|
|
11101
|
+
value: function () {
|
|
11102
|
+
var _addSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee67(id, targets) {
|
|
11103
|
+
var body;
|
|
11104
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee67$(_context67) {
|
|
11105
|
+
while (1) {
|
|
11106
|
+
switch (_context67.prev = _context67.next) {
|
|
11107
|
+
case 0:
|
|
11108
|
+
body = {
|
|
11109
|
+
targets: targets
|
|
11110
|
+
};
|
|
11111
|
+
_context67.next = 3;
|
|
11112
|
+
return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
|
|
11113
|
+
|
|
11114
|
+
case 3:
|
|
11115
|
+
return _context67.abrupt("return", _context67.sent);
|
|
11116
|
+
|
|
11117
|
+
case 4:
|
|
11118
|
+
case "end":
|
|
11119
|
+
return _context67.stop();
|
|
11120
|
+
}
|
|
11121
|
+
}
|
|
11122
|
+
}, _callee67, this);
|
|
11123
|
+
}));
|
|
11124
|
+
|
|
11125
|
+
function addSegmentTargets(_x96, _x97) {
|
|
11126
|
+
return _addSegmentTargets.apply(this, arguments);
|
|
11127
|
+
}
|
|
11128
|
+
|
|
11129
|
+
return addSegmentTargets;
|
|
11130
|
+
}()
|
|
11131
|
+
/**
|
|
11132
|
+
* deleteSegmentTargets - Delete targets from a segment
|
|
10512
11133
|
*
|
|
10513
|
-
* @param {
|
|
11134
|
+
* @param {string} id Segment ID
|
|
11135
|
+
* @param {string[]} targets Targets to add to the segment
|
|
10514
11136
|
*
|
|
10515
|
-
* @return {
|
|
11137
|
+
* @return {APIResponse} API response
|
|
10516
11138
|
*/
|
|
10517
11139
|
|
|
10518
11140
|
}, {
|
|
10519
|
-
key: "
|
|
11141
|
+
key: "deleteSegmentTargets",
|
|
10520
11142
|
value: function () {
|
|
10521
|
-
var
|
|
10522
|
-
var
|
|
10523
|
-
|
|
10524
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee59$(_context59) {
|
|
11143
|
+
var _deleteSegmentTargets = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee68(id, targets) {
|
|
11144
|
+
var body;
|
|
11145
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee68$(_context68) {
|
|
10525
11146
|
while (1) {
|
|
10526
|
-
switch (
|
|
11147
|
+
switch (_context68.prev = _context68.next) {
|
|
10527
11148
|
case 0:
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
11149
|
+
body = {
|
|
11150
|
+
targets: targets
|
|
11151
|
+
};
|
|
11152
|
+
_context68.next = 3;
|
|
11153
|
+
return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
|
|
10532
11154
|
|
|
10533
|
-
case
|
|
10534
|
-
|
|
10535
|
-
segment = _yield$this$post.segment;
|
|
10536
|
-
return _context59.abrupt("return", segment);
|
|
11155
|
+
case 3:
|
|
11156
|
+
return _context68.abrupt("return", _context68.sent);
|
|
10537
11157
|
|
|
10538
|
-
case
|
|
11158
|
+
case 4:
|
|
10539
11159
|
case "end":
|
|
10540
|
-
return
|
|
11160
|
+
return _context68.stop();
|
|
10541
11161
|
}
|
|
10542
11162
|
}
|
|
10543
|
-
},
|
|
11163
|
+
}, _callee68, this);
|
|
10544
11164
|
}));
|
|
10545
11165
|
|
|
10546
|
-
function
|
|
10547
|
-
return
|
|
11166
|
+
function deleteSegmentTargets(_x98, _x99) {
|
|
11167
|
+
return _deleteSegmentTargets.apply(this, arguments);
|
|
10548
11168
|
}
|
|
10549
11169
|
|
|
10550
|
-
return
|
|
11170
|
+
return deleteSegmentTargets;
|
|
10551
11171
|
}()
|
|
10552
11172
|
/**
|
|
10553
|
-
* querySegments - Query
|
|
11173
|
+
* querySegments - Query Segments
|
|
10554
11174
|
*
|
|
11175
|
+
* @param {filter} filter MongoDB style filter conditions
|
|
11176
|
+
* @param {QuerySegmentsOptions} options Options for sorting/paginating the results
|
|
10555
11177
|
*
|
|
10556
11178
|
* @return {Segment[]} Segments
|
|
10557
11179
|
*/
|
|
@@ -10559,112 +11181,110 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10559
11181
|
}, {
|
|
10560
11182
|
key: "querySegments",
|
|
10561
11183
|
value: function () {
|
|
10562
|
-
var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11184
|
+
var _querySegments = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee69(filter) {
|
|
10563
11185
|
var options,
|
|
10564
|
-
|
|
10565
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11186
|
+
_args69 = arguments;
|
|
11187
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee69$(_context69) {
|
|
10566
11188
|
while (1) {
|
|
10567
|
-
switch (
|
|
11189
|
+
switch (_context69.prev = _context69.next) {
|
|
10568
11190
|
case 0:
|
|
10569
|
-
options =
|
|
10570
|
-
|
|
11191
|
+
options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
|
|
11192
|
+
_context69.next = 3;
|
|
10571
11193
|
return this.get(this.baseURL + "/segments", {
|
|
10572
11194
|
payload: _objectSpread({
|
|
10573
|
-
|
|
11195
|
+
filter: filter
|
|
10574
11196
|
}, options)
|
|
10575
11197
|
});
|
|
10576
11198
|
|
|
10577
11199
|
case 3:
|
|
10578
|
-
return
|
|
11200
|
+
return _context69.abrupt("return", _context69.sent);
|
|
10579
11201
|
|
|
10580
11202
|
case 4:
|
|
10581
11203
|
case "end":
|
|
10582
|
-
return
|
|
11204
|
+
return _context69.stop();
|
|
10583
11205
|
}
|
|
10584
11206
|
}
|
|
10585
|
-
},
|
|
11207
|
+
}, _callee69, this);
|
|
10586
11208
|
}));
|
|
10587
11209
|
|
|
10588
|
-
function querySegments(
|
|
11210
|
+
function querySegments(_x100) {
|
|
10589
11211
|
return _querySegments.apply(this, arguments);
|
|
10590
11212
|
}
|
|
10591
11213
|
|
|
10592
11214
|
return querySegments;
|
|
10593
11215
|
}()
|
|
10594
11216
|
/**
|
|
10595
|
-
*
|
|
11217
|
+
* deleteSegment - Delete a Campaign Segment
|
|
10596
11218
|
*
|
|
10597
11219
|
* @param {string} id Segment ID
|
|
10598
|
-
* @param {Partial<SegmentData>} params Segment data
|
|
10599
11220
|
*
|
|
10600
|
-
* @return {
|
|
11221
|
+
* @return {Promise<APIResponse>} The Server Response
|
|
10601
11222
|
*/
|
|
10602
11223
|
|
|
10603
11224
|
}, {
|
|
10604
|
-
key: "
|
|
11225
|
+
key: "deleteSegment",
|
|
10605
11226
|
value: function () {
|
|
10606
|
-
var
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee61$(_context61) {
|
|
11227
|
+
var _deleteSegment = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee70(id) {
|
|
11228
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee70$(_context70) {
|
|
10610
11229
|
while (1) {
|
|
10611
|
-
switch (
|
|
11230
|
+
switch (_context70.prev = _context70.next) {
|
|
10612
11231
|
case 0:
|
|
10613
|
-
|
|
10614
|
-
return this.
|
|
10615
|
-
segment: params
|
|
10616
|
-
});
|
|
11232
|
+
_context70.next = 2;
|
|
11233
|
+
return this.delete(this.baseURL + "/segments/".concat(id));
|
|
10617
11234
|
|
|
10618
11235
|
case 2:
|
|
10619
|
-
|
|
10620
|
-
segment = _yield$this$put.segment;
|
|
10621
|
-
return _context61.abrupt("return", segment);
|
|
11236
|
+
return _context70.abrupt("return", _context70.sent);
|
|
10622
11237
|
|
|
10623
|
-
case
|
|
11238
|
+
case 3:
|
|
10624
11239
|
case "end":
|
|
10625
|
-
return
|
|
11240
|
+
return _context70.stop();
|
|
10626
11241
|
}
|
|
10627
11242
|
}
|
|
10628
|
-
},
|
|
11243
|
+
}, _callee70, this);
|
|
10629
11244
|
}));
|
|
10630
11245
|
|
|
10631
|
-
function
|
|
10632
|
-
return
|
|
11246
|
+
function deleteSegment(_x101) {
|
|
11247
|
+
return _deleteSegment.apply(this, arguments);
|
|
10633
11248
|
}
|
|
10634
11249
|
|
|
10635
|
-
return
|
|
11250
|
+
return deleteSegment;
|
|
10636
11251
|
}()
|
|
10637
11252
|
/**
|
|
10638
|
-
*
|
|
11253
|
+
* segmentTargetExists - Check if a target exists in a segment
|
|
10639
11254
|
*
|
|
10640
|
-
* @param {string}
|
|
11255
|
+
* @param {string} segmentId Segment ID
|
|
11256
|
+
* @param {string} targetId Target ID
|
|
10641
11257
|
*
|
|
10642
11258
|
* @return {Promise<APIResponse>} The Server Response
|
|
10643
11259
|
*/
|
|
10644
11260
|
|
|
10645
11261
|
}, {
|
|
10646
|
-
key: "
|
|
11262
|
+
key: "segmentTargetExists",
|
|
10647
11263
|
value: function () {
|
|
10648
|
-
var
|
|
10649
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11264
|
+
var _segmentTargetExists = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(segmentId, targetId) {
|
|
11265
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
|
|
10650
11266
|
while (1) {
|
|
10651
|
-
switch (
|
|
11267
|
+
switch (_context71.prev = _context71.next) {
|
|
10652
11268
|
case 0:
|
|
10653
|
-
|
|
11269
|
+
_context71.next = 2;
|
|
11270
|
+
return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
|
|
10654
11271
|
|
|
10655
|
-
case
|
|
11272
|
+
case 2:
|
|
11273
|
+
return _context71.abrupt("return", _context71.sent);
|
|
11274
|
+
|
|
11275
|
+
case 3:
|
|
10656
11276
|
case "end":
|
|
10657
|
-
return
|
|
11277
|
+
return _context71.stop();
|
|
10658
11278
|
}
|
|
10659
11279
|
}
|
|
10660
|
-
},
|
|
11280
|
+
}, _callee71, this);
|
|
10661
11281
|
}));
|
|
10662
11282
|
|
|
10663
|
-
function
|
|
10664
|
-
return
|
|
11283
|
+
function segmentTargetExists(_x102, _x103) {
|
|
11284
|
+
return _segmentTargetExists.apply(this, arguments);
|
|
10665
11285
|
}
|
|
10666
11286
|
|
|
10667
|
-
return
|
|
11287
|
+
return segmentTargetExists;
|
|
10668
11288
|
}()
|
|
10669
11289
|
/**
|
|
10670
11290
|
* createCampaign - Creates a Campaign
|
|
@@ -10677,32 +11297,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10677
11297
|
}, {
|
|
10678
11298
|
key: "createCampaign",
|
|
10679
11299
|
value: function () {
|
|
10680
|
-
var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11300
|
+
var _createCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(params) {
|
|
10681
11301
|
var _yield$this$post2, campaign;
|
|
10682
11302
|
|
|
10683
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11303
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
|
|
10684
11304
|
while (1) {
|
|
10685
|
-
switch (
|
|
11305
|
+
switch (_context72.prev = _context72.next) {
|
|
10686
11306
|
case 0:
|
|
10687
|
-
|
|
11307
|
+
_context72.next = 2;
|
|
10688
11308
|
return this.post(this.baseURL + "/campaigns", {
|
|
10689
11309
|
campaign: params
|
|
10690
11310
|
});
|
|
10691
11311
|
|
|
10692
11312
|
case 2:
|
|
10693
|
-
_yield$this$post2 =
|
|
11313
|
+
_yield$this$post2 = _context72.sent;
|
|
10694
11314
|
campaign = _yield$this$post2.campaign;
|
|
10695
|
-
return
|
|
11315
|
+
return _context72.abrupt("return", campaign);
|
|
10696
11316
|
|
|
10697
11317
|
case 5:
|
|
10698
11318
|
case "end":
|
|
10699
|
-
return
|
|
11319
|
+
return _context72.stop();
|
|
10700
11320
|
}
|
|
10701
11321
|
}
|
|
10702
|
-
},
|
|
11322
|
+
}, _callee72, this);
|
|
10703
11323
|
}));
|
|
10704
11324
|
|
|
10705
|
-
function createCampaign(
|
|
11325
|
+
function createCampaign(_x104) {
|
|
10706
11326
|
return _createCampaign.apply(this, arguments);
|
|
10707
11327
|
}
|
|
10708
11328
|
|
|
@@ -10718,15 +11338,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10718
11338
|
}, {
|
|
10719
11339
|
key: "queryCampaigns",
|
|
10720
11340
|
value: function () {
|
|
10721
|
-
var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11341
|
+
var _queryCampaigns = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee73(filters) {
|
|
10722
11342
|
var options,
|
|
10723
|
-
|
|
10724
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11343
|
+
_args73 = arguments;
|
|
11344
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee73$(_context73) {
|
|
10725
11345
|
while (1) {
|
|
10726
|
-
switch (
|
|
11346
|
+
switch (_context73.prev = _context73.next) {
|
|
10727
11347
|
case 0:
|
|
10728
|
-
options =
|
|
10729
|
-
|
|
11348
|
+
options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
|
|
11349
|
+
_context73.next = 3;
|
|
10730
11350
|
return this.get(this.baseURL + "/campaigns", {
|
|
10731
11351
|
payload: _objectSpread({
|
|
10732
11352
|
filter_conditions: filters
|
|
@@ -10734,17 +11354,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10734
11354
|
});
|
|
10735
11355
|
|
|
10736
11356
|
case 3:
|
|
10737
|
-
return
|
|
11357
|
+
return _context73.abrupt("return", _context73.sent);
|
|
10738
11358
|
|
|
10739
11359
|
case 4:
|
|
10740
11360
|
case "end":
|
|
10741
|
-
return
|
|
11361
|
+
return _context73.stop();
|
|
10742
11362
|
}
|
|
10743
11363
|
}
|
|
10744
|
-
},
|
|
11364
|
+
}, _callee73, this);
|
|
10745
11365
|
}));
|
|
10746
11366
|
|
|
10747
|
-
function queryCampaigns(
|
|
11367
|
+
function queryCampaigns(_x105) {
|
|
10748
11368
|
return _queryCampaigns.apply(this, arguments);
|
|
10749
11369
|
}
|
|
10750
11370
|
|
|
@@ -10762,32 +11382,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10762
11382
|
}, {
|
|
10763
11383
|
key: "updateCampaign",
|
|
10764
11384
|
value: function () {
|
|
10765
|
-
var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11385
|
+
var _updateCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee74(id, params) {
|
|
10766
11386
|
var _yield$this$put2, campaign;
|
|
10767
11387
|
|
|
10768
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11388
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee74$(_context74) {
|
|
10769
11389
|
while (1) {
|
|
10770
|
-
switch (
|
|
11390
|
+
switch (_context74.prev = _context74.next) {
|
|
10771
11391
|
case 0:
|
|
10772
|
-
|
|
11392
|
+
_context74.next = 2;
|
|
10773
11393
|
return this.put(this.baseURL + "/campaigns/".concat(id), {
|
|
10774
11394
|
campaign: params
|
|
10775
11395
|
});
|
|
10776
11396
|
|
|
10777
11397
|
case 2:
|
|
10778
|
-
_yield$this$put2 =
|
|
11398
|
+
_yield$this$put2 = _context74.sent;
|
|
10779
11399
|
campaign = _yield$this$put2.campaign;
|
|
10780
|
-
return
|
|
11400
|
+
return _context74.abrupt("return", campaign);
|
|
10781
11401
|
|
|
10782
11402
|
case 5:
|
|
10783
11403
|
case "end":
|
|
10784
|
-
return
|
|
11404
|
+
return _context74.stop();
|
|
10785
11405
|
}
|
|
10786
11406
|
}
|
|
10787
|
-
},
|
|
11407
|
+
}, _callee74, this);
|
|
10788
11408
|
}));
|
|
10789
11409
|
|
|
10790
|
-
function updateCampaign(
|
|
11410
|
+
function updateCampaign(_x106, _x107) {
|
|
10791
11411
|
return _updateCampaign.apply(this, arguments);
|
|
10792
11412
|
}
|
|
10793
11413
|
|
|
@@ -10804,25 +11424,25 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10804
11424
|
}, {
|
|
10805
11425
|
key: "deleteCampaign",
|
|
10806
11426
|
value: function () {
|
|
10807
|
-
var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11427
|
+
var _deleteCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(id) {
|
|
10808
11428
|
var params,
|
|
10809
|
-
|
|
10810
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11429
|
+
_args75 = arguments;
|
|
11430
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
|
|
10811
11431
|
while (1) {
|
|
10812
|
-
switch (
|
|
11432
|
+
switch (_context75.prev = _context75.next) {
|
|
10813
11433
|
case 0:
|
|
10814
|
-
params =
|
|
10815
|
-
return
|
|
11434
|
+
params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
|
|
11435
|
+
return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
|
|
10816
11436
|
|
|
10817
11437
|
case 2:
|
|
10818
11438
|
case "end":
|
|
10819
|
-
return
|
|
11439
|
+
return _context75.stop();
|
|
10820
11440
|
}
|
|
10821
11441
|
}
|
|
10822
|
-
},
|
|
11442
|
+
}, _callee75, this);
|
|
10823
11443
|
}));
|
|
10824
11444
|
|
|
10825
|
-
function deleteCampaign(
|
|
11445
|
+
function deleteCampaign(_x108) {
|
|
10826
11446
|
return _deleteCampaign.apply(this, arguments);
|
|
10827
11447
|
}
|
|
10828
11448
|
|
|
@@ -10840,33 +11460,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10840
11460
|
}, {
|
|
10841
11461
|
key: "scheduleCampaign",
|
|
10842
11462
|
value: function () {
|
|
10843
|
-
var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11463
|
+
var _scheduleCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(id, params) {
|
|
10844
11464
|
var scheduledFor, _yield$this$patch, campaign;
|
|
10845
11465
|
|
|
10846
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11466
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
|
|
10847
11467
|
while (1) {
|
|
10848
|
-
switch (
|
|
11468
|
+
switch (_context76.prev = _context76.next) {
|
|
10849
11469
|
case 0:
|
|
10850
11470
|
scheduledFor = params.scheduledFor;
|
|
10851
|
-
|
|
11471
|
+
_context76.next = 3;
|
|
10852
11472
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
|
|
10853
11473
|
scheduled_for: scheduledFor
|
|
10854
11474
|
});
|
|
10855
11475
|
|
|
10856
11476
|
case 3:
|
|
10857
|
-
_yield$this$patch =
|
|
11477
|
+
_yield$this$patch = _context76.sent;
|
|
10858
11478
|
campaign = _yield$this$patch.campaign;
|
|
10859
|
-
return
|
|
11479
|
+
return _context76.abrupt("return", campaign);
|
|
10860
11480
|
|
|
10861
11481
|
case 6:
|
|
10862
11482
|
case "end":
|
|
10863
|
-
return
|
|
11483
|
+
return _context76.stop();
|
|
10864
11484
|
}
|
|
10865
11485
|
}
|
|
10866
|
-
},
|
|
11486
|
+
}, _callee76, this);
|
|
10867
11487
|
}));
|
|
10868
11488
|
|
|
10869
|
-
function scheduleCampaign(
|
|
11489
|
+
function scheduleCampaign(_x109, _x110) {
|
|
10870
11490
|
return _scheduleCampaign.apply(this, arguments);
|
|
10871
11491
|
}
|
|
10872
11492
|
|
|
@@ -10883,30 +11503,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10883
11503
|
}, {
|
|
10884
11504
|
key: "stopCampaign",
|
|
10885
11505
|
value: function () {
|
|
10886
|
-
var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11506
|
+
var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77(id) {
|
|
10887
11507
|
var _yield$this$patch2, campaign;
|
|
10888
11508
|
|
|
10889
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11509
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
|
|
10890
11510
|
while (1) {
|
|
10891
|
-
switch (
|
|
11511
|
+
switch (_context77.prev = _context77.next) {
|
|
10892
11512
|
case 0:
|
|
10893
|
-
|
|
11513
|
+
_context77.next = 2;
|
|
10894
11514
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
|
|
10895
11515
|
|
|
10896
11516
|
case 2:
|
|
10897
|
-
_yield$this$patch2 =
|
|
11517
|
+
_yield$this$patch2 = _context77.sent;
|
|
10898
11518
|
campaign = _yield$this$patch2.campaign;
|
|
10899
|
-
return
|
|
11519
|
+
return _context77.abrupt("return", campaign);
|
|
10900
11520
|
|
|
10901
11521
|
case 5:
|
|
10902
11522
|
case "end":
|
|
10903
|
-
return
|
|
11523
|
+
return _context77.stop();
|
|
10904
11524
|
}
|
|
10905
11525
|
}
|
|
10906
|
-
},
|
|
11526
|
+
}, _callee77, this);
|
|
10907
11527
|
}));
|
|
10908
11528
|
|
|
10909
|
-
function stopCampaign(
|
|
11529
|
+
function stopCampaign(_x111) {
|
|
10910
11530
|
return _stopCampaign.apply(this, arguments);
|
|
10911
11531
|
}
|
|
10912
11532
|
|
|
@@ -10923,30 +11543,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10923
11543
|
}, {
|
|
10924
11544
|
key: "resumeCampaign",
|
|
10925
11545
|
value: function () {
|
|
10926
|
-
var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11546
|
+
var _resumeCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee78(id) {
|
|
10927
11547
|
var _yield$this$patch3, campaign;
|
|
10928
11548
|
|
|
10929
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11549
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee78$(_context78) {
|
|
10930
11550
|
while (1) {
|
|
10931
|
-
switch (
|
|
11551
|
+
switch (_context78.prev = _context78.next) {
|
|
10932
11552
|
case 0:
|
|
10933
|
-
|
|
11553
|
+
_context78.next = 2;
|
|
10934
11554
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
|
|
10935
11555
|
|
|
10936
11556
|
case 2:
|
|
10937
|
-
_yield$this$patch3 =
|
|
11557
|
+
_yield$this$patch3 = _context78.sent;
|
|
10938
11558
|
campaign = _yield$this$patch3.campaign;
|
|
10939
|
-
return
|
|
11559
|
+
return _context78.abrupt("return", campaign);
|
|
10940
11560
|
|
|
10941
11561
|
case 5:
|
|
10942
11562
|
case "end":
|
|
10943
|
-
return
|
|
11563
|
+
return _context78.stop();
|
|
10944
11564
|
}
|
|
10945
11565
|
}
|
|
10946
|
-
},
|
|
11566
|
+
}, _callee78, this);
|
|
10947
11567
|
}));
|
|
10948
11568
|
|
|
10949
|
-
function resumeCampaign(
|
|
11569
|
+
function resumeCampaign(_x112) {
|
|
10950
11570
|
return _resumeCampaign.apply(this, arguments);
|
|
10951
11571
|
}
|
|
10952
11572
|
|
|
@@ -10964,77 +11584,35 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10964
11584
|
}, {
|
|
10965
11585
|
key: "testCampaign",
|
|
10966
11586
|
value: function () {
|
|
10967
|
-
var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11587
|
+
var _testCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee79(id, params) {
|
|
10968
11588
|
var users;
|
|
10969
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11589
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee79$(_context79) {
|
|
10970
11590
|
while (1) {
|
|
10971
|
-
switch (
|
|
11591
|
+
switch (_context79.prev = _context79.next) {
|
|
10972
11592
|
case 0:
|
|
10973
11593
|
users = params.users;
|
|
10974
|
-
|
|
11594
|
+
_context79.next = 3;
|
|
10975
11595
|
return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
|
|
10976
11596
|
users: users
|
|
10977
11597
|
});
|
|
10978
11598
|
|
|
10979
11599
|
case 3:
|
|
10980
|
-
return
|
|
11600
|
+
return _context79.abrupt("return", _context79.sent);
|
|
10981
11601
|
|
|
10982
11602
|
case 4:
|
|
10983
11603
|
case "end":
|
|
10984
|
-
return
|
|
11604
|
+
return _context79.stop();
|
|
10985
11605
|
}
|
|
10986
11606
|
}
|
|
10987
|
-
},
|
|
11607
|
+
}, _callee79, this);
|
|
10988
11608
|
}));
|
|
10989
11609
|
|
|
10990
|
-
function testCampaign(
|
|
11610
|
+
function testCampaign(_x113, _x114) {
|
|
10991
11611
|
return _testCampaign.apply(this, arguments);
|
|
10992
11612
|
}
|
|
10993
11613
|
|
|
10994
11614
|
return testCampaign;
|
|
10995
11615
|
}()
|
|
10996
|
-
/**
|
|
10997
|
-
* queryRecipients - Query Campaign Recipient Results
|
|
10998
|
-
*
|
|
10999
|
-
*
|
|
11000
|
-
* @return {Recipient[]} Recipients
|
|
11001
|
-
*/
|
|
11002
|
-
|
|
11003
|
-
}, {
|
|
11004
|
-
key: "queryRecipients",
|
|
11005
|
-
value: function () {
|
|
11006
|
-
var _queryRecipients = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee71(filters) {
|
|
11007
|
-
var options,
|
|
11008
|
-
_args71 = arguments;
|
|
11009
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee71$(_context71) {
|
|
11010
|
-
while (1) {
|
|
11011
|
-
switch (_context71.prev = _context71.next) {
|
|
11012
|
-
case 0:
|
|
11013
|
-
options = _args71.length > 1 && _args71[1] !== undefined ? _args71[1] : {};
|
|
11014
|
-
_context71.next = 3;
|
|
11015
|
-
return this.get(this.baseURL + "/recipients", {
|
|
11016
|
-
payload: _objectSpread({
|
|
11017
|
-
filter_conditions: filters
|
|
11018
|
-
}, options)
|
|
11019
|
-
});
|
|
11020
|
-
|
|
11021
|
-
case 3:
|
|
11022
|
-
return _context71.abrupt("return", _context71.sent);
|
|
11023
|
-
|
|
11024
|
-
case 4:
|
|
11025
|
-
case "end":
|
|
11026
|
-
return _context71.stop();
|
|
11027
|
-
}
|
|
11028
|
-
}
|
|
11029
|
-
}, _callee71, this);
|
|
11030
|
-
}));
|
|
11031
|
-
|
|
11032
|
-
function queryRecipients(_x95) {
|
|
11033
|
-
return _queryRecipients.apply(this, arguments);
|
|
11034
|
-
}
|
|
11035
|
-
|
|
11036
|
-
return queryRecipients;
|
|
11037
|
-
}()
|
|
11038
11616
|
/**
|
|
11039
11617
|
* enrichURL - Get OpenGraph data of the given link
|
|
11040
11618
|
*
|
|
@@ -11045,24 +11623,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11045
11623
|
}, {
|
|
11046
11624
|
key: "enrichURL",
|
|
11047
11625
|
value: function () {
|
|
11048
|
-
var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11049
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11626
|
+
var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee80(url) {
|
|
11627
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee80$(_context80) {
|
|
11050
11628
|
while (1) {
|
|
11051
|
-
switch (
|
|
11629
|
+
switch (_context80.prev = _context80.next) {
|
|
11052
11630
|
case 0:
|
|
11053
|
-
return
|
|
11631
|
+
return _context80.abrupt("return", this.get(this.baseURL + "/og", {
|
|
11054
11632
|
url: url
|
|
11055
11633
|
}));
|
|
11056
11634
|
|
|
11057
11635
|
case 1:
|
|
11058
11636
|
case "end":
|
|
11059
|
-
return
|
|
11637
|
+
return _context80.stop();
|
|
11060
11638
|
}
|
|
11061
11639
|
}
|
|
11062
|
-
},
|
|
11640
|
+
}, _callee80, this);
|
|
11063
11641
|
}));
|
|
11064
11642
|
|
|
11065
|
-
function enrichURL(
|
|
11643
|
+
function enrichURL(_x115) {
|
|
11066
11644
|
return _enrichURL.apply(this, arguments);
|
|
11067
11645
|
}
|
|
11068
11646
|
|
|
@@ -11079,22 +11657,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11079
11657
|
}, {
|
|
11080
11658
|
key: "getTask",
|
|
11081
11659
|
value: function () {
|
|
11082
|
-
var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11083
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11660
|
+
var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
|
|
11661
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
|
|
11084
11662
|
while (1) {
|
|
11085
|
-
switch (
|
|
11663
|
+
switch (_context81.prev = _context81.next) {
|
|
11086
11664
|
case 0:
|
|
11087
|
-
return
|
|
11665
|
+
return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
|
|
11088
11666
|
|
|
11089
11667
|
case 1:
|
|
11090
11668
|
case "end":
|
|
11091
|
-
return
|
|
11669
|
+
return _context81.stop();
|
|
11092
11670
|
}
|
|
11093
11671
|
}
|
|
11094
|
-
},
|
|
11672
|
+
}, _callee81, this);
|
|
11095
11673
|
}));
|
|
11096
11674
|
|
|
11097
|
-
function getTask(
|
|
11675
|
+
function getTask(_x116) {
|
|
11098
11676
|
return _getTask.apply(this, arguments);
|
|
11099
11677
|
}
|
|
11100
11678
|
|
|
@@ -11112,31 +11690,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11112
11690
|
}, {
|
|
11113
11691
|
key: "deleteChannels",
|
|
11114
11692
|
value: function () {
|
|
11115
|
-
var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11693
|
+
var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee82(cids) {
|
|
11116
11694
|
var options,
|
|
11117
|
-
|
|
11118
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11695
|
+
_args82 = arguments;
|
|
11696
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee82$(_context82) {
|
|
11119
11697
|
while (1) {
|
|
11120
|
-
switch (
|
|
11698
|
+
switch (_context82.prev = _context82.next) {
|
|
11121
11699
|
case 0:
|
|
11122
|
-
options =
|
|
11123
|
-
|
|
11700
|
+
options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
|
|
11701
|
+
_context82.next = 3;
|
|
11124
11702
|
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
11125
11703
|
cids: cids
|
|
11126
11704
|
}, options));
|
|
11127
11705
|
|
|
11128
11706
|
case 3:
|
|
11129
|
-
return
|
|
11707
|
+
return _context82.abrupt("return", _context82.sent);
|
|
11130
11708
|
|
|
11131
11709
|
case 4:
|
|
11132
11710
|
case "end":
|
|
11133
|
-
return
|
|
11711
|
+
return _context82.stop();
|
|
11134
11712
|
}
|
|
11135
11713
|
}
|
|
11136
|
-
},
|
|
11714
|
+
}, _callee82, this);
|
|
11137
11715
|
}));
|
|
11138
11716
|
|
|
11139
|
-
function deleteChannels(
|
|
11717
|
+
function deleteChannels(_x117) {
|
|
11140
11718
|
return _deleteChannels.apply(this, arguments);
|
|
11141
11719
|
}
|
|
11142
11720
|
|
|
@@ -11154,17 +11732,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11154
11732
|
}, {
|
|
11155
11733
|
key: "deleteUsers",
|
|
11156
11734
|
value: function () {
|
|
11157
|
-
var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11735
|
+
var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee83(user_ids) {
|
|
11158
11736
|
var options,
|
|
11159
|
-
|
|
11160
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11737
|
+
_args83 = arguments;
|
|
11738
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee83$(_context83) {
|
|
11161
11739
|
while (1) {
|
|
11162
|
-
switch (
|
|
11740
|
+
switch (_context83.prev = _context83.next) {
|
|
11163
11741
|
case 0:
|
|
11164
|
-
options =
|
|
11742
|
+
options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
|
|
11165
11743
|
|
|
11166
11744
|
if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
|
|
11167
|
-
|
|
11745
|
+
_context83.next = 3;
|
|
11168
11746
|
break;
|
|
11169
11747
|
}
|
|
11170
11748
|
|
|
@@ -11172,7 +11750,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11172
11750
|
|
|
11173
11751
|
case 3:
|
|
11174
11752
|
if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
|
|
11175
|
-
|
|
11753
|
+
_context83.next = 5;
|
|
11176
11754
|
break;
|
|
11177
11755
|
}
|
|
11178
11756
|
|
|
@@ -11180,30 +11758,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11180
11758
|
|
|
11181
11759
|
case 5:
|
|
11182
11760
|
if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
|
|
11183
|
-
|
|
11761
|
+
_context83.next = 7;
|
|
11184
11762
|
break;
|
|
11185
11763
|
}
|
|
11186
11764
|
|
|
11187
11765
|
throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
|
|
11188
11766
|
|
|
11189
11767
|
case 7:
|
|
11190
|
-
|
|
11768
|
+
_context83.next = 9;
|
|
11191
11769
|
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
11192
11770
|
user_ids: user_ids
|
|
11193
11771
|
}, options));
|
|
11194
11772
|
|
|
11195
11773
|
case 9:
|
|
11196
|
-
return
|
|
11774
|
+
return _context83.abrupt("return", _context83.sent);
|
|
11197
11775
|
|
|
11198
11776
|
case 10:
|
|
11199
11777
|
case "end":
|
|
11200
|
-
return
|
|
11778
|
+
return _context83.stop();
|
|
11201
11779
|
}
|
|
11202
11780
|
}
|
|
11203
|
-
},
|
|
11781
|
+
}, _callee83, this);
|
|
11204
11782
|
}));
|
|
11205
11783
|
|
|
11206
|
-
function deleteUsers(
|
|
11784
|
+
function deleteUsers(_x118) {
|
|
11207
11785
|
return _deleteUsers.apply(this, arguments);
|
|
11208
11786
|
}
|
|
11209
11787
|
|
|
@@ -11224,28 +11802,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11224
11802
|
}, {
|
|
11225
11803
|
key: "_createImportURL",
|
|
11226
11804
|
value: function () {
|
|
11227
|
-
var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11228
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11805
|
+
var _createImportURL2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee84(filename) {
|
|
11806
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee84$(_context84) {
|
|
11229
11807
|
while (1) {
|
|
11230
|
-
switch (
|
|
11808
|
+
switch (_context84.prev = _context84.next) {
|
|
11231
11809
|
case 0:
|
|
11232
|
-
|
|
11810
|
+
_context84.next = 2;
|
|
11233
11811
|
return this.post(this.baseURL + "/import_urls", {
|
|
11234
11812
|
filename: filename
|
|
11235
11813
|
});
|
|
11236
11814
|
|
|
11237
11815
|
case 2:
|
|
11238
|
-
return
|
|
11816
|
+
return _context84.abrupt("return", _context84.sent);
|
|
11239
11817
|
|
|
11240
11818
|
case 3:
|
|
11241
11819
|
case "end":
|
|
11242
|
-
return
|
|
11820
|
+
return _context84.stop();
|
|
11243
11821
|
}
|
|
11244
11822
|
}
|
|
11245
|
-
},
|
|
11823
|
+
}, _callee84, this);
|
|
11246
11824
|
}));
|
|
11247
11825
|
|
|
11248
|
-
function _createImportURL(
|
|
11826
|
+
function _createImportURL(_x119) {
|
|
11249
11827
|
return _createImportURL2.apply(this, arguments);
|
|
11250
11828
|
}
|
|
11251
11829
|
|
|
@@ -11267,33 +11845,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11267
11845
|
}, {
|
|
11268
11846
|
key: "_createImport",
|
|
11269
11847
|
value: function () {
|
|
11270
|
-
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11848
|
+
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee85(path) {
|
|
11271
11849
|
var options,
|
|
11272
|
-
|
|
11273
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11850
|
+
_args85 = arguments;
|
|
11851
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee85$(_context85) {
|
|
11274
11852
|
while (1) {
|
|
11275
|
-
switch (
|
|
11853
|
+
switch (_context85.prev = _context85.next) {
|
|
11276
11854
|
case 0:
|
|
11277
|
-
options =
|
|
11855
|
+
options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
|
|
11278
11856
|
mode: 'upsert'
|
|
11279
11857
|
};
|
|
11280
|
-
|
|
11858
|
+
_context85.next = 3;
|
|
11281
11859
|
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
11282
11860
|
path: path
|
|
11283
11861
|
}, options));
|
|
11284
11862
|
|
|
11285
11863
|
case 3:
|
|
11286
|
-
return
|
|
11864
|
+
return _context85.abrupt("return", _context85.sent);
|
|
11287
11865
|
|
|
11288
11866
|
case 4:
|
|
11289
11867
|
case "end":
|
|
11290
|
-
return
|
|
11868
|
+
return _context85.stop();
|
|
11291
11869
|
}
|
|
11292
11870
|
}
|
|
11293
|
-
},
|
|
11871
|
+
}, _callee85, this);
|
|
11294
11872
|
}));
|
|
11295
11873
|
|
|
11296
|
-
function _createImport(
|
|
11874
|
+
function _createImport(_x120) {
|
|
11297
11875
|
return _createImport2.apply(this, arguments);
|
|
11298
11876
|
}
|
|
11299
11877
|
|
|
@@ -11315,26 +11893,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11315
11893
|
}, {
|
|
11316
11894
|
key: "_getImport",
|
|
11317
11895
|
value: function () {
|
|
11318
|
-
var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11319
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11896
|
+
var _getImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee86(id) {
|
|
11897
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee86$(_context86) {
|
|
11320
11898
|
while (1) {
|
|
11321
|
-
switch (
|
|
11899
|
+
switch (_context86.prev = _context86.next) {
|
|
11322
11900
|
case 0:
|
|
11323
|
-
|
|
11901
|
+
_context86.next = 2;
|
|
11324
11902
|
return this.get(this.baseURL + "/imports/".concat(id));
|
|
11325
11903
|
|
|
11326
11904
|
case 2:
|
|
11327
|
-
return
|
|
11905
|
+
return _context86.abrupt("return", _context86.sent);
|
|
11328
11906
|
|
|
11329
11907
|
case 3:
|
|
11330
11908
|
case "end":
|
|
11331
|
-
return
|
|
11909
|
+
return _context86.stop();
|
|
11332
11910
|
}
|
|
11333
11911
|
}
|
|
11334
|
-
},
|
|
11912
|
+
}, _callee86, this);
|
|
11335
11913
|
}));
|
|
11336
11914
|
|
|
11337
|
-
function _getImport(
|
|
11915
|
+
function _getImport(_x121) {
|
|
11338
11916
|
return _getImport2.apply(this, arguments);
|
|
11339
11917
|
}
|
|
11340
11918
|
|
|
@@ -11356,26 +11934,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11356
11934
|
}, {
|
|
11357
11935
|
key: "_listImports",
|
|
11358
11936
|
value: function () {
|
|
11359
|
-
var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11360
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11937
|
+
var _listImports2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee87(options) {
|
|
11938
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee87$(_context87) {
|
|
11361
11939
|
while (1) {
|
|
11362
|
-
switch (
|
|
11940
|
+
switch (_context87.prev = _context87.next) {
|
|
11363
11941
|
case 0:
|
|
11364
|
-
|
|
11942
|
+
_context87.next = 2;
|
|
11365
11943
|
return this.get(this.baseURL + "/imports", options);
|
|
11366
11944
|
|
|
11367
11945
|
case 2:
|
|
11368
|
-
return
|
|
11946
|
+
return _context87.abrupt("return", _context87.sent);
|
|
11369
11947
|
|
|
11370
11948
|
case 3:
|
|
11371
11949
|
case "end":
|
|
11372
|
-
return
|
|
11950
|
+
return _context87.stop();
|
|
11373
11951
|
}
|
|
11374
11952
|
}
|
|
11375
|
-
},
|
|
11953
|
+
}, _callee87, this);
|
|
11376
11954
|
}));
|
|
11377
11955
|
|
|
11378
|
-
function _listImports(
|
|
11956
|
+
function _listImports(_x122) {
|
|
11379
11957
|
return _listImports2.apply(this, arguments);
|
|
11380
11958
|
}
|
|
11381
11959
|
|
|
@@ -11394,28 +11972,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11394
11972
|
}, {
|
|
11395
11973
|
key: "upsertPushProvider",
|
|
11396
11974
|
value: function () {
|
|
11397
|
-
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11398
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
11975
|
+
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee88(pushProvider) {
|
|
11976
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee88$(_context88) {
|
|
11399
11977
|
while (1) {
|
|
11400
|
-
switch (
|
|
11978
|
+
switch (_context88.prev = _context88.next) {
|
|
11401
11979
|
case 0:
|
|
11402
|
-
|
|
11980
|
+
_context88.next = 2;
|
|
11403
11981
|
return this.post(this.baseURL + "/push_providers", {
|
|
11404
11982
|
push_provider: pushProvider
|
|
11405
11983
|
});
|
|
11406
11984
|
|
|
11407
11985
|
case 2:
|
|
11408
|
-
return
|
|
11986
|
+
return _context88.abrupt("return", _context88.sent);
|
|
11409
11987
|
|
|
11410
11988
|
case 3:
|
|
11411
11989
|
case "end":
|
|
11412
|
-
return
|
|
11990
|
+
return _context88.stop();
|
|
11413
11991
|
}
|
|
11414
11992
|
}
|
|
11415
|
-
},
|
|
11993
|
+
}, _callee88, this);
|
|
11416
11994
|
}));
|
|
11417
11995
|
|
|
11418
|
-
function upsertPushProvider(
|
|
11996
|
+
function upsertPushProvider(_x123) {
|
|
11419
11997
|
return _upsertPushProvider.apply(this, arguments);
|
|
11420
11998
|
}
|
|
11421
11999
|
|
|
@@ -11434,28 +12012,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11434
12012
|
}, {
|
|
11435
12013
|
key: "deletePushProvider",
|
|
11436
12014
|
value: function () {
|
|
11437
|
-
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
12015
|
+
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee89(_ref10) {
|
|
11438
12016
|
var type, name;
|
|
11439
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12017
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee89$(_context89) {
|
|
11440
12018
|
while (1) {
|
|
11441
|
-
switch (
|
|
12019
|
+
switch (_context89.prev = _context89.next) {
|
|
11442
12020
|
case 0:
|
|
11443
12021
|
type = _ref10.type, name = _ref10.name;
|
|
11444
|
-
|
|
12022
|
+
_context89.next = 3;
|
|
11445
12023
|
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
11446
12024
|
|
|
11447
12025
|
case 3:
|
|
11448
|
-
return
|
|
12026
|
+
return _context89.abrupt("return", _context89.sent);
|
|
11449
12027
|
|
|
11450
12028
|
case 4:
|
|
11451
12029
|
case "end":
|
|
11452
|
-
return
|
|
12030
|
+
return _context89.stop();
|
|
11453
12031
|
}
|
|
11454
12032
|
}
|
|
11455
|
-
},
|
|
12033
|
+
}, _callee89, this);
|
|
11456
12034
|
}));
|
|
11457
12035
|
|
|
11458
|
-
function deletePushProvider(
|
|
12036
|
+
function deletePushProvider(_x124) {
|
|
11459
12037
|
return _deletePushProvider.apply(this, arguments);
|
|
11460
12038
|
}
|
|
11461
12039
|
|
|
@@ -11472,23 +12050,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11472
12050
|
}, {
|
|
11473
12051
|
key: "listPushProviders",
|
|
11474
12052
|
value: function () {
|
|
11475
|
-
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11476
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12053
|
+
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee90() {
|
|
12054
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee90$(_context90) {
|
|
11477
12055
|
while (1) {
|
|
11478
|
-
switch (
|
|
12056
|
+
switch (_context90.prev = _context90.next) {
|
|
11479
12057
|
case 0:
|
|
11480
|
-
|
|
12058
|
+
_context90.next = 2;
|
|
11481
12059
|
return this.get(this.baseURL + "/push_providers");
|
|
11482
12060
|
|
|
11483
12061
|
case 2:
|
|
11484
|
-
return
|
|
12062
|
+
return _context90.abrupt("return", _context90.sent);
|
|
11485
12063
|
|
|
11486
12064
|
case 3:
|
|
11487
12065
|
case "end":
|
|
11488
|
-
return
|
|
12066
|
+
return _context90.stop();
|
|
11489
12067
|
}
|
|
11490
12068
|
}
|
|
11491
|
-
},
|
|
12069
|
+
}, _callee90, this);
|
|
11492
12070
|
}));
|
|
11493
12071
|
|
|
11494
12072
|
function listPushProviders() {
|
|
@@ -11516,26 +12094,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11516
12094
|
}, {
|
|
11517
12095
|
key: "commitMessage",
|
|
11518
12096
|
value: function () {
|
|
11519
|
-
var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function
|
|
11520
|
-
return _regeneratorRuntime__default['default'].wrap(function
|
|
12097
|
+
var _commitMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee91(id) {
|
|
12098
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee91$(_context91) {
|
|
11521
12099
|
while (1) {
|
|
11522
|
-
switch (
|
|
12100
|
+
switch (_context91.prev = _context91.next) {
|
|
11523
12101
|
case 0:
|
|
11524
|
-
|
|
12102
|
+
_context91.next = 2;
|
|
11525
12103
|
return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
|
|
11526
12104
|
|
|
11527
12105
|
case 2:
|
|
11528
|
-
return
|
|
12106
|
+
return _context91.abrupt("return", _context91.sent);
|
|
11529
12107
|
|
|
11530
12108
|
case 3:
|
|
11531
12109
|
case "end":
|
|
11532
|
-
return
|
|
12110
|
+
return _context91.stop();
|
|
11533
12111
|
}
|
|
11534
12112
|
}
|
|
11535
|
-
},
|
|
12113
|
+
}, _callee91, this);
|
|
11536
12114
|
}));
|
|
11537
12115
|
|
|
11538
|
-
function commitMessage(
|
|
12116
|
+
function commitMessage(_x125) {
|
|
11539
12117
|
return _commitMessage.apply(this, arguments);
|
|
11540
12118
|
}
|
|
11541
12119
|
|
|
@@ -11587,9 +12165,11 @@ var EVENT_MAP = {
|
|
|
11587
12165
|
'notification.invite_rejected': true,
|
|
11588
12166
|
'notification.invited': true,
|
|
11589
12167
|
'notification.mark_read': true,
|
|
12168
|
+
'notification.mark_unread': true,
|
|
11590
12169
|
'notification.message_new': true,
|
|
11591
12170
|
'notification.mutes_updated': true,
|
|
11592
12171
|
'notification.removed_from_channel': true,
|
|
12172
|
+
'notification.thread_message_new': true,
|
|
11593
12173
|
'reaction.deleted': true,
|
|
11594
12174
|
'reaction.new': true,
|
|
11595
12175
|
'reaction.updated': true,
|
|
@@ -11708,6 +12288,7 @@ exports.MinPriority = MinPriority;
|
|
|
11708
12288
|
exports.Permission = Permission;
|
|
11709
12289
|
exports.StableWSConnection = StableWSConnection;
|
|
11710
12290
|
exports.StreamChat = StreamChat;
|
|
12291
|
+
exports.Thread = Thread;
|
|
11711
12292
|
exports.TokenManager = TokenManager;
|
|
11712
12293
|
exports.UserFromToken = UserFromToken;
|
|
11713
12294
|
exports.buildWsFatalInsight = buildWsFatalInsight;
|
|
@@ -11715,6 +12296,7 @@ exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
|
|
|
11715
12296
|
exports.chatCodes = chatCodes;
|
|
11716
12297
|
exports.decodeBase64 = decodeBase64;
|
|
11717
12298
|
exports.encodeBase64 = encodeBase64;
|
|
12299
|
+
exports.formatMessage = formatMessage;
|
|
11718
12300
|
exports.isOwnUser = isOwnUser;
|
|
11719
12301
|
exports.logChatPromiseExecution = logChatPromiseExecution;
|
|
11720
12302
|
exports.postInsights = postInsights;
|