stream-chat 8.14.5 → 8.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.es.js +1703 -1123
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +1704 -1122
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +1703 -1123
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1704 -1122
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +6 -2
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_state.d.ts +1 -0
- package/dist/types/channel_state.d.ts.map +1 -1
- package/dist/types/client.d.ts +119 -25
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/events.d.ts +2 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/thread.d.ts +28 -0
- package/dist/types/thread.d.ts.map +1 -0
- package/dist/types/types.d.ts +99 -20
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +10 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +32 -18
- package/src/channel_state.ts +9 -59
- package/src/client.ts +218 -43
- package/src/events.ts +2 -0
- package/src/index.ts +2 -1
- package/src/thread.ts +116 -0
- package/src/types.ts +119 -21
- package/src/utils.ts +101 -1
package/dist/browser.es.js
CHANGED
|
@@ -93,9 +93,347 @@ var decodeBase64 = function decodeBase64(s) {
|
|
|
93
93
|
|
|
94
94
|
var https = null;
|
|
95
95
|
|
|
96
|
-
function ownKeys$
|
|
96
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
97
97
|
|
|
98
|
-
function _objectSpread$
|
|
98
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
99
|
+
|
|
100
|
+
function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
101
|
+
|
|
102
|
+
function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
|
|
103
|
+
|
|
104
|
+
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
108
|
+
* use this when you want to run the promise and handle errors by logging a warning
|
|
109
|
+
*
|
|
110
|
+
* @param {Promise<T>} promise The promise you want to run and log
|
|
111
|
+
* @param {string} name A descriptive name of what the promise does for log output
|
|
112
|
+
*
|
|
113
|
+
*/
|
|
114
|
+
function logChatPromiseExecution(promise, name) {
|
|
115
|
+
promise.then().catch(function (error) {
|
|
116
|
+
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
var sleep = function sleep(m) {
|
|
120
|
+
return new Promise(function (r) {
|
|
121
|
+
return setTimeout(r, m);
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
function isFunction(value) {
|
|
125
|
+
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
126
|
+
}
|
|
127
|
+
var chatCodes = {
|
|
128
|
+
TOKEN_EXPIRED: 40,
|
|
129
|
+
WS_CLOSED_SUCCESS: 1000
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
function isReadableStream(obj) {
|
|
133
|
+
return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function isBuffer(obj) {
|
|
137
|
+
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
138
|
+
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
139
|
+
obj.constructor.isBuffer(obj);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function isFileWebAPI(uri) {
|
|
143
|
+
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function isOwnUser(user) {
|
|
147
|
+
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function isBlobWebAPI(uri) {
|
|
151
|
+
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function isOwnUserBaseProperty(property) {
|
|
155
|
+
var ownUserBaseProperties = {
|
|
156
|
+
channel_mutes: true,
|
|
157
|
+
devices: true,
|
|
158
|
+
mutes: true,
|
|
159
|
+
total_unread_count: true,
|
|
160
|
+
unread_channels: true,
|
|
161
|
+
unread_count: true,
|
|
162
|
+
invisible: true,
|
|
163
|
+
roles: true
|
|
164
|
+
};
|
|
165
|
+
return ownUserBaseProperties[property];
|
|
166
|
+
}
|
|
167
|
+
function addFileToFormData(uri, name, contentType) {
|
|
168
|
+
var data = new FormData();
|
|
169
|
+
|
|
170
|
+
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
171
|
+
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
172
|
+
} else {
|
|
173
|
+
data.append('file', {
|
|
174
|
+
uri: uri,
|
|
175
|
+
name: name || uri.split('/').reverse()[0],
|
|
176
|
+
contentType: contentType || undefined,
|
|
177
|
+
type: contentType || undefined
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return data;
|
|
182
|
+
}
|
|
183
|
+
function normalizeQuerySort(sort) {
|
|
184
|
+
var sortFields = [];
|
|
185
|
+
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
186
|
+
|
|
187
|
+
var _iterator = _createForOfIteratorHelper$4(sortArr),
|
|
188
|
+
_step;
|
|
189
|
+
|
|
190
|
+
try {
|
|
191
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
192
|
+
var item = _step.value;
|
|
193
|
+
var entries = Object.entries(item);
|
|
194
|
+
|
|
195
|
+
if (entries.length > 1) {
|
|
196
|
+
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
200
|
+
var _entries$_i = _slicedToArray(_entries[_i], 2),
|
|
201
|
+
field = _entries$_i[0],
|
|
202
|
+
direction = _entries$_i[1];
|
|
203
|
+
|
|
204
|
+
sortFields.push({
|
|
205
|
+
field: field,
|
|
206
|
+
direction: direction
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} catch (err) {
|
|
211
|
+
_iterator.e(err);
|
|
212
|
+
} finally {
|
|
213
|
+
_iterator.f();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return sortFields;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* retryInterval - A retry interval which increases acc to number of failures
|
|
220
|
+
*
|
|
221
|
+
* @return {number} Duration to wait in milliseconds
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
function retryInterval(numberOfFailures) {
|
|
225
|
+
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
226
|
+
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
227
|
+
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
228
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
229
|
+
}
|
|
230
|
+
function randomId() {
|
|
231
|
+
return generateUUIDv4();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function hex(bytes) {
|
|
235
|
+
var s = '';
|
|
236
|
+
|
|
237
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
238
|
+
s += bytes[i].toString(16).padStart(2, '0');
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return s;
|
|
242
|
+
} // https://tools.ietf.org/html/rfc4122
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
function generateUUIDv4() {
|
|
246
|
+
var bytes = getRandomBytes(16);
|
|
247
|
+
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
248
|
+
|
|
249
|
+
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
250
|
+
|
|
251
|
+
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function getRandomValuesWithMathRandom(bytes) {
|
|
255
|
+
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
256
|
+
|
|
257
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
258
|
+
bytes[i] = Math.random() * max;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
var getRandomValues = function () {
|
|
263
|
+
var _crypto;
|
|
264
|
+
|
|
265
|
+
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
266
|
+
return crypto.getRandomValues.bind(crypto);
|
|
267
|
+
} else if (typeof msCrypto !== 'undefined') {
|
|
268
|
+
return msCrypto.getRandomValues.bind(msCrypto);
|
|
269
|
+
} else {
|
|
270
|
+
return getRandomValuesWithMathRandom;
|
|
271
|
+
}
|
|
272
|
+
}();
|
|
273
|
+
|
|
274
|
+
function getRandomBytes(length) {
|
|
275
|
+
var bytes = new Uint8Array(length);
|
|
276
|
+
getRandomValues(bytes);
|
|
277
|
+
return bytes;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function convertErrorToJson(err) {
|
|
281
|
+
var jsonObj = {};
|
|
282
|
+
if (!err) return jsonObj;
|
|
283
|
+
|
|
284
|
+
try {
|
|
285
|
+
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
286
|
+
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
287
|
+
});
|
|
288
|
+
} catch (_) {
|
|
289
|
+
return {
|
|
290
|
+
error: 'failed to serialize the error'
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return jsonObj;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* isOnline safely return the navigator.online value for browser env
|
|
298
|
+
* if navigator is not in global object, it always return true
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
function isOnline() {
|
|
302
|
+
var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
|
|
303
|
+
|
|
304
|
+
if (!nav) {
|
|
305
|
+
console.warn('isOnline failed to access window.navigator and assume browser is online');
|
|
306
|
+
return true;
|
|
307
|
+
} // RN navigator has undefined for onLine
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
if (typeof nav.onLine !== 'boolean') {
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return nav.onLine;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
function addConnectionEventListeners(cb) {
|
|
321
|
+
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
322
|
+
window.addEventListener('offline', cb);
|
|
323
|
+
window.addEventListener('online', cb);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function removeConnectionEventListeners(cb) {
|
|
327
|
+
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
328
|
+
window.removeEventListener('offline', cb);
|
|
329
|
+
window.removeEventListener('online', cb);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
333
|
+
var newParams = [];
|
|
334
|
+
|
|
335
|
+
for (var k in params) {
|
|
336
|
+
// Stream backend doesn't treat "undefined" value same as value not being present.
|
|
337
|
+
// So, we need to skip the undefined values.
|
|
338
|
+
if (params[k] === undefined) continue;
|
|
339
|
+
|
|
340
|
+
if (Array.isArray(params[k]) || _typeof(params[k]) === 'object') {
|
|
341
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
|
|
342
|
+
} else {
|
|
343
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return newParams.join('&');
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
351
|
+
* and sets the status to received if missing. Returns a message object
|
|
352
|
+
*
|
|
353
|
+
* @param {MessageResponse<StreamChatGenerics>} message a message object
|
|
354
|
+
*
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
function formatMessage(message) {
|
|
358
|
+
return _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
359
|
+
/**
|
|
360
|
+
* @deprecated please use `html`
|
|
361
|
+
*/
|
|
362
|
+
__html: message.html,
|
|
363
|
+
// parse the date..
|
|
364
|
+
pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
|
|
365
|
+
created_at: message.created_at ? new Date(message.created_at) : new Date(),
|
|
366
|
+
updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
|
|
367
|
+
status: message.status || 'received'
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function addToMessageList(messages, message) {
|
|
371
|
+
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
372
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
373
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
374
|
+
var addMessageToList = addIfDoesNotExist || timestampChanged;
|
|
375
|
+
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
376
|
+
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
377
|
+
|
|
378
|
+
if (timestampChanged) {
|
|
379
|
+
messageArr = messageArr.filter(function (msg) {
|
|
380
|
+
return !(msg.id && message.id === msg.id);
|
|
381
|
+
});
|
|
382
|
+
} // Get array length after filtering
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
386
|
+
|
|
387
|
+
if (messageArrayLength === 0 && addMessageToList) {
|
|
388
|
+
return messageArr.concat(message);
|
|
389
|
+
} else if (messageArrayLength === 0) {
|
|
390
|
+
return _toConsumableArray(messageArr);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
var messageTime = message[sortBy].getTime();
|
|
394
|
+
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
395
|
+
|
|
396
|
+
if (messageIsNewest && addMessageToList) {
|
|
397
|
+
return messageArr.concat(message);
|
|
398
|
+
} else if (messageIsNewest) {
|
|
399
|
+
return _toConsumableArray(messageArr);
|
|
400
|
+
} // find the closest index to push the new message
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
var left = 0;
|
|
404
|
+
var middle = 0;
|
|
405
|
+
var right = messageArrayLength - 1;
|
|
406
|
+
|
|
407
|
+
while (left <= right) {
|
|
408
|
+
middle = Math.floor((right + left) / 2);
|
|
409
|
+
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
410
|
+
} // message already exists and not filtered due to timestampChanged, update and return
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
if (!timestampChanged && message.id) {
|
|
414
|
+
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
415
|
+
messageArr[left] = message;
|
|
416
|
+
return _toConsumableArray(messageArr);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
420
|
+
messageArr[left - 1] = message;
|
|
421
|
+
return _toConsumableArray(messageArr);
|
|
422
|
+
}
|
|
423
|
+
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
424
|
+
// or have a timestamp change.
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
if (addMessageToList) {
|
|
428
|
+
messageArr.splice(left, 0, message);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return _toConsumableArray(messageArr);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
435
|
+
|
|
436
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
99
437
|
|
|
100
438
|
/**
|
|
101
439
|
* ChannelState - A container class for the channel state.
|
|
@@ -172,7 +510,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
172
510
|
var m = messages[i];
|
|
173
511
|
|
|
174
512
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
175
|
-
messages[i] = _objectSpread$
|
|
513
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
176
514
|
user: user
|
|
177
515
|
});
|
|
178
516
|
}
|
|
@@ -227,7 +565,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
227
565
|
user: m.user
|
|
228
566
|
};
|
|
229
567
|
} else {
|
|
230
|
-
messages[i] = _objectSpread$
|
|
568
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
231
569
|
type: 'deleted',
|
|
232
570
|
deleted_at: user.deleted_at
|
|
233
571
|
});
|
|
@@ -334,7 +672,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
334
672
|
}, {
|
|
335
673
|
key: "formatMessage",
|
|
336
674
|
value: function formatMessage(message) {
|
|
337
|
-
return _objectSpread$
|
|
675
|
+
return _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
338
676
|
/**
|
|
339
677
|
* @deprecated please use `html`
|
|
340
678
|
*/
|
|
@@ -552,7 +890,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
552
890
|
var parseMessage = function parseMessage(m) {
|
|
553
891
|
var _m$pinned_at, _m$updated_at;
|
|
554
892
|
|
|
555
|
-
return _objectSpread$
|
|
893
|
+
return _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
556
894
|
created_at: m.created_at.toISOString(),
|
|
557
895
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
558
896
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -563,8 +901,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
563
901
|
var updatedMessages = set.messages.filter(function (msg) {
|
|
564
902
|
return msg.quoted_message_id === message.id;
|
|
565
903
|
}).map(parseMessage).map(function (msg) {
|
|
566
|
-
return _objectSpread$
|
|
567
|
-
quoted_message: _objectSpread$
|
|
904
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
905
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
568
906
|
attachments: []
|
|
569
907
|
})
|
|
570
908
|
});
|
|
@@ -645,66 +983,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
645
983
|
*/
|
|
646
984
|
function _addToMessageList(messages, message) {
|
|
647
985
|
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
648
|
-
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
649
|
-
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
650
|
-
|
|
651
|
-
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
652
|
-
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
653
|
-
|
|
654
|
-
if (timestampChanged) {
|
|
655
|
-
messageArr = messageArr.filter(function (msg) {
|
|
656
|
-
return !(msg.id && message.id === msg.id);
|
|
657
|
-
});
|
|
658
|
-
} // Get array length after filtering
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
662
|
-
|
|
663
|
-
if (messageArrayLength === 0 && addMessageToList) {
|
|
664
|
-
return messageArr.concat(message);
|
|
665
|
-
} else if (messageArrayLength === 0) {
|
|
666
|
-
return _toConsumableArray(messageArr);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
var messageTime = message[sortBy].getTime();
|
|
670
|
-
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
671
|
-
|
|
672
|
-
if (messageIsNewest && addMessageToList) {
|
|
673
|
-
return messageArr.concat(message);
|
|
674
|
-
} else if (messageIsNewest) {
|
|
675
|
-
return _toConsumableArray(messageArr);
|
|
676
|
-
} // find the closest index to push the new message
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
var left = 0;
|
|
680
|
-
var middle = 0;
|
|
681
|
-
var right = messageArrayLength - 1;
|
|
682
|
-
|
|
683
|
-
while (left <= right) {
|
|
684
|
-
middle = Math.floor((right + left) / 2);
|
|
685
|
-
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
686
|
-
} // message already exists and not filtered due to timestampChanged, update and return
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
if (!timestampChanged && message.id) {
|
|
690
|
-
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
691
|
-
messageArr[left] = message;
|
|
692
|
-
return _toConsumableArray(messageArr);
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
696
|
-
messageArr[left - 1] = message;
|
|
697
|
-
return _toConsumableArray(messageArr);
|
|
698
|
-
}
|
|
699
|
-
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
700
|
-
// or have a timestamp change.
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
if (addMessageToList) {
|
|
704
|
-
messageArr.splice(left, 0, message);
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
return _toConsumableArray(messageArr);
|
|
986
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
987
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
988
|
+
return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
|
|
708
989
|
}
|
|
709
990
|
/**
|
|
710
991
|
* removeMessage - Description
|
|
@@ -1016,328 +1297,78 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1016
1297
|
isLatest: false
|
|
1017
1298
|
});
|
|
1018
1299
|
targetMessageSetIndex = this.messageSets.length - 1;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
break;
|
|
1022
|
-
|
|
1023
|
-
case 'current':
|
|
1024
|
-
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1025
|
-
return s.isCurrent;
|
|
1026
|
-
});
|
|
1027
|
-
break;
|
|
1028
|
-
|
|
1029
|
-
case 'latest':
|
|
1030
|
-
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1031
|
-
return s.isLatest;
|
|
1032
|
-
});
|
|
1033
|
-
break;
|
|
1034
|
-
|
|
1035
|
-
default:
|
|
1036
|
-
targetMessageSetIndex = -1;
|
|
1037
|
-
} // when merging the target set will be the first one from the overlapping message sets
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1041
|
-
|
|
1042
|
-
var mergeSourceMessageSetIndices = _toConsumableArray(overlappingMessageSetIndices);
|
|
1043
|
-
|
|
1044
|
-
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1045
|
-
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1046
|
-
} // merge message sets
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1050
|
-
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1051
|
-
var sources = this.messageSets.filter(function (_, i) {
|
|
1052
|
-
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1053
|
-
});
|
|
1054
|
-
sources.forEach(function (messageSet) {
|
|
1055
|
-
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1056
|
-
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1057
|
-
messagesToAdd = [].concat(_toConsumableArray(messagesToAdd), _toConsumableArray(messageSet.messages));
|
|
1058
|
-
});
|
|
1059
|
-
sources.forEach(function (s) {
|
|
1060
|
-
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1061
|
-
});
|
|
1062
|
-
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1063
|
-
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1064
|
-
});
|
|
1065
|
-
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1066
|
-
}
|
|
1067
|
-
} else {
|
|
1068
|
-
// assumes that all new messages belong to the same set
|
|
1069
|
-
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
return {
|
|
1073
|
-
targetMessageSetIndex: targetMessageSetIndex,
|
|
1074
|
-
messagesToAdd: messagesToAdd
|
|
1075
|
-
};
|
|
1076
|
-
}
|
|
1077
|
-
}]);
|
|
1078
|
-
|
|
1079
|
-
return ChannelState;
|
|
1080
|
-
}();
|
|
1081
|
-
|
|
1082
|
-
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1083
|
-
|
|
1084
|
-
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1085
|
-
|
|
1086
|
-
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
1090
|
-
* use this when you want to run the promise and handle errors by logging a warning
|
|
1091
|
-
*
|
|
1092
|
-
* @param {Promise<T>} promise The promise you want to run and log
|
|
1093
|
-
* @param {string} name A descriptive name of what the promise does for log output
|
|
1094
|
-
*
|
|
1095
|
-
*/
|
|
1096
|
-
function logChatPromiseExecution(promise, name) {
|
|
1097
|
-
promise.then().catch(function (error) {
|
|
1098
|
-
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
var sleep = function sleep(m) {
|
|
1102
|
-
return new Promise(function (r) {
|
|
1103
|
-
return setTimeout(r, m);
|
|
1104
|
-
});
|
|
1105
|
-
};
|
|
1106
|
-
function isFunction(value) {
|
|
1107
|
-
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
1108
|
-
}
|
|
1109
|
-
var chatCodes = {
|
|
1110
|
-
TOKEN_EXPIRED: 40,
|
|
1111
|
-
WS_CLOSED_SUCCESS: 1000
|
|
1112
|
-
};
|
|
1113
|
-
|
|
1114
|
-
function isReadableStream(obj) {
|
|
1115
|
-
return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
function isBuffer(obj) {
|
|
1119
|
-
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
1120
|
-
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
1121
|
-
obj.constructor.isBuffer(obj);
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
function isFileWebAPI(uri) {
|
|
1125
|
-
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
function isOwnUser(user) {
|
|
1129
|
-
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
function isBlobWebAPI(uri) {
|
|
1133
|
-
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
function isOwnUserBaseProperty(property) {
|
|
1137
|
-
var ownUserBaseProperties = {
|
|
1138
|
-
channel_mutes: true,
|
|
1139
|
-
devices: true,
|
|
1140
|
-
mutes: true,
|
|
1141
|
-
total_unread_count: true,
|
|
1142
|
-
unread_channels: true,
|
|
1143
|
-
unread_count: true,
|
|
1144
|
-
invisible: true,
|
|
1145
|
-
roles: true
|
|
1146
|
-
};
|
|
1147
|
-
return ownUserBaseProperties[property];
|
|
1148
|
-
}
|
|
1149
|
-
function addFileToFormData(uri, name, contentType) {
|
|
1150
|
-
var data = new FormData();
|
|
1151
|
-
|
|
1152
|
-
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
1153
|
-
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
1154
|
-
} else {
|
|
1155
|
-
data.append('file', {
|
|
1156
|
-
uri: uri,
|
|
1157
|
-
name: name || uri.split('/').reverse()[0],
|
|
1158
|
-
contentType: contentType || undefined,
|
|
1159
|
-
type: contentType || undefined
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
return data;
|
|
1164
|
-
}
|
|
1165
|
-
function normalizeQuerySort(sort) {
|
|
1166
|
-
var sortFields = [];
|
|
1167
|
-
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
1168
|
-
|
|
1169
|
-
var _iterator = _createForOfIteratorHelper$3(sortArr),
|
|
1170
|
-
_step;
|
|
1171
|
-
|
|
1172
|
-
try {
|
|
1173
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1174
|
-
var item = _step.value;
|
|
1175
|
-
var entries = Object.entries(item);
|
|
1176
|
-
|
|
1177
|
-
if (entries.length > 1) {
|
|
1178
|
-
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
1182
|
-
var _entries$_i = _slicedToArray(_entries[_i], 2),
|
|
1183
|
-
field = _entries$_i[0],
|
|
1184
|
-
direction = _entries$_i[1];
|
|
1185
|
-
|
|
1186
|
-
sortFields.push({
|
|
1187
|
-
field: field,
|
|
1188
|
-
direction: direction
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
} catch (err) {
|
|
1193
|
-
_iterator.e(err);
|
|
1194
|
-
} finally {
|
|
1195
|
-
_iterator.f();
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
return sortFields;
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* retryInterval - A retry interval which increases acc to number of failures
|
|
1202
|
-
*
|
|
1203
|
-
* @return {number} Duration to wait in milliseconds
|
|
1204
|
-
*/
|
|
1205
|
-
|
|
1206
|
-
function retryInterval(numberOfFailures) {
|
|
1207
|
-
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
1208
|
-
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
1209
|
-
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
1210
|
-
return Math.floor(Math.random() * (max - min) + min);
|
|
1211
|
-
}
|
|
1212
|
-
function randomId() {
|
|
1213
|
-
return generateUUIDv4();
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
function hex(bytes) {
|
|
1217
|
-
var s = '';
|
|
1218
|
-
|
|
1219
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1220
|
-
s += bytes[i].toString(16).padStart(2, '0');
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
return s;
|
|
1224
|
-
} // https://tools.ietf.org/html/rfc4122
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
function generateUUIDv4() {
|
|
1228
|
-
var bytes = getRandomBytes(16);
|
|
1229
|
-
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
1230
|
-
|
|
1231
|
-
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
1232
|
-
|
|
1233
|
-
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
function getRandomValuesWithMathRandom(bytes) {
|
|
1237
|
-
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
1238
|
-
|
|
1239
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1240
|
-
bytes[i] = Math.random() * max;
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
var getRandomValues = function () {
|
|
1245
|
-
var _crypto;
|
|
1246
|
-
|
|
1247
|
-
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
1248
|
-
return crypto.getRandomValues.bind(crypto);
|
|
1249
|
-
} else if (typeof msCrypto !== 'undefined') {
|
|
1250
|
-
return msCrypto.getRandomValues.bind(msCrypto);
|
|
1251
|
-
} else {
|
|
1252
|
-
return getRandomValuesWithMathRandom;
|
|
1253
|
-
}
|
|
1254
|
-
}();
|
|
1255
|
-
|
|
1256
|
-
function getRandomBytes(length) {
|
|
1257
|
-
var bytes = new Uint8Array(length);
|
|
1258
|
-
getRandomValues(bytes);
|
|
1259
|
-
return bytes;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
function convertErrorToJson(err) {
|
|
1263
|
-
var jsonObj = {};
|
|
1264
|
-
if (!err) return jsonObj;
|
|
1265
|
-
|
|
1266
|
-
try {
|
|
1267
|
-
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
1268
|
-
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
1269
|
-
});
|
|
1270
|
-
} catch (_) {
|
|
1271
|
-
return {
|
|
1272
|
-
error: 'failed to serialize the error'
|
|
1273
|
-
};
|
|
1274
|
-
}
|
|
1300
|
+
}
|
|
1275
1301
|
|
|
1276
|
-
|
|
1277
|
-
}
|
|
1278
|
-
/**
|
|
1279
|
-
* isOnline safely return the navigator.online value for browser env
|
|
1280
|
-
* if navigator is not in global object, it always return true
|
|
1281
|
-
*/
|
|
1302
|
+
break;
|
|
1282
1303
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1304
|
+
case 'current':
|
|
1305
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1306
|
+
return s.isCurrent;
|
|
1307
|
+
});
|
|
1308
|
+
break;
|
|
1285
1309
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1310
|
+
case 'latest':
|
|
1311
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1312
|
+
return s.isLatest;
|
|
1313
|
+
});
|
|
1314
|
+
break;
|
|
1290
1315
|
|
|
1316
|
+
default:
|
|
1317
|
+
targetMessageSetIndex = -1;
|
|
1318
|
+
} // when merging the target set will be the first one from the overlapping message sets
|
|
1291
1319
|
|
|
1292
|
-
if (typeof nav.onLine !== 'boolean') {
|
|
1293
|
-
return true;
|
|
1294
|
-
}
|
|
1295
1320
|
|
|
1296
|
-
|
|
1297
|
-
}
|
|
1298
|
-
/**
|
|
1299
|
-
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
1300
|
-
*/
|
|
1321
|
+
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1301
1322
|
|
|
1302
|
-
|
|
1303
|
-
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
1304
|
-
window.addEventListener('offline', cb);
|
|
1305
|
-
window.addEventListener('online', cb);
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
function removeConnectionEventListeners(cb) {
|
|
1309
|
-
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
1310
|
-
window.removeEventListener('offline', cb);
|
|
1311
|
-
window.removeEventListener('online', cb);
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
1315
|
-
var newParams = [];
|
|
1323
|
+
var mergeSourceMessageSetIndices = _toConsumableArray(overlappingMessageSetIndices);
|
|
1316
1324
|
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
if (params[k] === undefined) continue;
|
|
1325
|
+
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1326
|
+
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1327
|
+
} // merge message sets
|
|
1321
1328
|
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1329
|
+
|
|
1330
|
+
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1331
|
+
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1332
|
+
var sources = this.messageSets.filter(function (_, i) {
|
|
1333
|
+
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1334
|
+
});
|
|
1335
|
+
sources.forEach(function (messageSet) {
|
|
1336
|
+
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1337
|
+
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1338
|
+
messagesToAdd = [].concat(_toConsumableArray(messagesToAdd), _toConsumableArray(messageSet.messages));
|
|
1339
|
+
});
|
|
1340
|
+
sources.forEach(function (s) {
|
|
1341
|
+
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1342
|
+
});
|
|
1343
|
+
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1344
|
+
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1345
|
+
});
|
|
1346
|
+
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1347
|
+
}
|
|
1348
|
+
} else {
|
|
1349
|
+
// assumes that all new messages belong to the same set
|
|
1350
|
+
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
return {
|
|
1354
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1355
|
+
messagesToAdd: messagesToAdd
|
|
1356
|
+
};
|
|
1326
1357
|
}
|
|
1327
|
-
}
|
|
1358
|
+
}]);
|
|
1328
1359
|
|
|
1329
|
-
return
|
|
1330
|
-
};
|
|
1360
|
+
return ChannelState;
|
|
1361
|
+
}();
|
|
1331
1362
|
|
|
1332
|
-
function _createForOfIteratorHelper$
|
|
1363
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1333
1364
|
|
|
1334
|
-
function _unsupportedIterableToArray$
|
|
1365
|
+
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1335
1366
|
|
|
1336
|
-
function _arrayLikeToArray$
|
|
1367
|
+
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1337
1368
|
|
|
1338
|
-
function ownKeys$
|
|
1369
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1339
1370
|
|
|
1340
|
-
function _objectSpread$
|
|
1371
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1341
1372
|
|
|
1342
1373
|
/**
|
|
1343
1374
|
* Channel - The Channel class manages it's own state.
|
|
@@ -1410,7 +1441,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1410
1441
|
while (1) {
|
|
1411
1442
|
switch (_context.prev = _context.next) {
|
|
1412
1443
|
case 0:
|
|
1413
|
-
defaultOptions = _objectSpread$
|
|
1444
|
+
defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
1414
1445
|
watch: false,
|
|
1415
1446
|
state: false,
|
|
1416
1447
|
presence: false
|
|
@@ -1482,7 +1513,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1482
1513
|
|
|
1483
1514
|
this.data = data; // this._data is used for the requests...
|
|
1484
1515
|
|
|
1485
|
-
this._data = _objectSpread$
|
|
1516
|
+
this._data = _objectSpread$6({}, data);
|
|
1486
1517
|
this.cid = "".concat(type, ":").concat(id);
|
|
1487
1518
|
this.listeners = {}; // perhaps the state variable should be private
|
|
1488
1519
|
|
|
@@ -1539,23 +1570,19 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1539
1570
|
key: "sendMessage",
|
|
1540
1571
|
value: function () {
|
|
1541
1572
|
var _sendMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(message, options) {
|
|
1542
|
-
var sendMessageResponse;
|
|
1543
1573
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1544
1574
|
while (1) {
|
|
1545
1575
|
switch (_context2.prev = _context2.next) {
|
|
1546
1576
|
case 0:
|
|
1547
1577
|
_context2.next = 2;
|
|
1548
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
1578
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
|
|
1549
1579
|
message: message
|
|
1550
1580
|
}, options));
|
|
1551
1581
|
|
|
1552
1582
|
case 2:
|
|
1553
|
-
|
|
1554
|
-
// Reset unreadCount to 0.
|
|
1555
|
-
this.state.unreadCount = 0;
|
|
1556
|
-
return _context2.abrupt("return", sendMessageResponse);
|
|
1583
|
+
return _context2.abrupt("return", _context2.sent);
|
|
1557
1584
|
|
|
1558
|
-
case
|
|
1585
|
+
case 3:
|
|
1559
1586
|
case "end":
|
|
1560
1587
|
return _context2.stop();
|
|
1561
1588
|
}
|
|
@@ -1664,7 +1691,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1664
1691
|
|
|
1665
1692
|
case 3:
|
|
1666
1693
|
// Return a list of channels
|
|
1667
|
-
payload = _objectSpread$
|
|
1694
|
+
payload = _objectSpread$6(_objectSpread$6({
|
|
1668
1695
|
filter_conditions: {
|
|
1669
1696
|
cid: this.cid
|
|
1670
1697
|
}
|
|
@@ -1761,7 +1788,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1761
1788
|
|
|
1762
1789
|
_context5.next = 6;
|
|
1763
1790
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
1764
|
-
payload: _objectSpread$
|
|
1791
|
+
payload: _objectSpread$6({
|
|
1765
1792
|
type: type,
|
|
1766
1793
|
id: id,
|
|
1767
1794
|
members: members,
|
|
@@ -1822,7 +1849,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1822
1849
|
|
|
1823
1850
|
case 4:
|
|
1824
1851
|
_context6.next = 6;
|
|
1825
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$
|
|
1852
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
|
|
1826
1853
|
reaction: reaction
|
|
1827
1854
|
}, options));
|
|
1828
1855
|
|
|
@@ -1903,7 +1930,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1903
1930
|
delete channelData[key];
|
|
1904
1931
|
});
|
|
1905
1932
|
_context7.next = 7;
|
|
1906
|
-
return this._update(_objectSpread$
|
|
1933
|
+
return this._update(_objectSpread$6({
|
|
1907
1934
|
message: updateMessage,
|
|
1908
1935
|
data: channelData
|
|
1909
1936
|
}, options));
|
|
@@ -2063,7 +2090,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2063
2090
|
case 0:
|
|
2064
2091
|
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
2065
2092
|
_context11.next = 3;
|
|
2066
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2093
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
|
|
2067
2094
|
|
|
2068
2095
|
case 3:
|
|
2069
2096
|
return _context11.abrupt("return", _context11.sent);
|
|
@@ -2139,7 +2166,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2139
2166
|
case 0:
|
|
2140
2167
|
options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
2141
2168
|
_context13.next = 3;
|
|
2142
|
-
return this._update(_objectSpread$
|
|
2169
|
+
return this._update(_objectSpread$6({
|
|
2143
2170
|
accept_invite: true
|
|
2144
2171
|
}, options));
|
|
2145
2172
|
|
|
@@ -2180,7 +2207,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2180
2207
|
case 0:
|
|
2181
2208
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2182
2209
|
_context14.next = 3;
|
|
2183
|
-
return this._update(_objectSpread$
|
|
2210
|
+
return this._update(_objectSpread$6({
|
|
2184
2211
|
reject_invite: true
|
|
2185
2212
|
}, options));
|
|
2186
2213
|
|
|
@@ -2222,7 +2249,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2222
2249
|
case 0:
|
|
2223
2250
|
options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
2224
2251
|
_context15.next = 3;
|
|
2225
|
-
return this._update(_objectSpread$
|
|
2252
|
+
return this._update(_objectSpread$6({
|
|
2226
2253
|
add_members: members,
|
|
2227
2254
|
message: message
|
|
2228
2255
|
}, options));
|
|
@@ -2265,7 +2292,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2265
2292
|
case 0:
|
|
2266
2293
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2267
2294
|
_context16.next = 3;
|
|
2268
|
-
return this._update(_objectSpread$
|
|
2295
|
+
return this._update(_objectSpread$6({
|
|
2269
2296
|
add_moderators: members,
|
|
2270
2297
|
message: message
|
|
2271
2298
|
}, options));
|
|
@@ -2308,7 +2335,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2308
2335
|
case 0:
|
|
2309
2336
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2310
2337
|
_context17.next = 3;
|
|
2311
|
-
return this._update(_objectSpread$
|
|
2338
|
+
return this._update(_objectSpread$6({
|
|
2312
2339
|
assign_roles: roles,
|
|
2313
2340
|
message: message
|
|
2314
2341
|
}, options));
|
|
@@ -2351,7 +2378,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2351
2378
|
case 0:
|
|
2352
2379
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2353
2380
|
_context18.next = 3;
|
|
2354
|
-
return this._update(_objectSpread$
|
|
2381
|
+
return this._update(_objectSpread$6({
|
|
2355
2382
|
invites: members,
|
|
2356
2383
|
message: message
|
|
2357
2384
|
}, options));
|
|
@@ -2394,7 +2421,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2394
2421
|
case 0:
|
|
2395
2422
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2396
2423
|
_context19.next = 3;
|
|
2397
|
-
return this._update(_objectSpread$
|
|
2424
|
+
return this._update(_objectSpread$6({
|
|
2398
2425
|
remove_members: members,
|
|
2399
2426
|
message: message
|
|
2400
2427
|
}, options));
|
|
@@ -2437,7 +2464,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2437
2464
|
case 0:
|
|
2438
2465
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
2439
2466
|
_context20.next = 3;
|
|
2440
|
-
return this._update(_objectSpread$
|
|
2467
|
+
return this._update(_objectSpread$6({
|
|
2441
2468
|
demote_moderators: members,
|
|
2442
2469
|
message: message
|
|
2443
2470
|
}, options));
|
|
@@ -2522,7 +2549,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2522
2549
|
case 0:
|
|
2523
2550
|
opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
2524
2551
|
_context22.next = 3;
|
|
2525
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
2552
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
|
|
2526
2553
|
channel_cid: this.cid
|
|
2527
2554
|
}, opts));
|
|
2528
2555
|
|
|
@@ -2564,7 +2591,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2564
2591
|
case 0:
|
|
2565
2592
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
2566
2593
|
_context23.next = 3;
|
|
2567
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
2594
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
|
|
2568
2595
|
channel_cid: this.cid
|
|
2569
2596
|
}, opts));
|
|
2570
2597
|
|
|
@@ -2623,7 +2650,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2623
2650
|
}, {
|
|
2624
2651
|
key: "keystroke",
|
|
2625
2652
|
value: function () {
|
|
2626
|
-
var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id) {
|
|
2653
|
+
var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id, options) {
|
|
2627
2654
|
var _this$getConfig;
|
|
2628
2655
|
|
|
2629
2656
|
var now, diff;
|
|
@@ -2651,10 +2678,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2651
2678
|
|
|
2652
2679
|
this.lastTypingEvent = new Date();
|
|
2653
2680
|
_context24.next = 10;
|
|
2654
|
-
return this.sendEvent({
|
|
2681
|
+
return this.sendEvent(_objectSpread$6({
|
|
2655
2682
|
type: 'typing.start',
|
|
2656
2683
|
parent_id: parent_id
|
|
2657
|
-
});
|
|
2684
|
+
}, options || {}));
|
|
2658
2685
|
|
|
2659
2686
|
case 10:
|
|
2660
2687
|
case "end":
|
|
@@ -2664,7 +2691,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2664
2691
|
}, _callee24, this);
|
|
2665
2692
|
}));
|
|
2666
2693
|
|
|
2667
|
-
function keystroke(_x25) {
|
|
2694
|
+
function keystroke(_x25, _x26) {
|
|
2668
2695
|
return _keystroke.apply(this, arguments);
|
|
2669
2696
|
}
|
|
2670
2697
|
|
|
@@ -2679,7 +2706,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2679
2706
|
}, {
|
|
2680
2707
|
key: "stopTyping",
|
|
2681
2708
|
value: function () {
|
|
2682
|
-
var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id) {
|
|
2709
|
+
var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id, options) {
|
|
2683
2710
|
var _this$getConfig2;
|
|
2684
2711
|
|
|
2685
2712
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
@@ -2697,10 +2724,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2697
2724
|
this.lastTypingEvent = null;
|
|
2698
2725
|
this.isTyping = false;
|
|
2699
2726
|
_context25.next = 6;
|
|
2700
|
-
return this.sendEvent({
|
|
2727
|
+
return this.sendEvent(_objectSpread$6({
|
|
2701
2728
|
type: 'typing.stop',
|
|
2702
2729
|
parent_id: parent_id
|
|
2703
|
-
});
|
|
2730
|
+
}, options || {}));
|
|
2704
2731
|
|
|
2705
2732
|
case 6:
|
|
2706
2733
|
case "end":
|
|
@@ -2710,7 +2737,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2710
2737
|
}, _callee25, this);
|
|
2711
2738
|
}));
|
|
2712
2739
|
|
|
2713
|
-
function stopTyping(
|
|
2740
|
+
function stopTyping(_x27, _x28) {
|
|
2714
2741
|
return _stopTyping.apply(this, arguments);
|
|
2715
2742
|
}
|
|
2716
2743
|
|
|
@@ -2773,7 +2800,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2773
2800
|
|
|
2774
2801
|
case 4:
|
|
2775
2802
|
_context26.next = 6;
|
|
2776
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
2803
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
|
|
2777
2804
|
|
|
2778
2805
|
case 6:
|
|
2779
2806
|
return _context26.abrupt("return", _context26.sent);
|
|
@@ -2820,7 +2847,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2820
2847
|
|
|
2821
2848
|
case 3:
|
|
2822
2849
|
_context27.next = 5;
|
|
2823
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
2850
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
|
|
2824
2851
|
|
|
2825
2852
|
case 5:
|
|
2826
2853
|
return _context27.abrupt("return", _context27.sent);
|
|
@@ -2833,7 +2860,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2833
2860
|
}, _callee27, this);
|
|
2834
2861
|
}));
|
|
2835
2862
|
|
|
2836
|
-
function markUnread(
|
|
2863
|
+
function markUnread(_x29) {
|
|
2837
2864
|
return _markUnread.apply(this, arguments);
|
|
2838
2865
|
}
|
|
2839
2866
|
|
|
@@ -2888,7 +2915,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2888
2915
|
defaultOptions.watch = false;
|
|
2889
2916
|
}
|
|
2890
2917
|
|
|
2891
|
-
combined = _objectSpread$
|
|
2918
|
+
combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
|
|
2892
2919
|
_context28.next = 7;
|
|
2893
2920
|
return this.query(combined, 'latest');
|
|
2894
2921
|
|
|
@@ -2912,7 +2939,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2912
2939
|
}, _callee28, this);
|
|
2913
2940
|
}));
|
|
2914
2941
|
|
|
2915
|
-
function watch(
|
|
2942
|
+
function watch(_x30) {
|
|
2916
2943
|
return _watch.apply(this, arguments);
|
|
2917
2944
|
}
|
|
2918
2945
|
|
|
@@ -2979,7 +3006,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2979
3006
|
switch (_context30.prev = _context30.next) {
|
|
2980
3007
|
case 0:
|
|
2981
3008
|
_context30.next = 2;
|
|
2982
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$
|
|
3009
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
|
|
2983
3010
|
|
|
2984
3011
|
case 2:
|
|
2985
3012
|
data = _context30.sent;
|
|
@@ -2999,7 +3026,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2999
3026
|
}, _callee30, this);
|
|
3000
3027
|
}));
|
|
3001
3028
|
|
|
3002
|
-
function getReplies(
|
|
3029
|
+
function getReplies(_x31, _x32) {
|
|
3003
3030
|
return _getReplies.apply(this, arguments);
|
|
3004
3031
|
}
|
|
3005
3032
|
|
|
@@ -3027,7 +3054,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3027
3054
|
sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
|
|
3028
3055
|
_context31.next = 3;
|
|
3029
3056
|
return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
|
|
3030
|
-
payload: _objectSpread$
|
|
3057
|
+
payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3031
3058
|
sort: normalizeQuerySort(sort)
|
|
3032
3059
|
})
|
|
3033
3060
|
});
|
|
@@ -3043,7 +3070,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3043
3070
|
}, _callee31, this);
|
|
3044
3071
|
}));
|
|
3045
3072
|
|
|
3046
|
-
function getPinnedMessages(
|
|
3073
|
+
function getPinnedMessages(_x33) {
|
|
3047
3074
|
return _getPinnedMessages.apply(this, arguments);
|
|
3048
3075
|
}
|
|
3049
3076
|
|
|
@@ -3061,7 +3088,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3061
3088
|
}, {
|
|
3062
3089
|
key: "getReactions",
|
|
3063
3090
|
value: function getReactions(message_id, options) {
|
|
3064
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$
|
|
3091
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
|
|
3065
3092
|
}
|
|
3066
3093
|
/**
|
|
3067
3094
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -3208,7 +3235,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3208
3235
|
}
|
|
3209
3236
|
|
|
3210
3237
|
_context32.next = 7;
|
|
3211
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
3238
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$6({
|
|
3212
3239
|
data: this._data,
|
|
3213
3240
|
state: true
|
|
3214
3241
|
}, options));
|
|
@@ -3272,7 +3299,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3272
3299
|
}, _callee32, this);
|
|
3273
3300
|
}));
|
|
3274
3301
|
|
|
3275
|
-
function query(
|
|
3302
|
+
function query(_x34) {
|
|
3276
3303
|
return _query.apply(this, arguments);
|
|
3277
3304
|
}
|
|
3278
3305
|
|
|
@@ -3297,7 +3324,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3297
3324
|
this._checkInitialized();
|
|
3298
3325
|
|
|
3299
3326
|
_context33.next = 3;
|
|
3300
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
3327
|
+
return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3301
3328
|
type: this.type,
|
|
3302
3329
|
id: this.id
|
|
3303
3330
|
}));
|
|
@@ -3313,7 +3340,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3313
3340
|
}, _callee33, this);
|
|
3314
3341
|
}));
|
|
3315
3342
|
|
|
3316
|
-
function banUser(
|
|
3343
|
+
function banUser(_x35, _x36) {
|
|
3317
3344
|
return _banUser.apply(this, arguments);
|
|
3318
3345
|
}
|
|
3319
3346
|
|
|
@@ -3444,7 +3471,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3444
3471
|
}, _callee36, this);
|
|
3445
3472
|
}));
|
|
3446
3473
|
|
|
3447
|
-
function unbanUser(
|
|
3474
|
+
function unbanUser(_x37) {
|
|
3448
3475
|
return _unbanUser.apply(this, arguments);
|
|
3449
3476
|
}
|
|
3450
3477
|
|
|
@@ -3469,7 +3496,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3469
3496
|
this._checkInitialized();
|
|
3470
3497
|
|
|
3471
3498
|
_context37.next = 3;
|
|
3472
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
3499
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3473
3500
|
type: this.type,
|
|
3474
3501
|
id: this.id
|
|
3475
3502
|
}));
|
|
@@ -3485,7 +3512,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3485
3512
|
}, _callee37, this);
|
|
3486
3513
|
}));
|
|
3487
3514
|
|
|
3488
|
-
function shadowBan(
|
|
3515
|
+
function shadowBan(_x38, _x39) {
|
|
3489
3516
|
return _shadowBan.apply(this, arguments);
|
|
3490
3517
|
}
|
|
3491
3518
|
|
|
@@ -3525,7 +3552,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3525
3552
|
}, _callee38, this);
|
|
3526
3553
|
}));
|
|
3527
3554
|
|
|
3528
|
-
function removeShadowBan(
|
|
3555
|
+
function removeShadowBan(_x40) {
|
|
3529
3556
|
return _removeShadowBan.apply(this, arguments);
|
|
3530
3557
|
}
|
|
3531
3558
|
|
|
@@ -3560,7 +3587,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3560
3587
|
}, _callee39, this);
|
|
3561
3588
|
}));
|
|
3562
3589
|
|
|
3563
|
-
function createCall(
|
|
3590
|
+
function createCall(_x41) {
|
|
3564
3591
|
return _createCall.apply(this, arguments);
|
|
3565
3592
|
}
|
|
3566
3593
|
|
|
@@ -3636,7 +3663,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3636
3663
|
}, {
|
|
3637
3664
|
key: "_handleChannelEvent",
|
|
3638
3665
|
value: function _handleChannelEvent(event) {
|
|
3639
|
-
var _event$user, _event$user2, _event$user3, _event$user5, _event$user6, _event$channel, _event$member, _event$user9, _event$
|
|
3666
|
+
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;
|
|
3640
3667
|
|
|
3641
3668
|
var channel = this;
|
|
3642
3669
|
|
|
@@ -3667,7 +3694,6 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3667
3694
|
var _event$user4, _this$getClient$user;
|
|
3668
3695
|
|
|
3669
3696
|
channelState.read[event.user.id] = {
|
|
3670
|
-
// because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
|
|
3671
3697
|
last_read: new Date(event.created_at),
|
|
3672
3698
|
last_read_message_id: event.last_read_message_id,
|
|
3673
3699
|
user: event.user,
|
|
@@ -3724,7 +3750,13 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3724
3750
|
|
|
3725
3751
|
if (event.message.pinned) {
|
|
3726
3752
|
channelState.addPinnedMessage(event.message);
|
|
3727
|
-
}
|
|
3753
|
+
} // do not increase the unread count - the back-end does not increase the count neither in the following cases:
|
|
3754
|
+
// 1. the message is mine
|
|
3755
|
+
// 2. the message is a thread reply from any user
|
|
3756
|
+
|
|
3757
|
+
|
|
3758
|
+
var preventUnreadCountUpdate = ownMessage || isThreadMessage;
|
|
3759
|
+
if (preventUnreadCountUpdate) break;
|
|
3728
3760
|
|
|
3729
3761
|
if ((_event$user8 = event.user) !== null && _event$user8 !== void 0 && _event$user8.id) {
|
|
3730
3762
|
for (var userId in channelState.read) {
|
|
@@ -3740,9 +3772,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3740
3772
|
}
|
|
3741
3773
|
}
|
|
3742
3774
|
|
|
3743
|
-
if (
|
|
3744
|
-
channelState.unreadCount = 0;
|
|
3745
|
-
} else if (this._countMessageAsUnread(event.message)) {
|
|
3775
|
+
if (this._countMessageAsUnread(event.message)) {
|
|
3746
3776
|
channelState.unreadCount = channelState.unreadCount + 1;
|
|
3747
3777
|
}
|
|
3748
3778
|
}
|
|
@@ -3815,6 +3845,25 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3815
3845
|
|
|
3816
3846
|
break;
|
|
3817
3847
|
|
|
3848
|
+
case 'notification.mark_unread':
|
|
3849
|
+
{
|
|
3850
|
+
var _event$user10, _this$getClient$user3, _event$unread_message;
|
|
3851
|
+
|
|
3852
|
+
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);
|
|
3853
|
+
|
|
3854
|
+
if (!(_ownMessage && event.user)) break;
|
|
3855
|
+
var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
|
|
3856
|
+
channelState.read[event.user.id] = {
|
|
3857
|
+
first_unread_message_id: event.first_unread_message_id,
|
|
3858
|
+
last_read: new Date(event.last_read_at),
|
|
3859
|
+
last_read_message_id: event.last_read_message_id,
|
|
3860
|
+
user: event.user,
|
|
3861
|
+
unread_messages: unreadCount
|
|
3862
|
+
};
|
|
3863
|
+
channelState.unreadCount = unreadCount;
|
|
3864
|
+
break;
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3818
3867
|
case 'channel.updated':
|
|
3819
3868
|
if (event.channel) {
|
|
3820
3869
|
var _event$channel2, _channel$data, _event$channel$hidden, _event$channel3, _channel$data2, _event$channel$own_ca, _event$channel4, _channel$data3;
|
|
@@ -3833,7 +3882,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3833
3882
|
});
|
|
3834
3883
|
}
|
|
3835
3884
|
|
|
3836
|
-
channel.data = _objectSpread$
|
|
3885
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
|
|
3837
3886
|
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,
|
|
3838
3887
|
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
|
|
3839
3888
|
});
|
|
@@ -3864,7 +3913,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3864
3913
|
break;
|
|
3865
3914
|
|
|
3866
3915
|
case 'channel.hidden':
|
|
3867
|
-
channel.data = _objectSpread$
|
|
3916
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3868
3917
|
hidden: true
|
|
3869
3918
|
});
|
|
3870
3919
|
|
|
@@ -3875,26 +3924,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3875
3924
|
break;
|
|
3876
3925
|
|
|
3877
3926
|
case 'channel.visible':
|
|
3878
|
-
channel.data = _objectSpread$
|
|
3927
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3879
3928
|
hidden: false
|
|
3880
3929
|
});
|
|
3881
3930
|
break;
|
|
3882
3931
|
|
|
3883
3932
|
case 'user.banned':
|
|
3884
|
-
if (!((_event$
|
|
3885
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3933
|
+
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
3934
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3886
3935
|
shadow_banned: !!event.shadow,
|
|
3887
3936
|
banned: !event.shadow,
|
|
3888
|
-
user: _objectSpread$
|
|
3937
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
|
|
3889
3938
|
});
|
|
3890
3939
|
break;
|
|
3891
3940
|
|
|
3892
3941
|
case 'user.unbanned':
|
|
3893
|
-
if (!((_event$
|
|
3894
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3942
|
+
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
3943
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3895
3944
|
shadow_banned: false,
|
|
3896
3945
|
banned: false,
|
|
3897
|
-
user: _objectSpread$
|
|
3946
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
3898
3947
|
});
|
|
3899
3948
|
break;
|
|
3900
3949
|
} // any event can send over the online count
|
|
@@ -3924,7 +3973,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3924
3973
|
|
|
3925
3974
|
|
|
3926
3975
|
if (state.members) {
|
|
3927
|
-
var _iterator = _createForOfIteratorHelper$
|
|
3976
|
+
var _iterator = _createForOfIteratorHelper$3(state.members),
|
|
3928
3977
|
_step;
|
|
3929
3978
|
|
|
3930
3979
|
try {
|
|
@@ -3968,7 +4017,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3968
4017
|
|
|
3969
4018
|
|
|
3970
4019
|
if (state.watchers) {
|
|
3971
|
-
var _iterator2 = _createForOfIteratorHelper$
|
|
4020
|
+
var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
|
|
3972
4021
|
_step2;
|
|
3973
4022
|
|
|
3974
4023
|
try {
|
|
@@ -4004,7 +4053,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4004
4053
|
|
|
4005
4054
|
|
|
4006
4055
|
if (state.read) {
|
|
4007
|
-
var _iterator3 = _createForOfIteratorHelper$
|
|
4056
|
+
var _iterator3 = _createForOfIteratorHelper$3(state.read),
|
|
4008
4057
|
_step3;
|
|
4009
4058
|
|
|
4010
4059
|
try {
|
|
@@ -4073,11 +4122,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4073
4122
|
return Channel;
|
|
4074
4123
|
}();
|
|
4075
4124
|
|
|
4076
|
-
function _createForOfIteratorHelper$
|
|
4125
|
+
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; } } }; }
|
|
4077
4126
|
|
|
4078
|
-
function _unsupportedIterableToArray$
|
|
4127
|
+
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); }
|
|
4079
4128
|
|
|
4080
|
-
function _arrayLikeToArray$
|
|
4129
|
+
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; }
|
|
4081
4130
|
|
|
4082
4131
|
/**
|
|
4083
4132
|
* ClientState - A container class for the client state.
|
|
@@ -4100,7 +4149,7 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4100
4149
|
_createClass(ClientState, [{
|
|
4101
4150
|
key: "updateUsers",
|
|
4102
4151
|
value: function updateUsers(users) {
|
|
4103
|
-
var _iterator = _createForOfIteratorHelper$
|
|
4152
|
+
var _iterator = _createForOfIteratorHelper$2(users),
|
|
4104
4153
|
_step;
|
|
4105
4154
|
|
|
4106
4155
|
try {
|
|
@@ -4148,9 +4197,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4148
4197
|
return ClientState;
|
|
4149
4198
|
}();
|
|
4150
4199
|
|
|
4151
|
-
function ownKeys$
|
|
4200
|
+
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; }
|
|
4152
4201
|
|
|
4153
|
-
function _objectSpread$
|
|
4202
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4154
4203
|
var InsightMetrics = function InsightMetrics() {
|
|
4155
4204
|
_classCallCheck(this, InsightMetrics);
|
|
4156
4205
|
|
|
@@ -4229,7 +4278,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
4229
4278
|
};
|
|
4230
4279
|
}();
|
|
4231
4280
|
function buildWsFatalInsight(connection, event) {
|
|
4232
|
-
return _objectSpread$
|
|
4281
|
+
return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
|
|
4233
4282
|
}
|
|
4234
4283
|
|
|
4235
4284
|
function buildWsBaseInsight(connection) {
|
|
@@ -4262,9 +4311,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
4262
4311
|
return buildWsBaseInsight(connection);
|
|
4263
4312
|
}
|
|
4264
4313
|
|
|
4265
|
-
function ownKeys$
|
|
4314
|
+
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; }
|
|
4266
4315
|
|
|
4267
|
-
function _objectSpread$
|
|
4316
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4268
4317
|
|
|
4269
4318
|
// Type guards to check WebSocket error type
|
|
4270
4319
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -4628,7 +4677,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4628
4677
|
value: function _log(msg) {
|
|
4629
4678
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4630
4679
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
4631
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
4680
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$4({
|
|
4632
4681
|
tags: ['connection']
|
|
4633
4682
|
}, extra));
|
|
4634
4683
|
}
|
|
@@ -5223,9 +5272,9 @@ var jwt = null;
|
|
|
5223
5272
|
|
|
5224
5273
|
var crypto$1 = null;
|
|
5225
5274
|
|
|
5226
|
-
function ownKeys$
|
|
5275
|
+
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; }
|
|
5227
5276
|
|
|
5228
|
-
function _objectSpread$
|
|
5277
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5229
5278
|
|
|
5230
5279
|
/**
|
|
5231
5280
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -5246,7 +5295,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
5246
5295
|
throw new TypeError('userId should be a string');
|
|
5247
5296
|
}
|
|
5248
5297
|
|
|
5249
|
-
var payload = _objectSpread$
|
|
5298
|
+
var payload = _objectSpread$3({
|
|
5250
5299
|
user_id: userId
|
|
5251
5300
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
5252
5301
|
|
|
@@ -5650,9 +5699,9 @@ function isErrorResponse(res) {
|
|
|
5650
5699
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
5651
5700
|
}
|
|
5652
5701
|
|
|
5653
|
-
function ownKeys$
|
|
5702
|
+
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; }
|
|
5654
5703
|
|
|
5655
|
-
function _objectSpread$
|
|
5704
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5656
5705
|
var ConnectionState;
|
|
5657
5706
|
|
|
5658
5707
|
(function (ConnectionState) {
|
|
@@ -5715,7 +5764,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5715
5764
|
_context.next = 4;
|
|
5716
5765
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
5717
5766
|
undefined, {
|
|
5718
|
-
config: _objectSpread$
|
|
5767
|
+
config: _objectSpread$2(_objectSpread$2({}, config), {}, {
|
|
5719
5768
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
5720
5769
|
}),
|
|
5721
5770
|
params: params
|
|
@@ -5993,7 +6042,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5993
6042
|
value: function _log(msg) {
|
|
5994
6043
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5995
6044
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
5996
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
6045
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
|
|
5997
6046
|
tags: ['connection_fallback', 'connection']
|
|
5998
6047
|
}, extra));
|
|
5999
6048
|
}
|
|
@@ -6040,6 +6089,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
6040
6089
|
/**
|
|
6041
6090
|
* Response Types
|
|
6042
6091
|
*/
|
|
6092
|
+
// TODO: Figure out a way to strongly type set and unset.
|
|
6043
6093
|
// Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
|
|
6044
6094
|
|
|
6045
6095
|
/**
|
|
@@ -6111,6 +6161,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
|
6111
6161
|
return ErrorFromResponse;
|
|
6112
6162
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
6113
6163
|
|
|
6164
|
+
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; }
|
|
6165
|
+
|
|
6166
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6167
|
+
|
|
6168
|
+
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; } } }; }
|
|
6169
|
+
|
|
6170
|
+
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); }
|
|
6171
|
+
|
|
6172
|
+
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; }
|
|
6173
|
+
var Thread = /*#__PURE__*/function () {
|
|
6174
|
+
function Thread(client, t) {
|
|
6175
|
+
_classCallCheck(this, Thread);
|
|
6176
|
+
|
|
6177
|
+
_defineProperty(this, "id", void 0);
|
|
6178
|
+
|
|
6179
|
+
_defineProperty(this, "latestReplies", []);
|
|
6180
|
+
|
|
6181
|
+
_defineProperty(this, "participants", []);
|
|
6182
|
+
|
|
6183
|
+
_defineProperty(this, "message", void 0);
|
|
6184
|
+
|
|
6185
|
+
_defineProperty(this, "channel", void 0);
|
|
6186
|
+
|
|
6187
|
+
_defineProperty(this, "_channel", void 0);
|
|
6188
|
+
|
|
6189
|
+
_defineProperty(this, "replyCount", 0);
|
|
6190
|
+
|
|
6191
|
+
_defineProperty(this, "_client", void 0);
|
|
6192
|
+
|
|
6193
|
+
_defineProperty(this, "read", {});
|
|
6194
|
+
|
|
6195
|
+
this.id = t.parent_message.id;
|
|
6196
|
+
this.message = formatMessage(t.parent_message);
|
|
6197
|
+
this.latestReplies = t.latest_replies.map(formatMessage);
|
|
6198
|
+
this.participants = t.thread_participants;
|
|
6199
|
+
this.replyCount = t.reply_count;
|
|
6200
|
+
this.channel = t.channel;
|
|
6201
|
+
this._channel = client.channel(t.channel.type, t.channel.id);
|
|
6202
|
+
this._client = client;
|
|
6203
|
+
|
|
6204
|
+
var _iterator = _createForOfIteratorHelper$1(t.read),
|
|
6205
|
+
_step;
|
|
6206
|
+
|
|
6207
|
+
try {
|
|
6208
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6209
|
+
var r = _step.value;
|
|
6210
|
+
this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
|
|
6211
|
+
last_read: new Date(r.last_read)
|
|
6212
|
+
});
|
|
6213
|
+
}
|
|
6214
|
+
} catch (err) {
|
|
6215
|
+
_iterator.e(err);
|
|
6216
|
+
} finally {
|
|
6217
|
+
_iterator.f();
|
|
6218
|
+
}
|
|
6219
|
+
}
|
|
6220
|
+
|
|
6221
|
+
_createClass(Thread, [{
|
|
6222
|
+
key: "getClient",
|
|
6223
|
+
value: function getClient() {
|
|
6224
|
+
return this._client;
|
|
6225
|
+
}
|
|
6226
|
+
}, {
|
|
6227
|
+
key: "addReply",
|
|
6228
|
+
value: function addReply(message) {
|
|
6229
|
+
this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
|
|
6230
|
+
}
|
|
6231
|
+
}, {
|
|
6232
|
+
key: "updateReply",
|
|
6233
|
+
value: function updateReply(message) {
|
|
6234
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6235
|
+
if (m.id === message.id) {
|
|
6236
|
+
return formatMessage(message);
|
|
6237
|
+
}
|
|
6238
|
+
|
|
6239
|
+
return m;
|
|
6240
|
+
});
|
|
6241
|
+
}
|
|
6242
|
+
}, {
|
|
6243
|
+
key: "updateMessageOrReplyIfExists",
|
|
6244
|
+
value: function updateMessageOrReplyIfExists(message) {
|
|
6245
|
+
if (!message.parent_id && message.id !== this.message.id) {
|
|
6246
|
+
return;
|
|
6247
|
+
}
|
|
6248
|
+
|
|
6249
|
+
if (message.parent_id && message.parent_id !== this.message.id) {
|
|
6250
|
+
return;
|
|
6251
|
+
}
|
|
6252
|
+
|
|
6253
|
+
if (message.parent_id && message.parent_id === this.message.id) {
|
|
6254
|
+
this.updateReply(message);
|
|
6255
|
+
}
|
|
6256
|
+
|
|
6257
|
+
if (!message.parent_id && message.id === this.message.id) {
|
|
6258
|
+
this.message = formatMessage(message);
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
}, {
|
|
6262
|
+
key: "addReaction",
|
|
6263
|
+
value: function addReaction(reaction, message, enforce_unique) {
|
|
6264
|
+
var _this = this;
|
|
6265
|
+
|
|
6266
|
+
if (!message) return;
|
|
6267
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6268
|
+
if (m.id === message.id) {
|
|
6269
|
+
return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
|
|
6270
|
+
}
|
|
6271
|
+
|
|
6272
|
+
return m;
|
|
6273
|
+
});
|
|
6274
|
+
}
|
|
6275
|
+
}, {
|
|
6276
|
+
key: "removeReaction",
|
|
6277
|
+
value: function removeReaction(reaction, message) {
|
|
6278
|
+
var _this2 = this;
|
|
6279
|
+
|
|
6280
|
+
if (!message) return;
|
|
6281
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6282
|
+
if (m.id === message.id) {
|
|
6283
|
+
return formatMessage(_this2._channel.state.removeReaction(reaction, message));
|
|
6284
|
+
}
|
|
6285
|
+
|
|
6286
|
+
return m;
|
|
6287
|
+
});
|
|
6288
|
+
}
|
|
6289
|
+
}]);
|
|
6290
|
+
|
|
6291
|
+
return Thread;
|
|
6292
|
+
}();
|
|
6293
|
+
|
|
6114
6294
|
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
6115
6295
|
_excluded2 = ["params", "headers"];
|
|
6116
6296
|
|
|
@@ -8455,6 +8635,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8455
8635
|
|
|
8456
8636
|
return getDevices;
|
|
8457
8637
|
}()
|
|
8638
|
+
/**
|
|
8639
|
+
* getUnreadCount - Returns unread counts for a single user
|
|
8640
|
+
*
|
|
8641
|
+
* @param {string} [userID] User ID.
|
|
8642
|
+
*
|
|
8643
|
+
* @return {<GetUnreadCountAPIResponse>}
|
|
8644
|
+
*/
|
|
8645
|
+
|
|
8458
8646
|
}, {
|
|
8459
8647
|
key: "getUnreadCount",
|
|
8460
8648
|
value: function () {
|
|
@@ -8476,14 +8664,52 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8476
8664
|
return _context24.stop();
|
|
8477
8665
|
}
|
|
8478
8666
|
}
|
|
8479
|
-
}, _callee24, this);
|
|
8667
|
+
}, _callee24, this);
|
|
8668
|
+
}));
|
|
8669
|
+
|
|
8670
|
+
function getUnreadCount(_x25) {
|
|
8671
|
+
return _getUnreadCount.apply(this, arguments);
|
|
8672
|
+
}
|
|
8673
|
+
|
|
8674
|
+
return getUnreadCount;
|
|
8675
|
+
}()
|
|
8676
|
+
/**
|
|
8677
|
+
* getUnreadCountBatch - Returns unread counts for multiple users at once. Only works server side.
|
|
8678
|
+
*
|
|
8679
|
+
* @param {string[]} [userIDs] List of user IDs to fetch unread counts for.
|
|
8680
|
+
*
|
|
8681
|
+
* @return {<GetUnreadCountBatchAPIResponse>}
|
|
8682
|
+
*/
|
|
8683
|
+
|
|
8684
|
+
}, {
|
|
8685
|
+
key: "getUnreadCountBatch",
|
|
8686
|
+
value: function () {
|
|
8687
|
+
var _getUnreadCountBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(userIDs) {
|
|
8688
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
8689
|
+
while (1) {
|
|
8690
|
+
switch (_context25.prev = _context25.next) {
|
|
8691
|
+
case 0:
|
|
8692
|
+
_context25.next = 2;
|
|
8693
|
+
return this.post(this.baseURL + '/unread_batch', {
|
|
8694
|
+
user_ids: userIDs
|
|
8695
|
+
});
|
|
8696
|
+
|
|
8697
|
+
case 2:
|
|
8698
|
+
return _context25.abrupt("return", _context25.sent);
|
|
8699
|
+
|
|
8700
|
+
case 3:
|
|
8701
|
+
case "end":
|
|
8702
|
+
return _context25.stop();
|
|
8703
|
+
}
|
|
8704
|
+
}
|
|
8705
|
+
}, _callee25, this);
|
|
8480
8706
|
}));
|
|
8481
8707
|
|
|
8482
|
-
function
|
|
8483
|
-
return
|
|
8708
|
+
function getUnreadCountBatch(_x26) {
|
|
8709
|
+
return _getUnreadCountBatch.apply(this, arguments);
|
|
8484
8710
|
}
|
|
8485
8711
|
|
|
8486
|
-
return
|
|
8712
|
+
return getUnreadCountBatch;
|
|
8487
8713
|
}()
|
|
8488
8714
|
/**
|
|
8489
8715
|
* removeDevice - Removes the device with the given id. Clientside users can only delete their own devices
|
|
@@ -8496,12 +8722,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8496
8722
|
}, {
|
|
8497
8723
|
key: "removeDevice",
|
|
8498
8724
|
value: function () {
|
|
8499
|
-
var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8500
|
-
return _regeneratorRuntime.wrap(function
|
|
8725
|
+
var _removeDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(id, userID) {
|
|
8726
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
8501
8727
|
while (1) {
|
|
8502
|
-
switch (
|
|
8728
|
+
switch (_context26.prev = _context26.next) {
|
|
8503
8729
|
case 0:
|
|
8504
|
-
|
|
8730
|
+
_context26.next = 2;
|
|
8505
8731
|
return this.delete(this.baseURL + '/devices', _objectSpread({
|
|
8506
8732
|
id: id
|
|
8507
8733
|
}, userID ? {
|
|
@@ -8509,17 +8735,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8509
8735
|
} : {}));
|
|
8510
8736
|
|
|
8511
8737
|
case 2:
|
|
8512
|
-
return
|
|
8738
|
+
return _context26.abrupt("return", _context26.sent);
|
|
8513
8739
|
|
|
8514
8740
|
case 3:
|
|
8515
8741
|
case "end":
|
|
8516
|
-
return
|
|
8742
|
+
return _context26.stop();
|
|
8517
8743
|
}
|
|
8518
8744
|
}
|
|
8519
|
-
},
|
|
8745
|
+
}, _callee26, this);
|
|
8520
8746
|
}));
|
|
8521
8747
|
|
|
8522
|
-
function removeDevice(
|
|
8748
|
+
function removeDevice(_x27, _x28) {
|
|
8523
8749
|
return _removeDevice.apply(this, arguments);
|
|
8524
8750
|
}
|
|
8525
8751
|
|
|
@@ -8536,15 +8762,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8536
8762
|
}, {
|
|
8537
8763
|
key: "getRateLimits",
|
|
8538
8764
|
value: function () {
|
|
8539
|
-
var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8765
|
+
var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(params) {
|
|
8540
8766
|
var _ref7, serverSide, web, android, ios, endpoints;
|
|
8541
8767
|
|
|
8542
|
-
return _regeneratorRuntime.wrap(function
|
|
8768
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
8543
8769
|
while (1) {
|
|
8544
|
-
switch (
|
|
8770
|
+
switch (_context27.prev = _context27.next) {
|
|
8545
8771
|
case 0:
|
|
8546
8772
|
_ref7 = params || {}, serverSide = _ref7.serverSide, web = _ref7.web, android = _ref7.android, ios = _ref7.ios, endpoints = _ref7.endpoints;
|
|
8547
|
-
return
|
|
8773
|
+
return _context27.abrupt("return", this.get(this.baseURL + '/rate_limits', {
|
|
8548
8774
|
server_side: serverSide,
|
|
8549
8775
|
web: web,
|
|
8550
8776
|
android: android,
|
|
@@ -8554,13 +8780,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8554
8780
|
|
|
8555
8781
|
case 2:
|
|
8556
8782
|
case "end":
|
|
8557
|
-
return
|
|
8783
|
+
return _context27.stop();
|
|
8558
8784
|
}
|
|
8559
8785
|
}
|
|
8560
|
-
},
|
|
8786
|
+
}, _callee27, this);
|
|
8561
8787
|
}));
|
|
8562
8788
|
|
|
8563
|
-
function getRateLimits(
|
|
8789
|
+
function getRateLimits(_x29) {
|
|
8564
8790
|
return _getRateLimits.apply(this, arguments);
|
|
8565
8791
|
}
|
|
8566
8792
|
|
|
@@ -8651,26 +8877,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8651
8877
|
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>} list of updated users
|
|
8652
8878
|
*/
|
|
8653
8879
|
function () {
|
|
8654
|
-
var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8655
|
-
return _regeneratorRuntime.wrap(function
|
|
8880
|
+
var _partialUpdateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28(partialUserObject) {
|
|
8881
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
8656
8882
|
while (1) {
|
|
8657
|
-
switch (
|
|
8883
|
+
switch (_context28.prev = _context28.next) {
|
|
8658
8884
|
case 0:
|
|
8659
|
-
|
|
8885
|
+
_context28.next = 2;
|
|
8660
8886
|
return this.partialUpdateUsers([partialUserObject]);
|
|
8661
8887
|
|
|
8662
8888
|
case 2:
|
|
8663
|
-
return
|
|
8889
|
+
return _context28.abrupt("return", _context28.sent);
|
|
8664
8890
|
|
|
8665
8891
|
case 3:
|
|
8666
8892
|
case "end":
|
|
8667
|
-
return
|
|
8893
|
+
return _context28.stop();
|
|
8668
8894
|
}
|
|
8669
8895
|
}
|
|
8670
|
-
},
|
|
8896
|
+
}, _callee28, this);
|
|
8671
8897
|
}));
|
|
8672
8898
|
|
|
8673
|
-
function partialUpdateUser(
|
|
8899
|
+
function partialUpdateUser(_x30) {
|
|
8674
8900
|
return _partialUpdateUser.apply(this, arguments);
|
|
8675
8901
|
}
|
|
8676
8902
|
|
|
@@ -8687,29 +8913,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8687
8913
|
}, {
|
|
8688
8914
|
key: "upsertUsers",
|
|
8689
8915
|
value: function () {
|
|
8690
|
-
var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8916
|
+
var _upsertUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(users) {
|
|
8691
8917
|
var userMap, _iterator4, _step4, userObject;
|
|
8692
8918
|
|
|
8693
|
-
return _regeneratorRuntime.wrap(function
|
|
8919
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
8694
8920
|
while (1) {
|
|
8695
|
-
switch (
|
|
8921
|
+
switch (_context29.prev = _context29.next) {
|
|
8696
8922
|
case 0:
|
|
8697
8923
|
userMap = {};
|
|
8698
8924
|
_iterator4 = _createForOfIteratorHelper(users);
|
|
8699
|
-
|
|
8925
|
+
_context29.prev = 2;
|
|
8700
8926
|
|
|
8701
8927
|
_iterator4.s();
|
|
8702
8928
|
|
|
8703
8929
|
case 4:
|
|
8704
8930
|
if ((_step4 = _iterator4.n()).done) {
|
|
8705
|
-
|
|
8931
|
+
_context29.next = 11;
|
|
8706
8932
|
break;
|
|
8707
8933
|
}
|
|
8708
8934
|
|
|
8709
8935
|
userObject = _step4.value;
|
|
8710
8936
|
|
|
8711
8937
|
if (userObject.id) {
|
|
8712
|
-
|
|
8938
|
+
_context29.next = 8;
|
|
8713
8939
|
break;
|
|
8714
8940
|
}
|
|
8715
8941
|
|
|
@@ -8719,44 +8945,44 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8719
8945
|
userMap[userObject.id] = userObject;
|
|
8720
8946
|
|
|
8721
8947
|
case 9:
|
|
8722
|
-
|
|
8948
|
+
_context29.next = 4;
|
|
8723
8949
|
break;
|
|
8724
8950
|
|
|
8725
8951
|
case 11:
|
|
8726
|
-
|
|
8952
|
+
_context29.next = 16;
|
|
8727
8953
|
break;
|
|
8728
8954
|
|
|
8729
8955
|
case 13:
|
|
8730
|
-
|
|
8731
|
-
|
|
8956
|
+
_context29.prev = 13;
|
|
8957
|
+
_context29.t0 = _context29["catch"](2);
|
|
8732
8958
|
|
|
8733
|
-
_iterator4.e(
|
|
8959
|
+
_iterator4.e(_context29.t0);
|
|
8734
8960
|
|
|
8735
8961
|
case 16:
|
|
8736
|
-
|
|
8962
|
+
_context29.prev = 16;
|
|
8737
8963
|
|
|
8738
8964
|
_iterator4.f();
|
|
8739
8965
|
|
|
8740
|
-
return
|
|
8966
|
+
return _context29.finish(16);
|
|
8741
8967
|
|
|
8742
8968
|
case 19:
|
|
8743
|
-
|
|
8969
|
+
_context29.next = 21;
|
|
8744
8970
|
return this.post(this.baseURL + '/users', {
|
|
8745
8971
|
users: userMap
|
|
8746
8972
|
});
|
|
8747
8973
|
|
|
8748
8974
|
case 21:
|
|
8749
|
-
return
|
|
8975
|
+
return _context29.abrupt("return", _context29.sent);
|
|
8750
8976
|
|
|
8751
8977
|
case 22:
|
|
8752
8978
|
case "end":
|
|
8753
|
-
return
|
|
8979
|
+
return _context29.stop();
|
|
8754
8980
|
}
|
|
8755
8981
|
}
|
|
8756
|
-
},
|
|
8982
|
+
}, _callee29, this, [[2, 13, 16, 19]]);
|
|
8757
8983
|
}));
|
|
8758
8984
|
|
|
8759
|
-
function upsertUsers(
|
|
8985
|
+
function upsertUsers(_x31) {
|
|
8760
8986
|
return _upsertUsers.apply(this, arguments);
|
|
8761
8987
|
}
|
|
8762
8988
|
|
|
@@ -8804,72 +9030,72 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8804
9030
|
* @return {Promise<{ users: { [key: string]: UserResponse<StreamChatGenerics> } }>}
|
|
8805
9031
|
*/
|
|
8806
9032
|
function () {
|
|
8807
|
-
var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9033
|
+
var _partialUpdateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(users) {
|
|
8808
9034
|
var _iterator5, _step5, userObject;
|
|
8809
9035
|
|
|
8810
|
-
return _regeneratorRuntime.wrap(function
|
|
9036
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
8811
9037
|
while (1) {
|
|
8812
|
-
switch (
|
|
9038
|
+
switch (_context30.prev = _context30.next) {
|
|
8813
9039
|
case 0:
|
|
8814
9040
|
_iterator5 = _createForOfIteratorHelper(users);
|
|
8815
|
-
|
|
9041
|
+
_context30.prev = 1;
|
|
8816
9042
|
|
|
8817
9043
|
_iterator5.s();
|
|
8818
9044
|
|
|
8819
9045
|
case 3:
|
|
8820
9046
|
if ((_step5 = _iterator5.n()).done) {
|
|
8821
|
-
|
|
9047
|
+
_context30.next = 9;
|
|
8822
9048
|
break;
|
|
8823
9049
|
}
|
|
8824
9050
|
|
|
8825
9051
|
userObject = _step5.value;
|
|
8826
9052
|
|
|
8827
9053
|
if (userObject.id) {
|
|
8828
|
-
|
|
9054
|
+
_context30.next = 7;
|
|
8829
9055
|
break;
|
|
8830
9056
|
}
|
|
8831
9057
|
|
|
8832
9058
|
throw Error('User ID is required when updating a user');
|
|
8833
9059
|
|
|
8834
9060
|
case 7:
|
|
8835
|
-
|
|
9061
|
+
_context30.next = 3;
|
|
8836
9062
|
break;
|
|
8837
9063
|
|
|
8838
9064
|
case 9:
|
|
8839
|
-
|
|
9065
|
+
_context30.next = 14;
|
|
8840
9066
|
break;
|
|
8841
9067
|
|
|
8842
9068
|
case 11:
|
|
8843
|
-
|
|
8844
|
-
|
|
9069
|
+
_context30.prev = 11;
|
|
9070
|
+
_context30.t0 = _context30["catch"](1);
|
|
8845
9071
|
|
|
8846
|
-
_iterator5.e(
|
|
9072
|
+
_iterator5.e(_context30.t0);
|
|
8847
9073
|
|
|
8848
9074
|
case 14:
|
|
8849
|
-
|
|
9075
|
+
_context30.prev = 14;
|
|
8850
9076
|
|
|
8851
9077
|
_iterator5.f();
|
|
8852
9078
|
|
|
8853
|
-
return
|
|
9079
|
+
return _context30.finish(14);
|
|
8854
9080
|
|
|
8855
9081
|
case 17:
|
|
8856
|
-
|
|
9082
|
+
_context30.next = 19;
|
|
8857
9083
|
return this.patch(this.baseURL + '/users', {
|
|
8858
9084
|
users: users
|
|
8859
9085
|
});
|
|
8860
9086
|
|
|
8861
9087
|
case 19:
|
|
8862
|
-
return
|
|
9088
|
+
return _context30.abrupt("return", _context30.sent);
|
|
8863
9089
|
|
|
8864
9090
|
case 20:
|
|
8865
9091
|
case "end":
|
|
8866
|
-
return
|
|
9092
|
+
return _context30.stop();
|
|
8867
9093
|
}
|
|
8868
9094
|
}
|
|
8869
|
-
},
|
|
9095
|
+
}, _callee30, this, [[1, 11, 14, 17]]);
|
|
8870
9096
|
}));
|
|
8871
9097
|
|
|
8872
|
-
function partialUpdateUsers(
|
|
9098
|
+
function partialUpdateUsers(_x32) {
|
|
8873
9099
|
return _partialUpdateUsers.apply(this, arguments);
|
|
8874
9100
|
}
|
|
8875
9101
|
|
|
@@ -8878,26 +9104,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8878
9104
|
}, {
|
|
8879
9105
|
key: "deleteUser",
|
|
8880
9106
|
value: function () {
|
|
8881
|
-
var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8882
|
-
return _regeneratorRuntime.wrap(function
|
|
9107
|
+
var _deleteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(userID, params) {
|
|
9108
|
+
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
8883
9109
|
while (1) {
|
|
8884
|
-
switch (
|
|
9110
|
+
switch (_context31.prev = _context31.next) {
|
|
8885
9111
|
case 0:
|
|
8886
|
-
|
|
9112
|
+
_context31.next = 2;
|
|
8887
9113
|
return this.delete(this.baseURL + "/users/".concat(userID), params);
|
|
8888
9114
|
|
|
8889
9115
|
case 2:
|
|
8890
|
-
return
|
|
9116
|
+
return _context31.abrupt("return", _context31.sent);
|
|
8891
9117
|
|
|
8892
9118
|
case 3:
|
|
8893
9119
|
case "end":
|
|
8894
|
-
return
|
|
9120
|
+
return _context31.stop();
|
|
8895
9121
|
}
|
|
8896
9122
|
}
|
|
8897
|
-
},
|
|
9123
|
+
}, _callee31, this);
|
|
8898
9124
|
}));
|
|
8899
9125
|
|
|
8900
|
-
function deleteUser(
|
|
9126
|
+
function deleteUser(_x33, _x34) {
|
|
8901
9127
|
return _deleteUser.apply(this, arguments);
|
|
8902
9128
|
}
|
|
8903
9129
|
|
|
@@ -8914,28 +9140,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8914
9140
|
}, {
|
|
8915
9141
|
key: "restoreUsers",
|
|
8916
9142
|
value: function () {
|
|
8917
|
-
var _restoreUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8918
|
-
return _regeneratorRuntime.wrap(function
|
|
9143
|
+
var _restoreUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(user_ids) {
|
|
9144
|
+
return _regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
8919
9145
|
while (1) {
|
|
8920
|
-
switch (
|
|
9146
|
+
switch (_context32.prev = _context32.next) {
|
|
8921
9147
|
case 0:
|
|
8922
|
-
|
|
9148
|
+
_context32.next = 2;
|
|
8923
9149
|
return this.post(this.baseURL + "/users/restore", {
|
|
8924
9150
|
user_ids: user_ids
|
|
8925
9151
|
});
|
|
8926
9152
|
|
|
8927
9153
|
case 2:
|
|
8928
|
-
return
|
|
9154
|
+
return _context32.abrupt("return", _context32.sent);
|
|
8929
9155
|
|
|
8930
9156
|
case 3:
|
|
8931
9157
|
case "end":
|
|
8932
|
-
return
|
|
9158
|
+
return _context32.stop();
|
|
8933
9159
|
}
|
|
8934
9160
|
}
|
|
8935
|
-
},
|
|
9161
|
+
}, _callee32, this);
|
|
8936
9162
|
}));
|
|
8937
9163
|
|
|
8938
|
-
function restoreUsers(
|
|
9164
|
+
function restoreUsers(_x35) {
|
|
8939
9165
|
return _restoreUsers.apply(this, arguments);
|
|
8940
9166
|
}
|
|
8941
9167
|
|
|
@@ -8953,26 +9179,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8953
9179
|
}, {
|
|
8954
9180
|
key: "reactivateUser",
|
|
8955
9181
|
value: function () {
|
|
8956
|
-
var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8957
|
-
return _regeneratorRuntime.wrap(function
|
|
9182
|
+
var _reactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(userID, options) {
|
|
9183
|
+
return _regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
8958
9184
|
while (1) {
|
|
8959
|
-
switch (
|
|
9185
|
+
switch (_context33.prev = _context33.next) {
|
|
8960
9186
|
case 0:
|
|
8961
|
-
|
|
9187
|
+
_context33.next = 2;
|
|
8962
9188
|
return this.post(this.baseURL + "/users/".concat(userID, "/reactivate"), _objectSpread({}, options));
|
|
8963
9189
|
|
|
8964
9190
|
case 2:
|
|
8965
|
-
return
|
|
9191
|
+
return _context33.abrupt("return", _context33.sent);
|
|
8966
9192
|
|
|
8967
9193
|
case 3:
|
|
8968
9194
|
case "end":
|
|
8969
|
-
return
|
|
9195
|
+
return _context33.stop();
|
|
8970
9196
|
}
|
|
8971
9197
|
}
|
|
8972
|
-
},
|
|
9198
|
+
}, _callee33, this);
|
|
8973
9199
|
}));
|
|
8974
9200
|
|
|
8975
|
-
function reactivateUser(
|
|
9201
|
+
function reactivateUser(_x36, _x37) {
|
|
8976
9202
|
return _reactivateUser.apply(this, arguments);
|
|
8977
9203
|
}
|
|
8978
9204
|
|
|
@@ -8990,28 +9216,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8990
9216
|
}, {
|
|
8991
9217
|
key: "reactivateUsers",
|
|
8992
9218
|
value: function () {
|
|
8993
|
-
var _reactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
8994
|
-
return _regeneratorRuntime.wrap(function
|
|
9219
|
+
var _reactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(user_ids, options) {
|
|
9220
|
+
return _regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
8995
9221
|
while (1) {
|
|
8996
|
-
switch (
|
|
9222
|
+
switch (_context34.prev = _context34.next) {
|
|
8997
9223
|
case 0:
|
|
8998
|
-
|
|
9224
|
+
_context34.next = 2;
|
|
8999
9225
|
return this.post(this.baseURL + "/users/reactivate", _objectSpread({
|
|
9000
9226
|
user_ids: user_ids
|
|
9001
9227
|
}, options));
|
|
9002
9228
|
|
|
9003
9229
|
case 2:
|
|
9004
|
-
return
|
|
9230
|
+
return _context34.abrupt("return", _context34.sent);
|
|
9005
9231
|
|
|
9006
9232
|
case 3:
|
|
9007
9233
|
case "end":
|
|
9008
|
-
return
|
|
9234
|
+
return _context34.stop();
|
|
9009
9235
|
}
|
|
9010
9236
|
}
|
|
9011
|
-
},
|
|
9237
|
+
}, _callee34, this);
|
|
9012
9238
|
}));
|
|
9013
9239
|
|
|
9014
|
-
function reactivateUsers(
|
|
9240
|
+
function reactivateUsers(_x38, _x39) {
|
|
9015
9241
|
return _reactivateUsers.apply(this, arguments);
|
|
9016
9242
|
}
|
|
9017
9243
|
|
|
@@ -9029,26 +9255,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9029
9255
|
}, {
|
|
9030
9256
|
key: "deactivateUser",
|
|
9031
9257
|
value: function () {
|
|
9032
|
-
var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9033
|
-
return _regeneratorRuntime.wrap(function
|
|
9258
|
+
var _deactivateUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35(userID, options) {
|
|
9259
|
+
return _regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
9034
9260
|
while (1) {
|
|
9035
|
-
switch (
|
|
9261
|
+
switch (_context35.prev = _context35.next) {
|
|
9036
9262
|
case 0:
|
|
9037
|
-
|
|
9263
|
+
_context35.next = 2;
|
|
9038
9264
|
return this.post(this.baseURL + "/users/".concat(userID, "/deactivate"), _objectSpread({}, options));
|
|
9039
9265
|
|
|
9040
9266
|
case 2:
|
|
9041
|
-
return
|
|
9267
|
+
return _context35.abrupt("return", _context35.sent);
|
|
9042
9268
|
|
|
9043
9269
|
case 3:
|
|
9044
9270
|
case "end":
|
|
9045
|
-
return
|
|
9271
|
+
return _context35.stop();
|
|
9046
9272
|
}
|
|
9047
9273
|
}
|
|
9048
|
-
},
|
|
9274
|
+
}, _callee35, this);
|
|
9049
9275
|
}));
|
|
9050
9276
|
|
|
9051
|
-
function deactivateUser(
|
|
9277
|
+
function deactivateUser(_x40, _x41) {
|
|
9052
9278
|
return _deactivateUser.apply(this, arguments);
|
|
9053
9279
|
}
|
|
9054
9280
|
|
|
@@ -9066,28 +9292,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9066
9292
|
}, {
|
|
9067
9293
|
key: "deactivateUsers",
|
|
9068
9294
|
value: function () {
|
|
9069
|
-
var _deactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9070
|
-
return _regeneratorRuntime.wrap(function
|
|
9295
|
+
var _deactivateUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(user_ids, options) {
|
|
9296
|
+
return _regeneratorRuntime.wrap(function _callee36$(_context36) {
|
|
9071
9297
|
while (1) {
|
|
9072
|
-
switch (
|
|
9298
|
+
switch (_context36.prev = _context36.next) {
|
|
9073
9299
|
case 0:
|
|
9074
|
-
|
|
9300
|
+
_context36.next = 2;
|
|
9075
9301
|
return this.post(this.baseURL + "/users/deactivate", _objectSpread({
|
|
9076
9302
|
user_ids: user_ids
|
|
9077
9303
|
}, options));
|
|
9078
9304
|
|
|
9079
9305
|
case 2:
|
|
9080
|
-
return
|
|
9306
|
+
return _context36.abrupt("return", _context36.sent);
|
|
9081
9307
|
|
|
9082
9308
|
case 3:
|
|
9083
9309
|
case "end":
|
|
9084
|
-
return
|
|
9310
|
+
return _context36.stop();
|
|
9085
9311
|
}
|
|
9086
9312
|
}
|
|
9087
|
-
},
|
|
9313
|
+
}, _callee36, this);
|
|
9088
9314
|
}));
|
|
9089
9315
|
|
|
9090
|
-
function deactivateUsers(
|
|
9316
|
+
function deactivateUsers(_x42, _x43) {
|
|
9091
9317
|
return _deactivateUsers.apply(this, arguments);
|
|
9092
9318
|
}
|
|
9093
9319
|
|
|
@@ -9096,26 +9322,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9096
9322
|
}, {
|
|
9097
9323
|
key: "exportUser",
|
|
9098
9324
|
value: function () {
|
|
9099
|
-
var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9100
|
-
return _regeneratorRuntime.wrap(function
|
|
9325
|
+
var _exportUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(userID, options) {
|
|
9326
|
+
return _regeneratorRuntime.wrap(function _callee37$(_context37) {
|
|
9101
9327
|
while (1) {
|
|
9102
|
-
switch (
|
|
9328
|
+
switch (_context37.prev = _context37.next) {
|
|
9103
9329
|
case 0:
|
|
9104
|
-
|
|
9330
|
+
_context37.next = 2;
|
|
9105
9331
|
return this.get(this.baseURL + "/users/".concat(userID, "/export"), _objectSpread({}, options));
|
|
9106
9332
|
|
|
9107
9333
|
case 2:
|
|
9108
|
-
return
|
|
9334
|
+
return _context37.abrupt("return", _context37.sent);
|
|
9109
9335
|
|
|
9110
9336
|
case 3:
|
|
9111
9337
|
case "end":
|
|
9112
|
-
return
|
|
9338
|
+
return _context37.stop();
|
|
9113
9339
|
}
|
|
9114
9340
|
}
|
|
9115
|
-
},
|
|
9341
|
+
}, _callee37, this);
|
|
9116
9342
|
}));
|
|
9117
9343
|
|
|
9118
|
-
function exportUser(
|
|
9344
|
+
function exportUser(_x44, _x45) {
|
|
9119
9345
|
return _exportUser.apply(this, arguments);
|
|
9120
9346
|
}
|
|
9121
9347
|
|
|
@@ -9131,28 +9357,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9131
9357
|
}, {
|
|
9132
9358
|
key: "banUser",
|
|
9133
9359
|
value: function () {
|
|
9134
|
-
var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9135
|
-
return _regeneratorRuntime.wrap(function
|
|
9360
|
+
var _banUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38(targetUserID, options) {
|
|
9361
|
+
return _regeneratorRuntime.wrap(function _callee38$(_context38) {
|
|
9136
9362
|
while (1) {
|
|
9137
|
-
switch (
|
|
9363
|
+
switch (_context38.prev = _context38.next) {
|
|
9138
9364
|
case 0:
|
|
9139
|
-
|
|
9365
|
+
_context38.next = 2;
|
|
9140
9366
|
return this.post(this.baseURL + '/moderation/ban', _objectSpread({
|
|
9141
9367
|
target_user_id: targetUserID
|
|
9142
9368
|
}, options));
|
|
9143
9369
|
|
|
9144
9370
|
case 2:
|
|
9145
|
-
return
|
|
9371
|
+
return _context38.abrupt("return", _context38.sent);
|
|
9146
9372
|
|
|
9147
9373
|
case 3:
|
|
9148
9374
|
case "end":
|
|
9149
|
-
return
|
|
9375
|
+
return _context38.stop();
|
|
9150
9376
|
}
|
|
9151
9377
|
}
|
|
9152
|
-
},
|
|
9378
|
+
}, _callee38, this);
|
|
9153
9379
|
}));
|
|
9154
9380
|
|
|
9155
|
-
function banUser(
|
|
9381
|
+
function banUser(_x46, _x47) {
|
|
9156
9382
|
return _banUser.apply(this, arguments);
|
|
9157
9383
|
}
|
|
9158
9384
|
|
|
@@ -9168,28 +9394,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9168
9394
|
}, {
|
|
9169
9395
|
key: "unbanUser",
|
|
9170
9396
|
value: function () {
|
|
9171
|
-
var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9172
|
-
return _regeneratorRuntime.wrap(function
|
|
9397
|
+
var _unbanUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(targetUserID, options) {
|
|
9398
|
+
return _regeneratorRuntime.wrap(function _callee39$(_context39) {
|
|
9173
9399
|
while (1) {
|
|
9174
|
-
switch (
|
|
9400
|
+
switch (_context39.prev = _context39.next) {
|
|
9175
9401
|
case 0:
|
|
9176
|
-
|
|
9402
|
+
_context39.next = 2;
|
|
9177
9403
|
return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
|
|
9178
9404
|
target_user_id: targetUserID
|
|
9179
9405
|
}, options));
|
|
9180
9406
|
|
|
9181
9407
|
case 2:
|
|
9182
|
-
return
|
|
9408
|
+
return _context39.abrupt("return", _context39.sent);
|
|
9183
9409
|
|
|
9184
9410
|
case 3:
|
|
9185
9411
|
case "end":
|
|
9186
|
-
return
|
|
9412
|
+
return _context39.stop();
|
|
9187
9413
|
}
|
|
9188
9414
|
}
|
|
9189
|
-
},
|
|
9415
|
+
}, _callee39, this);
|
|
9190
9416
|
}));
|
|
9191
9417
|
|
|
9192
|
-
function unbanUser(
|
|
9418
|
+
function unbanUser(_x48, _x49) {
|
|
9193
9419
|
return _unbanUser.apply(this, arguments);
|
|
9194
9420
|
}
|
|
9195
9421
|
|
|
@@ -9205,28 +9431,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9205
9431
|
}, {
|
|
9206
9432
|
key: "shadowBan",
|
|
9207
9433
|
value: function () {
|
|
9208
|
-
var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9209
|
-
return _regeneratorRuntime.wrap(function
|
|
9434
|
+
var _shadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(targetUserID, options) {
|
|
9435
|
+
return _regeneratorRuntime.wrap(function _callee40$(_context40) {
|
|
9210
9436
|
while (1) {
|
|
9211
|
-
switch (
|
|
9437
|
+
switch (_context40.prev = _context40.next) {
|
|
9212
9438
|
case 0:
|
|
9213
|
-
|
|
9439
|
+
_context40.next = 2;
|
|
9214
9440
|
return this.banUser(targetUserID, _objectSpread({
|
|
9215
9441
|
shadow: true
|
|
9216
9442
|
}, options));
|
|
9217
9443
|
|
|
9218
9444
|
case 2:
|
|
9219
|
-
return
|
|
9445
|
+
return _context40.abrupt("return", _context40.sent);
|
|
9220
9446
|
|
|
9221
9447
|
case 3:
|
|
9222
9448
|
case "end":
|
|
9223
|
-
return
|
|
9449
|
+
return _context40.stop();
|
|
9224
9450
|
}
|
|
9225
9451
|
}
|
|
9226
|
-
},
|
|
9452
|
+
}, _callee40, this);
|
|
9227
9453
|
}));
|
|
9228
9454
|
|
|
9229
|
-
function shadowBan(
|
|
9455
|
+
function shadowBan(_x50, _x51) {
|
|
9230
9456
|
return _shadowBan.apply(this, arguments);
|
|
9231
9457
|
}
|
|
9232
9458
|
|
|
@@ -9242,28 +9468,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9242
9468
|
}, {
|
|
9243
9469
|
key: "removeShadowBan",
|
|
9244
9470
|
value: function () {
|
|
9245
|
-
var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9246
|
-
return _regeneratorRuntime.wrap(function
|
|
9471
|
+
var _removeShadowBan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(targetUserID, options) {
|
|
9472
|
+
return _regeneratorRuntime.wrap(function _callee41$(_context41) {
|
|
9247
9473
|
while (1) {
|
|
9248
|
-
switch (
|
|
9474
|
+
switch (_context41.prev = _context41.next) {
|
|
9249
9475
|
case 0:
|
|
9250
|
-
|
|
9476
|
+
_context41.next = 2;
|
|
9251
9477
|
return this.unbanUser(targetUserID, _objectSpread({
|
|
9252
9478
|
shadow: true
|
|
9253
9479
|
}, options));
|
|
9254
9480
|
|
|
9255
9481
|
case 2:
|
|
9256
|
-
return
|
|
9482
|
+
return _context41.abrupt("return", _context41.sent);
|
|
9257
9483
|
|
|
9258
9484
|
case 3:
|
|
9259
9485
|
case "end":
|
|
9260
|
-
return
|
|
9486
|
+
return _context41.stop();
|
|
9261
9487
|
}
|
|
9262
9488
|
}
|
|
9263
|
-
},
|
|
9489
|
+
}, _callee41, this);
|
|
9264
9490
|
}));
|
|
9265
9491
|
|
|
9266
|
-
function removeShadowBan(
|
|
9492
|
+
function removeShadowBan(_x52, _x53) {
|
|
9267
9493
|
return _removeShadowBan.apply(this, arguments);
|
|
9268
9494
|
}
|
|
9269
9495
|
|
|
@@ -9280,15 +9506,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9280
9506
|
}, {
|
|
9281
9507
|
key: "muteUser",
|
|
9282
9508
|
value: function () {
|
|
9283
|
-
var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9509
|
+
var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(targetID, userID) {
|
|
9284
9510
|
var options,
|
|
9285
|
-
|
|
9286
|
-
return _regeneratorRuntime.wrap(function
|
|
9511
|
+
_args42 = arguments;
|
|
9512
|
+
return _regeneratorRuntime.wrap(function _callee42$(_context42) {
|
|
9287
9513
|
while (1) {
|
|
9288
|
-
switch (
|
|
9514
|
+
switch (_context42.prev = _context42.next) {
|
|
9289
9515
|
case 0:
|
|
9290
|
-
options =
|
|
9291
|
-
|
|
9516
|
+
options = _args42.length > 2 && _args42[2] !== undefined ? _args42[2] : {};
|
|
9517
|
+
_context42.next = 3;
|
|
9292
9518
|
return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
|
|
9293
9519
|
target_id: targetID
|
|
9294
9520
|
}, userID ? {
|
|
@@ -9296,17 +9522,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9296
9522
|
} : {}), options));
|
|
9297
9523
|
|
|
9298
9524
|
case 3:
|
|
9299
|
-
return
|
|
9525
|
+
return _context42.abrupt("return", _context42.sent);
|
|
9300
9526
|
|
|
9301
9527
|
case 4:
|
|
9302
9528
|
case "end":
|
|
9303
|
-
return
|
|
9529
|
+
return _context42.stop();
|
|
9304
9530
|
}
|
|
9305
9531
|
}
|
|
9306
|
-
},
|
|
9532
|
+
}, _callee42, this);
|
|
9307
9533
|
}));
|
|
9308
9534
|
|
|
9309
|
-
function muteUser(
|
|
9535
|
+
function muteUser(_x54, _x55) {
|
|
9310
9536
|
return _muteUser.apply(this, arguments);
|
|
9311
9537
|
}
|
|
9312
9538
|
|
|
@@ -9322,12 +9548,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9322
9548
|
}, {
|
|
9323
9549
|
key: "unmuteUser",
|
|
9324
9550
|
value: function () {
|
|
9325
|
-
var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9326
|
-
return _regeneratorRuntime.wrap(function
|
|
9551
|
+
var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(targetID, currentUserID) {
|
|
9552
|
+
return _regeneratorRuntime.wrap(function _callee43$(_context43) {
|
|
9327
9553
|
while (1) {
|
|
9328
|
-
switch (
|
|
9554
|
+
switch (_context43.prev = _context43.next) {
|
|
9329
9555
|
case 0:
|
|
9330
|
-
|
|
9556
|
+
_context43.next = 2;
|
|
9331
9557
|
return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
|
|
9332
9558
|
target_id: targetID
|
|
9333
9559
|
}, currentUserID ? {
|
|
@@ -9335,17 +9561,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9335
9561
|
} : {}));
|
|
9336
9562
|
|
|
9337
9563
|
case 2:
|
|
9338
|
-
return
|
|
9564
|
+
return _context43.abrupt("return", _context43.sent);
|
|
9339
9565
|
|
|
9340
9566
|
case 3:
|
|
9341
9567
|
case "end":
|
|
9342
|
-
return
|
|
9568
|
+
return _context43.stop();
|
|
9343
9569
|
}
|
|
9344
9570
|
}
|
|
9345
|
-
},
|
|
9571
|
+
}, _callee43, this);
|
|
9346
9572
|
}));
|
|
9347
9573
|
|
|
9348
|
-
function unmuteUser(
|
|
9574
|
+
function unmuteUser(_x56, _x57) {
|
|
9349
9575
|
return _unmuteUser.apply(this, arguments);
|
|
9350
9576
|
}
|
|
9351
9577
|
|
|
@@ -9380,31 +9606,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9380
9606
|
}, {
|
|
9381
9607
|
key: "flagMessage",
|
|
9382
9608
|
value: function () {
|
|
9383
|
-
var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9609
|
+
var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(targetMessageID) {
|
|
9384
9610
|
var options,
|
|
9385
|
-
|
|
9386
|
-
return _regeneratorRuntime.wrap(function
|
|
9611
|
+
_args44 = arguments;
|
|
9612
|
+
return _regeneratorRuntime.wrap(function _callee44$(_context44) {
|
|
9387
9613
|
while (1) {
|
|
9388
|
-
switch (
|
|
9614
|
+
switch (_context44.prev = _context44.next) {
|
|
9389
9615
|
case 0:
|
|
9390
|
-
options =
|
|
9391
|
-
|
|
9616
|
+
options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
|
|
9617
|
+
_context44.next = 3;
|
|
9392
9618
|
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
9393
9619
|
target_message_id: targetMessageID
|
|
9394
9620
|
}, options));
|
|
9395
9621
|
|
|
9396
9622
|
case 3:
|
|
9397
|
-
return
|
|
9623
|
+
return _context44.abrupt("return", _context44.sent);
|
|
9398
9624
|
|
|
9399
9625
|
case 4:
|
|
9400
9626
|
case "end":
|
|
9401
|
-
return
|
|
9627
|
+
return _context44.stop();
|
|
9402
9628
|
}
|
|
9403
9629
|
}
|
|
9404
|
-
},
|
|
9630
|
+
}, _callee44, this);
|
|
9405
9631
|
}));
|
|
9406
9632
|
|
|
9407
|
-
function flagMessage(
|
|
9633
|
+
function flagMessage(_x58) {
|
|
9408
9634
|
return _flagMessage.apply(this, arguments);
|
|
9409
9635
|
}
|
|
9410
9636
|
|
|
@@ -9420,31 +9646,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9420
9646
|
}, {
|
|
9421
9647
|
key: "flagUser",
|
|
9422
9648
|
value: function () {
|
|
9423
|
-
var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9649
|
+
var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(targetID) {
|
|
9424
9650
|
var options,
|
|
9425
|
-
|
|
9426
|
-
return _regeneratorRuntime.wrap(function
|
|
9651
|
+
_args45 = arguments;
|
|
9652
|
+
return _regeneratorRuntime.wrap(function _callee45$(_context45) {
|
|
9427
9653
|
while (1) {
|
|
9428
|
-
switch (
|
|
9654
|
+
switch (_context45.prev = _context45.next) {
|
|
9429
9655
|
case 0:
|
|
9430
|
-
options =
|
|
9431
|
-
|
|
9656
|
+
options = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {};
|
|
9657
|
+
_context45.next = 3;
|
|
9432
9658
|
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
9433
9659
|
target_user_id: targetID
|
|
9434
9660
|
}, options));
|
|
9435
9661
|
|
|
9436
9662
|
case 3:
|
|
9437
|
-
return
|
|
9663
|
+
return _context45.abrupt("return", _context45.sent);
|
|
9438
9664
|
|
|
9439
9665
|
case 4:
|
|
9440
9666
|
case "end":
|
|
9441
|
-
return
|
|
9667
|
+
return _context45.stop();
|
|
9442
9668
|
}
|
|
9443
9669
|
}
|
|
9444
|
-
},
|
|
9670
|
+
}, _callee45, this);
|
|
9445
9671
|
}));
|
|
9446
9672
|
|
|
9447
|
-
function flagUser(
|
|
9673
|
+
function flagUser(_x59) {
|
|
9448
9674
|
return _flagUser.apply(this, arguments);
|
|
9449
9675
|
}
|
|
9450
9676
|
|
|
@@ -9460,31 +9686,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9460
9686
|
}, {
|
|
9461
9687
|
key: "unflagMessage",
|
|
9462
9688
|
value: function () {
|
|
9463
|
-
var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9689
|
+
var _unflagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(targetMessageID) {
|
|
9464
9690
|
var options,
|
|
9465
|
-
|
|
9466
|
-
return _regeneratorRuntime.wrap(function
|
|
9691
|
+
_args46 = arguments;
|
|
9692
|
+
return _regeneratorRuntime.wrap(function _callee46$(_context46) {
|
|
9467
9693
|
while (1) {
|
|
9468
|
-
switch (
|
|
9694
|
+
switch (_context46.prev = _context46.next) {
|
|
9469
9695
|
case 0:
|
|
9470
|
-
options =
|
|
9471
|
-
|
|
9696
|
+
options = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {};
|
|
9697
|
+
_context46.next = 3;
|
|
9472
9698
|
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
9473
9699
|
target_message_id: targetMessageID
|
|
9474
9700
|
}, options));
|
|
9475
9701
|
|
|
9476
9702
|
case 3:
|
|
9477
|
-
return
|
|
9703
|
+
return _context46.abrupt("return", _context46.sent);
|
|
9478
9704
|
|
|
9479
9705
|
case 4:
|
|
9480
9706
|
case "end":
|
|
9481
|
-
return
|
|
9707
|
+
return _context46.stop();
|
|
9482
9708
|
}
|
|
9483
9709
|
}
|
|
9484
|
-
},
|
|
9710
|
+
}, _callee46, this);
|
|
9485
9711
|
}));
|
|
9486
9712
|
|
|
9487
|
-
function unflagMessage(
|
|
9713
|
+
function unflagMessage(_x60) {
|
|
9488
9714
|
return _unflagMessage.apply(this, arguments);
|
|
9489
9715
|
}
|
|
9490
9716
|
|
|
@@ -9500,31 +9726,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9500
9726
|
}, {
|
|
9501
9727
|
key: "unflagUser",
|
|
9502
9728
|
value: function () {
|
|
9503
|
-
var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9729
|
+
var _unflagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(targetID) {
|
|
9504
9730
|
var options,
|
|
9505
|
-
|
|
9506
|
-
return _regeneratorRuntime.wrap(function
|
|
9731
|
+
_args47 = arguments;
|
|
9732
|
+
return _regeneratorRuntime.wrap(function _callee47$(_context47) {
|
|
9507
9733
|
while (1) {
|
|
9508
|
-
switch (
|
|
9734
|
+
switch (_context47.prev = _context47.next) {
|
|
9509
9735
|
case 0:
|
|
9510
|
-
options =
|
|
9511
|
-
|
|
9736
|
+
options = _args47.length > 1 && _args47[1] !== undefined ? _args47[1] : {};
|
|
9737
|
+
_context47.next = 3;
|
|
9512
9738
|
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
9513
9739
|
target_user_id: targetID
|
|
9514
9740
|
}, options));
|
|
9515
9741
|
|
|
9516
9742
|
case 3:
|
|
9517
|
-
return
|
|
9743
|
+
return _context47.abrupt("return", _context47.sent);
|
|
9518
9744
|
|
|
9519
9745
|
case 4:
|
|
9520
9746
|
case "end":
|
|
9521
|
-
return
|
|
9747
|
+
return _context47.stop();
|
|
9522
9748
|
}
|
|
9523
9749
|
}
|
|
9524
|
-
},
|
|
9750
|
+
}, _callee47, this);
|
|
9525
9751
|
}));
|
|
9526
9752
|
|
|
9527
|
-
function unflagUser(
|
|
9753
|
+
function unflagUser(_x61) {
|
|
9528
9754
|
return _unflagUser.apply(this, arguments);
|
|
9529
9755
|
}
|
|
9530
9756
|
|
|
@@ -9541,29 +9767,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9541
9767
|
}, {
|
|
9542
9768
|
key: "getCallToken",
|
|
9543
9769
|
value: function () {
|
|
9544
|
-
var _getCallToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9770
|
+
var _getCallToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(callID) {
|
|
9545
9771
|
var options,
|
|
9546
|
-
|
|
9547
|
-
return _regeneratorRuntime.wrap(function
|
|
9772
|
+
_args48 = arguments;
|
|
9773
|
+
return _regeneratorRuntime.wrap(function _callee48$(_context48) {
|
|
9548
9774
|
while (1) {
|
|
9549
|
-
switch (
|
|
9775
|
+
switch (_context48.prev = _context48.next) {
|
|
9550
9776
|
case 0:
|
|
9551
|
-
options =
|
|
9552
|
-
|
|
9777
|
+
options = _args48.length > 1 && _args48[1] !== undefined ? _args48[1] : {};
|
|
9778
|
+
_context48.next = 3;
|
|
9553
9779
|
return this.post(this.baseURL + "/calls/".concat(callID), _objectSpread({}, options));
|
|
9554
9780
|
|
|
9555
9781
|
case 3:
|
|
9556
|
-
return
|
|
9782
|
+
return _context48.abrupt("return", _context48.sent);
|
|
9557
9783
|
|
|
9558
9784
|
case 4:
|
|
9559
9785
|
case "end":
|
|
9560
|
-
return
|
|
9786
|
+
return _context48.stop();
|
|
9561
9787
|
}
|
|
9562
9788
|
}
|
|
9563
|
-
},
|
|
9789
|
+
}, _callee48, this);
|
|
9564
9790
|
}));
|
|
9565
9791
|
|
|
9566
|
-
function getCallToken(
|
|
9792
|
+
function getCallToken(_x62) {
|
|
9567
9793
|
return _getCallToken.apply(this, arguments);
|
|
9568
9794
|
}
|
|
9569
9795
|
|
|
@@ -9586,30 +9812,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9586
9812
|
}, {
|
|
9587
9813
|
key: "_queryFlags",
|
|
9588
9814
|
value: function () {
|
|
9589
|
-
var _queryFlags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9815
|
+
var _queryFlags2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49() {
|
|
9590
9816
|
var filterConditions,
|
|
9591
9817
|
options,
|
|
9592
|
-
|
|
9593
|
-
return _regeneratorRuntime.wrap(function
|
|
9818
|
+
_args49 = arguments;
|
|
9819
|
+
return _regeneratorRuntime.wrap(function _callee49$(_context49) {
|
|
9594
9820
|
while (1) {
|
|
9595
|
-
switch (
|
|
9821
|
+
switch (_context49.prev = _context49.next) {
|
|
9596
9822
|
case 0:
|
|
9597
|
-
filterConditions =
|
|
9598
|
-
options =
|
|
9599
|
-
|
|
9823
|
+
filterConditions = _args49.length > 0 && _args49[0] !== undefined ? _args49[0] : {};
|
|
9824
|
+
options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
|
|
9825
|
+
_context49.next = 4;
|
|
9600
9826
|
return this.post(this.baseURL + '/moderation/flags', _objectSpread({
|
|
9601
9827
|
filter_conditions: filterConditions
|
|
9602
9828
|
}, options));
|
|
9603
9829
|
|
|
9604
9830
|
case 4:
|
|
9605
|
-
return
|
|
9831
|
+
return _context49.abrupt("return", _context49.sent);
|
|
9606
9832
|
|
|
9607
9833
|
case 5:
|
|
9608
9834
|
case "end":
|
|
9609
|
-
return
|
|
9835
|
+
return _context49.stop();
|
|
9610
9836
|
}
|
|
9611
9837
|
}
|
|
9612
|
-
},
|
|
9838
|
+
}, _callee49, this);
|
|
9613
9839
|
}));
|
|
9614
9840
|
|
|
9615
9841
|
function _queryFlags() {
|
|
@@ -9635,30 +9861,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9635
9861
|
}, {
|
|
9636
9862
|
key: "_queryFlagReports",
|
|
9637
9863
|
value: function () {
|
|
9638
|
-
var _queryFlagReports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9864
|
+
var _queryFlagReports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50() {
|
|
9639
9865
|
var filterConditions,
|
|
9640
9866
|
options,
|
|
9641
|
-
|
|
9642
|
-
return _regeneratorRuntime.wrap(function
|
|
9867
|
+
_args50 = arguments;
|
|
9868
|
+
return _regeneratorRuntime.wrap(function _callee50$(_context50) {
|
|
9643
9869
|
while (1) {
|
|
9644
|
-
switch (
|
|
9870
|
+
switch (_context50.prev = _context50.next) {
|
|
9645
9871
|
case 0:
|
|
9646
|
-
filterConditions =
|
|
9647
|
-
options =
|
|
9648
|
-
|
|
9872
|
+
filterConditions = _args50.length > 0 && _args50[0] !== undefined ? _args50[0] : {};
|
|
9873
|
+
options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
|
|
9874
|
+
_context50.next = 4;
|
|
9649
9875
|
return this.post(this.baseURL + '/moderation/reports', _objectSpread({
|
|
9650
9876
|
filter_conditions: filterConditions
|
|
9651
9877
|
}, options));
|
|
9652
9878
|
|
|
9653
9879
|
case 4:
|
|
9654
|
-
return
|
|
9880
|
+
return _context50.abrupt("return", _context50.sent);
|
|
9655
9881
|
|
|
9656
9882
|
case 5:
|
|
9657
9883
|
case "end":
|
|
9658
|
-
return
|
|
9884
|
+
return _context50.stop();
|
|
9659
9885
|
}
|
|
9660
9886
|
}
|
|
9661
|
-
},
|
|
9887
|
+
}, _callee50, this);
|
|
9662
9888
|
}));
|
|
9663
9889
|
|
|
9664
9890
|
function _queryFlagReports() {
|
|
@@ -9685,31 +9911,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9685
9911
|
}, {
|
|
9686
9912
|
key: "_reviewFlagReport",
|
|
9687
9913
|
value: function () {
|
|
9688
|
-
var _reviewFlagReport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9914
|
+
var _reviewFlagReport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(id, reviewResult) {
|
|
9689
9915
|
var options,
|
|
9690
|
-
|
|
9691
|
-
return _regeneratorRuntime.wrap(function
|
|
9916
|
+
_args51 = arguments;
|
|
9917
|
+
return _regeneratorRuntime.wrap(function _callee51$(_context51) {
|
|
9692
9918
|
while (1) {
|
|
9693
|
-
switch (
|
|
9919
|
+
switch (_context51.prev = _context51.next) {
|
|
9694
9920
|
case 0:
|
|
9695
|
-
options =
|
|
9696
|
-
|
|
9921
|
+
options = _args51.length > 2 && _args51[2] !== undefined ? _args51[2] : {};
|
|
9922
|
+
_context51.next = 3;
|
|
9697
9923
|
return this.patch(this.baseURL + "/moderation/reports/".concat(id), _objectSpread({
|
|
9698
9924
|
review_result: reviewResult
|
|
9699
9925
|
}, options));
|
|
9700
9926
|
|
|
9701
9927
|
case 3:
|
|
9702
|
-
return
|
|
9928
|
+
return _context51.abrupt("return", _context51.sent);
|
|
9703
9929
|
|
|
9704
9930
|
case 4:
|
|
9705
9931
|
case "end":
|
|
9706
|
-
return
|
|
9932
|
+
return _context51.stop();
|
|
9707
9933
|
}
|
|
9708
9934
|
}
|
|
9709
|
-
},
|
|
9935
|
+
}, _callee51, this);
|
|
9710
9936
|
}));
|
|
9711
9937
|
|
|
9712
|
-
function _reviewFlagReport(
|
|
9938
|
+
function _reviewFlagReport(_x63, _x64) {
|
|
9713
9939
|
return _reviewFlagReport2.apply(this, arguments);
|
|
9714
9940
|
}
|
|
9715
9941
|
|
|
@@ -9727,31 +9953,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9727
9953
|
}, {
|
|
9728
9954
|
key: "unblockMessage",
|
|
9729
9955
|
value: function () {
|
|
9730
|
-
var _unblockMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9956
|
+
var _unblockMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(targetMessageID) {
|
|
9731
9957
|
var options,
|
|
9732
|
-
|
|
9733
|
-
return _regeneratorRuntime.wrap(function
|
|
9958
|
+
_args52 = arguments;
|
|
9959
|
+
return _regeneratorRuntime.wrap(function _callee52$(_context52) {
|
|
9734
9960
|
while (1) {
|
|
9735
|
-
switch (
|
|
9961
|
+
switch (_context52.prev = _context52.next) {
|
|
9736
9962
|
case 0:
|
|
9737
|
-
options =
|
|
9738
|
-
|
|
9963
|
+
options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
9964
|
+
_context52.next = 3;
|
|
9739
9965
|
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
|
|
9740
9966
|
target_message_id: targetMessageID
|
|
9741
9967
|
}, options));
|
|
9742
9968
|
|
|
9743
9969
|
case 3:
|
|
9744
|
-
return
|
|
9970
|
+
return _context52.abrupt("return", _context52.sent);
|
|
9745
9971
|
|
|
9746
9972
|
case 4:
|
|
9747
9973
|
case "end":
|
|
9748
|
-
return
|
|
9974
|
+
return _context52.stop();
|
|
9749
9975
|
}
|
|
9750
9976
|
}
|
|
9751
|
-
},
|
|
9977
|
+
}, _callee52, this);
|
|
9752
9978
|
}));
|
|
9753
9979
|
|
|
9754
|
-
function unblockMessage(
|
|
9980
|
+
function unblockMessage(_x65) {
|
|
9755
9981
|
return _unblockMessage.apply(this, arguments);
|
|
9756
9982
|
}
|
|
9757
9983
|
|
|
@@ -9770,23 +9996,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9770
9996
|
* @return {Promise<APIResponse>}
|
|
9771
9997
|
*/
|
|
9772
9998
|
function () {
|
|
9773
|
-
var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9999
|
+
var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53() {
|
|
9774
10000
|
var data,
|
|
9775
|
-
|
|
9776
|
-
return _regeneratorRuntime.wrap(function
|
|
10001
|
+
_args53 = arguments;
|
|
10002
|
+
return _regeneratorRuntime.wrap(function _callee53$(_context53) {
|
|
9777
10003
|
while (1) {
|
|
9778
|
-
switch (
|
|
10004
|
+
switch (_context53.prev = _context53.next) {
|
|
9779
10005
|
case 0:
|
|
9780
|
-
data =
|
|
9781
|
-
|
|
10006
|
+
data = _args53.length > 0 && _args53[0] !== undefined ? _args53[0] : {};
|
|
10007
|
+
_context53.next = 3;
|
|
9782
10008
|
return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
|
|
9783
10009
|
|
|
9784
10010
|
case 3:
|
|
9785
10011
|
case "end":
|
|
9786
|
-
return
|
|
10012
|
+
return _context53.stop();
|
|
9787
10013
|
}
|
|
9788
10014
|
}
|
|
9789
|
-
},
|
|
10015
|
+
}, _callee53, this);
|
|
9790
10016
|
}));
|
|
9791
10017
|
|
|
9792
10018
|
function markChannelsRead() {
|
|
@@ -9861,28 +10087,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9861
10087
|
}, {
|
|
9862
10088
|
key: "translateMessage",
|
|
9863
10089
|
value: function () {
|
|
9864
|
-
var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
9865
|
-
return _regeneratorRuntime.wrap(function
|
|
10090
|
+
var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(messageId, language) {
|
|
10091
|
+
return _regeneratorRuntime.wrap(function _callee54$(_context54) {
|
|
9866
10092
|
while (1) {
|
|
9867
|
-
switch (
|
|
10093
|
+
switch (_context54.prev = _context54.next) {
|
|
9868
10094
|
case 0:
|
|
9869
|
-
|
|
10095
|
+
_context54.next = 2;
|
|
9870
10096
|
return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
|
|
9871
10097
|
language: language
|
|
9872
10098
|
});
|
|
9873
10099
|
|
|
9874
10100
|
case 2:
|
|
9875
|
-
return
|
|
10101
|
+
return _context54.abrupt("return", _context54.sent);
|
|
9876
10102
|
|
|
9877
10103
|
case 3:
|
|
9878
10104
|
case "end":
|
|
9879
|
-
return
|
|
10105
|
+
return _context54.stop();
|
|
9880
10106
|
}
|
|
9881
10107
|
}
|
|
9882
|
-
},
|
|
10108
|
+
}, _callee54, this);
|
|
9883
10109
|
}));
|
|
9884
10110
|
|
|
9885
|
-
function translateMessage(
|
|
10111
|
+
function translateMessage(_x66, _x67) {
|
|
9886
10112
|
return _translateMessage.apply(this, arguments);
|
|
9887
10113
|
}
|
|
9888
10114
|
|
|
@@ -9984,14 +10210,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9984
10210
|
}, {
|
|
9985
10211
|
key: "updateMessage",
|
|
9986
10212
|
value: function () {
|
|
9987
|
-
var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10213
|
+
var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(message, userId, options) {
|
|
9988
10214
|
var clonedMessage, reservedMessageFields;
|
|
9989
|
-
return _regeneratorRuntime.wrap(function
|
|
10215
|
+
return _regeneratorRuntime.wrap(function _callee55$(_context55) {
|
|
9990
10216
|
while (1) {
|
|
9991
|
-
switch (
|
|
10217
|
+
switch (_context55.prev = _context55.next) {
|
|
9992
10218
|
case 0:
|
|
9993
10219
|
if (message.id) {
|
|
9994
|
-
|
|
10220
|
+
_context55.next = 2;
|
|
9995
10221
|
break;
|
|
9996
10222
|
}
|
|
9997
10223
|
|
|
@@ -10028,158 +10254,345 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10028
10254
|
});
|
|
10029
10255
|
}
|
|
10030
10256
|
|
|
10031
|
-
|
|
10257
|
+
_context55.next = 10;
|
|
10032
10258
|
return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
|
|
10033
10259
|
message: clonedMessage
|
|
10034
10260
|
}, options));
|
|
10035
10261
|
|
|
10036
10262
|
case 10:
|
|
10037
|
-
return
|
|
10263
|
+
return _context55.abrupt("return", _context55.sent);
|
|
10038
10264
|
|
|
10039
10265
|
case 11:
|
|
10040
10266
|
case "end":
|
|
10041
|
-
return
|
|
10267
|
+
return _context55.stop();
|
|
10042
10268
|
}
|
|
10043
10269
|
}
|
|
10044
|
-
},
|
|
10270
|
+
}, _callee55, this);
|
|
10271
|
+
}));
|
|
10272
|
+
|
|
10273
|
+
function updateMessage(_x68, _x69, _x70) {
|
|
10274
|
+
return _updateMessage.apply(this, arguments);
|
|
10275
|
+
}
|
|
10276
|
+
|
|
10277
|
+
return updateMessage;
|
|
10278
|
+
}()
|
|
10279
|
+
/**
|
|
10280
|
+
* partialUpdateMessage - Update the given message id while retaining additional properties
|
|
10281
|
+
*
|
|
10282
|
+
* @param {string} id the message id
|
|
10283
|
+
*
|
|
10284
|
+
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
10285
|
+
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
10286
|
+
* @param {string | { id: string }} [userId]
|
|
10287
|
+
*
|
|
10288
|
+
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
10289
|
+
*
|
|
10290
|
+
* @return {{ message: MessageResponse<StreamChatGenerics> }} Response that includes the updated message
|
|
10291
|
+
*/
|
|
10292
|
+
|
|
10293
|
+
}, {
|
|
10294
|
+
key: "partialUpdateMessage",
|
|
10295
|
+
value: function () {
|
|
10296
|
+
var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(id, partialMessageObject, userId, options) {
|
|
10297
|
+
var user;
|
|
10298
|
+
return _regeneratorRuntime.wrap(function _callee56$(_context56) {
|
|
10299
|
+
while (1) {
|
|
10300
|
+
switch (_context56.prev = _context56.next) {
|
|
10301
|
+
case 0:
|
|
10302
|
+
if (id) {
|
|
10303
|
+
_context56.next = 2;
|
|
10304
|
+
break;
|
|
10305
|
+
}
|
|
10306
|
+
|
|
10307
|
+
throw Error('Please specify the message id when calling partialUpdateMessage');
|
|
10308
|
+
|
|
10309
|
+
case 2:
|
|
10310
|
+
user = userId;
|
|
10311
|
+
|
|
10312
|
+
if (userId != null && isString(userId)) {
|
|
10313
|
+
user = {
|
|
10314
|
+
id: userId
|
|
10315
|
+
};
|
|
10316
|
+
}
|
|
10317
|
+
|
|
10318
|
+
_context56.next = 6;
|
|
10319
|
+
return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
|
|
10320
|
+
user: user
|
|
10321
|
+
}));
|
|
10322
|
+
|
|
10323
|
+
case 6:
|
|
10324
|
+
return _context56.abrupt("return", _context56.sent);
|
|
10325
|
+
|
|
10326
|
+
case 7:
|
|
10327
|
+
case "end":
|
|
10328
|
+
return _context56.stop();
|
|
10329
|
+
}
|
|
10330
|
+
}
|
|
10331
|
+
}, _callee56, this);
|
|
10332
|
+
}));
|
|
10333
|
+
|
|
10334
|
+
function partialUpdateMessage(_x71, _x72, _x73, _x74) {
|
|
10335
|
+
return _partialUpdateMessage.apply(this, arguments);
|
|
10336
|
+
}
|
|
10337
|
+
|
|
10338
|
+
return partialUpdateMessage;
|
|
10339
|
+
}()
|
|
10340
|
+
}, {
|
|
10341
|
+
key: "deleteMessage",
|
|
10342
|
+
value: function () {
|
|
10343
|
+
var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(messageID, hardDelete) {
|
|
10344
|
+
var params;
|
|
10345
|
+
return _regeneratorRuntime.wrap(function _callee57$(_context57) {
|
|
10346
|
+
while (1) {
|
|
10347
|
+
switch (_context57.prev = _context57.next) {
|
|
10348
|
+
case 0:
|
|
10349
|
+
params = {};
|
|
10350
|
+
|
|
10351
|
+
if (hardDelete) {
|
|
10352
|
+
params = {
|
|
10353
|
+
hard: true
|
|
10354
|
+
};
|
|
10355
|
+
}
|
|
10356
|
+
|
|
10357
|
+
_context57.next = 4;
|
|
10358
|
+
return this.delete(this.baseURL + "/messages/".concat(messageID), params);
|
|
10359
|
+
|
|
10360
|
+
case 4:
|
|
10361
|
+
return _context57.abrupt("return", _context57.sent);
|
|
10362
|
+
|
|
10363
|
+
case 5:
|
|
10364
|
+
case "end":
|
|
10365
|
+
return _context57.stop();
|
|
10366
|
+
}
|
|
10367
|
+
}
|
|
10368
|
+
}, _callee57, this);
|
|
10369
|
+
}));
|
|
10370
|
+
|
|
10371
|
+
function deleteMessage(_x75, _x76) {
|
|
10372
|
+
return _deleteMessage.apply(this, arguments);
|
|
10373
|
+
}
|
|
10374
|
+
|
|
10375
|
+
return deleteMessage;
|
|
10376
|
+
}()
|
|
10377
|
+
}, {
|
|
10378
|
+
key: "getMessage",
|
|
10379
|
+
value: function () {
|
|
10380
|
+
var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(messageID) {
|
|
10381
|
+
return _regeneratorRuntime.wrap(function _callee58$(_context58) {
|
|
10382
|
+
while (1) {
|
|
10383
|
+
switch (_context58.prev = _context58.next) {
|
|
10384
|
+
case 0:
|
|
10385
|
+
_context58.next = 2;
|
|
10386
|
+
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
|
|
10387
|
+
|
|
10388
|
+
case 2:
|
|
10389
|
+
return _context58.abrupt("return", _context58.sent);
|
|
10390
|
+
|
|
10391
|
+
case 3:
|
|
10392
|
+
case "end":
|
|
10393
|
+
return _context58.stop();
|
|
10394
|
+
}
|
|
10395
|
+
}
|
|
10396
|
+
}, _callee58, this);
|
|
10397
|
+
}));
|
|
10398
|
+
|
|
10399
|
+
function getMessage(_x77) {
|
|
10400
|
+
return _getMessage.apply(this, arguments);
|
|
10401
|
+
}
|
|
10402
|
+
|
|
10403
|
+
return getMessage;
|
|
10404
|
+
}()
|
|
10405
|
+
/**
|
|
10406
|
+
* queryThreads - returns the list of threads of current user.
|
|
10407
|
+
*
|
|
10408
|
+
* @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
|
|
10409
|
+
* @param {number} options.limit Limits the number of threads to be returned.
|
|
10410
|
+
* @param {boolean} options.watch Subscribes the user to the channels of the threads.
|
|
10411
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10412
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10413
|
+
*
|
|
10414
|
+
* @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
|
|
10415
|
+
*/
|
|
10416
|
+
|
|
10417
|
+
}, {
|
|
10418
|
+
key: "queryThreads",
|
|
10419
|
+
value: function () {
|
|
10420
|
+
var _queryThreads = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(options) {
|
|
10421
|
+
var _this5 = this;
|
|
10422
|
+
|
|
10423
|
+
var opts, res;
|
|
10424
|
+
return _regeneratorRuntime.wrap(function _callee59$(_context59) {
|
|
10425
|
+
while (1) {
|
|
10426
|
+
switch (_context59.prev = _context59.next) {
|
|
10427
|
+
case 0:
|
|
10428
|
+
opts = _objectSpread({
|
|
10429
|
+
limit: 10,
|
|
10430
|
+
participant_limit: 10,
|
|
10431
|
+
reply_limit: 3,
|
|
10432
|
+
watch: true
|
|
10433
|
+
}, options);
|
|
10434
|
+
_context59.next = 3;
|
|
10435
|
+
return this.post(this.baseURL + "/threads", opts);
|
|
10436
|
+
|
|
10437
|
+
case 3:
|
|
10438
|
+
res = _context59.sent;
|
|
10439
|
+
return _context59.abrupt("return", {
|
|
10440
|
+
threads: res.threads.map(function (thread) {
|
|
10441
|
+
return new Thread(_this5, thread);
|
|
10442
|
+
}),
|
|
10443
|
+
next: res.next
|
|
10444
|
+
});
|
|
10445
|
+
|
|
10446
|
+
case 5:
|
|
10447
|
+
case "end":
|
|
10448
|
+
return _context59.stop();
|
|
10449
|
+
}
|
|
10450
|
+
}
|
|
10451
|
+
}, _callee59, this);
|
|
10045
10452
|
}));
|
|
10046
10453
|
|
|
10047
|
-
function
|
|
10048
|
-
return
|
|
10454
|
+
function queryThreads(_x78) {
|
|
10455
|
+
return _queryThreads.apply(this, arguments);
|
|
10049
10456
|
}
|
|
10050
10457
|
|
|
10051
|
-
return
|
|
10458
|
+
return queryThreads;
|
|
10052
10459
|
}()
|
|
10053
10460
|
/**
|
|
10054
|
-
*
|
|
10055
|
-
*
|
|
10056
|
-
* @param {string} id the message id
|
|
10057
|
-
*
|
|
10058
|
-
* @param {PartialUpdateMessage<StreamChatGenerics>} partialMessageObject which should contain id and any of "set" or "unset" params;
|
|
10059
|
-
* example: {id: "user1", set:{text: "hi"}, unset:["color"]}
|
|
10060
|
-
* @param {string | { id: string }} [userId]
|
|
10461
|
+
* getThread - returns the thread of a message by its id.
|
|
10061
10462
|
*
|
|
10062
|
-
* @param {
|
|
10463
|
+
* @param {string} messageId The message id
|
|
10464
|
+
* @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
|
|
10465
|
+
* @param {boolean} options.watch Subscribes the user to the channel of the thread.
|
|
10466
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10467
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10063
10468
|
*
|
|
10064
|
-
* @
|
|
10469
|
+
* @returns {Thread<StreamChatGenerics>} Returns the thread.
|
|
10065
10470
|
*/
|
|
10066
10471
|
|
|
10067
10472
|
}, {
|
|
10068
|
-
key: "
|
|
10473
|
+
key: "getThread",
|
|
10069
10474
|
value: function () {
|
|
10070
|
-
var
|
|
10071
|
-
var
|
|
10072
|
-
|
|
10475
|
+
var _getThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(messageId) {
|
|
10476
|
+
var options,
|
|
10477
|
+
opts,
|
|
10478
|
+
res,
|
|
10479
|
+
_args60 = arguments;
|
|
10480
|
+
return _regeneratorRuntime.wrap(function _callee60$(_context60) {
|
|
10073
10481
|
while (1) {
|
|
10074
|
-
switch (
|
|
10482
|
+
switch (_context60.prev = _context60.next) {
|
|
10075
10483
|
case 0:
|
|
10076
|
-
|
|
10077
|
-
|
|
10484
|
+
options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
|
|
10485
|
+
|
|
10486
|
+
if (messageId) {
|
|
10487
|
+
_context60.next = 3;
|
|
10078
10488
|
break;
|
|
10079
10489
|
}
|
|
10080
10490
|
|
|
10081
|
-
throw Error('Please specify the message id when calling
|
|
10082
|
-
|
|
10083
|
-
case 2:
|
|
10084
|
-
user = userId;
|
|
10085
|
-
|
|
10086
|
-
if (userId != null && isString(userId)) {
|
|
10087
|
-
user = {
|
|
10088
|
-
id: userId
|
|
10089
|
-
};
|
|
10090
|
-
}
|
|
10491
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10091
10492
|
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10493
|
+
case 3:
|
|
10494
|
+
opts = _objectSpread({
|
|
10495
|
+
participant_limit: 100,
|
|
10496
|
+
reply_limit: 3,
|
|
10497
|
+
watch: true
|
|
10498
|
+
}, options);
|
|
10499
|
+
_context60.next = 6;
|
|
10500
|
+
return this.get(this.baseURL + "/threads/".concat(messageId), opts);
|
|
10096
10501
|
|
|
10097
10502
|
case 6:
|
|
10098
|
-
|
|
10503
|
+
res = _context60.sent;
|
|
10504
|
+
return _context60.abrupt("return", new Thread(this, res.thread));
|
|
10099
10505
|
|
|
10100
|
-
case
|
|
10506
|
+
case 8:
|
|
10101
10507
|
case "end":
|
|
10102
|
-
return
|
|
10508
|
+
return _context60.stop();
|
|
10103
10509
|
}
|
|
10104
10510
|
}
|
|
10105
|
-
},
|
|
10511
|
+
}, _callee60, this);
|
|
10106
10512
|
}));
|
|
10107
10513
|
|
|
10108
|
-
function
|
|
10109
|
-
return
|
|
10514
|
+
function getThread(_x79) {
|
|
10515
|
+
return _getThread.apply(this, arguments);
|
|
10110
10516
|
}
|
|
10111
10517
|
|
|
10112
|
-
return
|
|
10518
|
+
return getThread;
|
|
10113
10519
|
}()
|
|
10520
|
+
/**
|
|
10521
|
+
* partialUpdateThread - updates the given thread
|
|
10522
|
+
*
|
|
10523
|
+
* @param {string} messageId The id of the thread message which needs to be updated.
|
|
10524
|
+
* @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
|
|
10525
|
+
*
|
|
10526
|
+
* @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
|
|
10527
|
+
*/
|
|
10528
|
+
|
|
10114
10529
|
}, {
|
|
10115
|
-
key: "
|
|
10530
|
+
key: "partialUpdateThread",
|
|
10116
10531
|
value: function () {
|
|
10117
|
-
var
|
|
10118
|
-
var
|
|
10119
|
-
|
|
10532
|
+
var _partialUpdateThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(messageId, partialThreadObject) {
|
|
10533
|
+
var reservedThreadFields, _key5;
|
|
10534
|
+
|
|
10535
|
+
return _regeneratorRuntime.wrap(function _callee61$(_context61) {
|
|
10120
10536
|
while (1) {
|
|
10121
|
-
switch (
|
|
10537
|
+
switch (_context61.prev = _context61.next) {
|
|
10122
10538
|
case 0:
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
params = {
|
|
10127
|
-
hard: true
|
|
10128
|
-
};
|
|
10539
|
+
if (messageId) {
|
|
10540
|
+
_context61.next = 2;
|
|
10541
|
+
break;
|
|
10129
10542
|
}
|
|
10130
10543
|
|
|
10131
|
-
|
|
10132
|
-
|
|
10544
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10545
|
+
|
|
10546
|
+
case 2:
|
|
10547
|
+
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
10548
|
+
// Throw error if any of the reserved field is found.
|
|
10549
|
+
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
|
|
10550
|
+
_context61.t0 = _regeneratorRuntime.keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
10133
10551
|
|
|
10134
10552
|
case 4:
|
|
10135
|
-
|
|
10553
|
+
if ((_context61.t1 = _context61.t0()).done) {
|
|
10554
|
+
_context61.next = 10;
|
|
10555
|
+
break;
|
|
10556
|
+
}
|
|
10136
10557
|
|
|
10137
|
-
|
|
10138
|
-
case "end":
|
|
10139
|
-
return _context56.stop();
|
|
10140
|
-
}
|
|
10141
|
-
}
|
|
10142
|
-
}, _callee56, this);
|
|
10143
|
-
}));
|
|
10558
|
+
_key5 = _context61.t1.value;
|
|
10144
10559
|
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10560
|
+
if (!reservedThreadFields.includes(_key5)) {
|
|
10561
|
+
_context61.next = 8;
|
|
10562
|
+
break;
|
|
10563
|
+
}
|
|
10148
10564
|
|
|
10149
|
-
|
|
10150
|
-
}()
|
|
10151
|
-
}, {
|
|
10152
|
-
key: "getMessage",
|
|
10153
|
-
value: function () {
|
|
10154
|
-
var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(messageID) {
|
|
10155
|
-
return _regeneratorRuntime.wrap(function _callee57$(_context57) {
|
|
10156
|
-
while (1) {
|
|
10157
|
-
switch (_context57.prev = _context57.next) {
|
|
10158
|
-
case 0:
|
|
10159
|
-
_context57.next = 2;
|
|
10160
|
-
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
|
|
10565
|
+
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."));
|
|
10161
10566
|
|
|
10162
|
-
case
|
|
10163
|
-
|
|
10567
|
+
case 8:
|
|
10568
|
+
_context61.next = 4;
|
|
10569
|
+
break;
|
|
10164
10570
|
|
|
10165
|
-
case
|
|
10571
|
+
case 10:
|
|
10572
|
+
_context61.next = 12;
|
|
10573
|
+
return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
|
|
10574
|
+
|
|
10575
|
+
case 12:
|
|
10576
|
+
return _context61.abrupt("return", _context61.sent);
|
|
10577
|
+
|
|
10578
|
+
case 13:
|
|
10166
10579
|
case "end":
|
|
10167
|
-
return
|
|
10580
|
+
return _context61.stop();
|
|
10168
10581
|
}
|
|
10169
10582
|
}
|
|
10170
|
-
},
|
|
10583
|
+
}, _callee61, this);
|
|
10171
10584
|
}));
|
|
10172
10585
|
|
|
10173
|
-
function
|
|
10174
|
-
return
|
|
10586
|
+
function partialUpdateThread(_x80, _x81) {
|
|
10587
|
+
return _partialUpdateThread.apply(this, arguments);
|
|
10175
10588
|
}
|
|
10176
10589
|
|
|
10177
|
-
return
|
|
10590
|
+
return partialUpdateThread;
|
|
10178
10591
|
}()
|
|
10179
10592
|
}, {
|
|
10180
10593
|
key: "getUserAgent",
|
|
10181
10594
|
value: function getUserAgent() {
|
|
10182
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
10595
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
|
|
10183
10596
|
}
|
|
10184
10597
|
}, {
|
|
10185
10598
|
key: "setUserAgent",
|
|
@@ -10398,28 +10811,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10398
10811
|
}, {
|
|
10399
10812
|
key: "sendUserCustomEvent",
|
|
10400
10813
|
value: function () {
|
|
10401
|
-
var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10402
|
-
return _regeneratorRuntime.wrap(function
|
|
10814
|
+
var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(targetUserID, event) {
|
|
10815
|
+
return _regeneratorRuntime.wrap(function _callee62$(_context62) {
|
|
10403
10816
|
while (1) {
|
|
10404
|
-
switch (
|
|
10817
|
+
switch (_context62.prev = _context62.next) {
|
|
10405
10818
|
case 0:
|
|
10406
|
-
|
|
10819
|
+
_context62.next = 2;
|
|
10407
10820
|
return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
|
|
10408
10821
|
event: event
|
|
10409
10822
|
});
|
|
10410
10823
|
|
|
10411
10824
|
case 2:
|
|
10412
|
-
return
|
|
10825
|
+
return _context62.abrupt("return", _context62.sent);
|
|
10413
10826
|
|
|
10414
10827
|
case 3:
|
|
10415
10828
|
case "end":
|
|
10416
|
-
return
|
|
10829
|
+
return _context62.stop();
|
|
10417
10830
|
}
|
|
10418
10831
|
}
|
|
10419
|
-
},
|
|
10832
|
+
}, _callee62, this);
|
|
10420
10833
|
}));
|
|
10421
10834
|
|
|
10422
|
-
function sendUserCustomEvent(
|
|
10835
|
+
function sendUserCustomEvent(_x82, _x83) {
|
|
10423
10836
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
10424
10837
|
}
|
|
10425
10838
|
|
|
@@ -10477,50 +10890,259 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10477
10890
|
return this.get("".concat(this.baseURL, "/export_channels/").concat(id));
|
|
10478
10891
|
}
|
|
10479
10892
|
/**
|
|
10480
|
-
* createSegment - Creates a
|
|
10893
|
+
* createSegment - Creates a segment
|
|
10894
|
+
*
|
|
10895
|
+
* @private
|
|
10896
|
+
* @param {SegmentType} type Segment type
|
|
10897
|
+
* @param {string} id Segment ID (valid UUID)
|
|
10898
|
+
* @param {string} name Segment name (valid UUID)
|
|
10899
|
+
* @param {SegmentData} params Segment data
|
|
10900
|
+
*
|
|
10901
|
+
* @return {Segment} The created Segment
|
|
10902
|
+
*/
|
|
10903
|
+
|
|
10904
|
+
}, {
|
|
10905
|
+
key: "createSegment",
|
|
10906
|
+
value: function () {
|
|
10907
|
+
var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(type, id, name, data) {
|
|
10908
|
+
var body, _yield$this$post, segment;
|
|
10909
|
+
|
|
10910
|
+
return _regeneratorRuntime.wrap(function _callee63$(_context63) {
|
|
10911
|
+
while (1) {
|
|
10912
|
+
switch (_context63.prev = _context63.next) {
|
|
10913
|
+
case 0:
|
|
10914
|
+
body = {
|
|
10915
|
+
id: id,
|
|
10916
|
+
type: type,
|
|
10917
|
+
name: name,
|
|
10918
|
+
data: data
|
|
10919
|
+
};
|
|
10920
|
+
_context63.next = 3;
|
|
10921
|
+
return this.post(this.baseURL + "/segments", body);
|
|
10922
|
+
|
|
10923
|
+
case 3:
|
|
10924
|
+
_yield$this$post = _context63.sent;
|
|
10925
|
+
segment = _yield$this$post.segment;
|
|
10926
|
+
return _context63.abrupt("return", segment);
|
|
10927
|
+
|
|
10928
|
+
case 6:
|
|
10929
|
+
case "end":
|
|
10930
|
+
return _context63.stop();
|
|
10931
|
+
}
|
|
10932
|
+
}
|
|
10933
|
+
}, _callee63, this);
|
|
10934
|
+
}));
|
|
10935
|
+
|
|
10936
|
+
function createSegment(_x84, _x85, _x86, _x87) {
|
|
10937
|
+
return _createSegment.apply(this, arguments);
|
|
10938
|
+
}
|
|
10939
|
+
|
|
10940
|
+
return createSegment;
|
|
10941
|
+
}()
|
|
10942
|
+
/**
|
|
10943
|
+
* createUserSegment - Creates a user segment
|
|
10944
|
+
*
|
|
10945
|
+
* @param {string} id Segment ID (valid UUID)
|
|
10946
|
+
* @param {string} name Segment name
|
|
10947
|
+
* @param {SegmentData} data Segment data
|
|
10948
|
+
*
|
|
10949
|
+
* @return {Segment} The created Segment
|
|
10950
|
+
*/
|
|
10951
|
+
|
|
10952
|
+
}, {
|
|
10953
|
+
key: "createUserSegment",
|
|
10954
|
+
value: function () {
|
|
10955
|
+
var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id, name, data) {
|
|
10956
|
+
return _regeneratorRuntime.wrap(function _callee64$(_context64) {
|
|
10957
|
+
while (1) {
|
|
10958
|
+
switch (_context64.prev = _context64.next) {
|
|
10959
|
+
case 0:
|
|
10960
|
+
_context64.next = 2;
|
|
10961
|
+
return this.createSegment('user', id, name, data);
|
|
10962
|
+
|
|
10963
|
+
case 2:
|
|
10964
|
+
return _context64.abrupt("return", _context64.sent);
|
|
10965
|
+
|
|
10966
|
+
case 3:
|
|
10967
|
+
case "end":
|
|
10968
|
+
return _context64.stop();
|
|
10969
|
+
}
|
|
10970
|
+
}
|
|
10971
|
+
}, _callee64, this);
|
|
10972
|
+
}));
|
|
10973
|
+
|
|
10974
|
+
function createUserSegment(_x88, _x89, _x90) {
|
|
10975
|
+
return _createUserSegment.apply(this, arguments);
|
|
10976
|
+
}
|
|
10977
|
+
|
|
10978
|
+
return createUserSegment;
|
|
10979
|
+
}()
|
|
10980
|
+
/**
|
|
10981
|
+
* createChannelSegment - Creates a channel segment
|
|
10982
|
+
*
|
|
10983
|
+
* @param {string} id Segment ID (valid UUID)
|
|
10984
|
+
* @param {string} name Segment name
|
|
10985
|
+
* @param {SegmentData} data Segment data
|
|
10986
|
+
*
|
|
10987
|
+
* @return {Segment} The created Segment
|
|
10988
|
+
*/
|
|
10989
|
+
|
|
10990
|
+
}, {
|
|
10991
|
+
key: "createChannelSegment",
|
|
10992
|
+
value: function () {
|
|
10993
|
+
var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, name, data) {
|
|
10994
|
+
return _regeneratorRuntime.wrap(function _callee65$(_context65) {
|
|
10995
|
+
while (1) {
|
|
10996
|
+
switch (_context65.prev = _context65.next) {
|
|
10997
|
+
case 0:
|
|
10998
|
+
_context65.next = 2;
|
|
10999
|
+
return this.createSegment('channel', id, name, data);
|
|
11000
|
+
|
|
11001
|
+
case 2:
|
|
11002
|
+
return _context65.abrupt("return", _context65.sent);
|
|
11003
|
+
|
|
11004
|
+
case 3:
|
|
11005
|
+
case "end":
|
|
11006
|
+
return _context65.stop();
|
|
11007
|
+
}
|
|
11008
|
+
}
|
|
11009
|
+
}, _callee65, this);
|
|
11010
|
+
}));
|
|
11011
|
+
|
|
11012
|
+
function createChannelSegment(_x91, _x92, _x93) {
|
|
11013
|
+
return _createChannelSegment.apply(this, arguments);
|
|
11014
|
+
}
|
|
11015
|
+
|
|
11016
|
+
return createChannelSegment;
|
|
11017
|
+
}()
|
|
11018
|
+
/**
|
|
11019
|
+
* updateSegment - Update a segment
|
|
11020
|
+
*
|
|
11021
|
+
* @param {string} id Segment ID
|
|
11022
|
+
* @param {Partial<UpdateSegmentData>} data Data to update
|
|
11023
|
+
*
|
|
11024
|
+
* @return {Segment} Updated Segment
|
|
11025
|
+
*/
|
|
11026
|
+
|
|
11027
|
+
}, {
|
|
11028
|
+
key: "updateSegment",
|
|
11029
|
+
value: function () {
|
|
11030
|
+
var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
|
|
11031
|
+
var _yield$this$put, segment;
|
|
11032
|
+
|
|
11033
|
+
return _regeneratorRuntime.wrap(function _callee66$(_context66) {
|
|
11034
|
+
while (1) {
|
|
11035
|
+
switch (_context66.prev = _context66.next) {
|
|
11036
|
+
case 0:
|
|
11037
|
+
_context66.next = 2;
|
|
11038
|
+
return this.put(this.baseURL + "/segments/".concat(id), data);
|
|
11039
|
+
|
|
11040
|
+
case 2:
|
|
11041
|
+
_yield$this$put = _context66.sent;
|
|
11042
|
+
segment = _yield$this$put.segment;
|
|
11043
|
+
return _context66.abrupt("return", segment);
|
|
11044
|
+
|
|
11045
|
+
case 5:
|
|
11046
|
+
case "end":
|
|
11047
|
+
return _context66.stop();
|
|
11048
|
+
}
|
|
11049
|
+
}
|
|
11050
|
+
}, _callee66, this);
|
|
11051
|
+
}));
|
|
11052
|
+
|
|
11053
|
+
function updateSegment(_x94, _x95) {
|
|
11054
|
+
return _updateSegment.apply(this, arguments);
|
|
11055
|
+
}
|
|
11056
|
+
|
|
11057
|
+
return updateSegment;
|
|
11058
|
+
}()
|
|
11059
|
+
/**
|
|
11060
|
+
* addSegmentTargets - Add targets to a segment
|
|
11061
|
+
*
|
|
11062
|
+
* @param {string} id Segment ID
|
|
11063
|
+
* @param {string[]} targets Targets to add to the segment
|
|
11064
|
+
*
|
|
11065
|
+
* @return {APIResponse} API response
|
|
11066
|
+
*/
|
|
11067
|
+
|
|
11068
|
+
}, {
|
|
11069
|
+
key: "addSegmentTargets",
|
|
11070
|
+
value: function () {
|
|
11071
|
+
var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, targets) {
|
|
11072
|
+
var body;
|
|
11073
|
+
return _regeneratorRuntime.wrap(function _callee67$(_context67) {
|
|
11074
|
+
while (1) {
|
|
11075
|
+
switch (_context67.prev = _context67.next) {
|
|
11076
|
+
case 0:
|
|
11077
|
+
body = {
|
|
11078
|
+
targets: targets
|
|
11079
|
+
};
|
|
11080
|
+
_context67.next = 3;
|
|
11081
|
+
return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
|
|
11082
|
+
|
|
11083
|
+
case 3:
|
|
11084
|
+
return _context67.abrupt("return", _context67.sent);
|
|
11085
|
+
|
|
11086
|
+
case 4:
|
|
11087
|
+
case "end":
|
|
11088
|
+
return _context67.stop();
|
|
11089
|
+
}
|
|
11090
|
+
}
|
|
11091
|
+
}, _callee67, this);
|
|
11092
|
+
}));
|
|
11093
|
+
|
|
11094
|
+
function addSegmentTargets(_x96, _x97) {
|
|
11095
|
+
return _addSegmentTargets.apply(this, arguments);
|
|
11096
|
+
}
|
|
11097
|
+
|
|
11098
|
+
return addSegmentTargets;
|
|
11099
|
+
}()
|
|
11100
|
+
/**
|
|
11101
|
+
* deleteSegmentTargets - Delete targets from a segment
|
|
10481
11102
|
*
|
|
10482
|
-
* @param {
|
|
11103
|
+
* @param {string} id Segment ID
|
|
11104
|
+
* @param {string[]} targets Targets to add to the segment
|
|
10483
11105
|
*
|
|
10484
|
-
* @return {
|
|
11106
|
+
* @return {APIResponse} API response
|
|
10485
11107
|
*/
|
|
10486
11108
|
|
|
10487
11109
|
}, {
|
|
10488
|
-
key: "
|
|
11110
|
+
key: "deleteSegmentTargets",
|
|
10489
11111
|
value: function () {
|
|
10490
|
-
var
|
|
10491
|
-
var
|
|
10492
|
-
|
|
10493
|
-
return _regeneratorRuntime.wrap(function _callee59$(_context59) {
|
|
11112
|
+
var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
|
|
11113
|
+
var body;
|
|
11114
|
+
return _regeneratorRuntime.wrap(function _callee68$(_context68) {
|
|
10494
11115
|
while (1) {
|
|
10495
|
-
switch (
|
|
11116
|
+
switch (_context68.prev = _context68.next) {
|
|
10496
11117
|
case 0:
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
11118
|
+
body = {
|
|
11119
|
+
targets: targets
|
|
11120
|
+
};
|
|
11121
|
+
_context68.next = 3;
|
|
11122
|
+
return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
|
|
10501
11123
|
|
|
10502
|
-
case
|
|
10503
|
-
|
|
10504
|
-
segment = _yield$this$post.segment;
|
|
10505
|
-
return _context59.abrupt("return", segment);
|
|
11124
|
+
case 3:
|
|
11125
|
+
return _context68.abrupt("return", _context68.sent);
|
|
10506
11126
|
|
|
10507
|
-
case
|
|
11127
|
+
case 4:
|
|
10508
11128
|
case "end":
|
|
10509
|
-
return
|
|
11129
|
+
return _context68.stop();
|
|
10510
11130
|
}
|
|
10511
11131
|
}
|
|
10512
|
-
},
|
|
11132
|
+
}, _callee68, this);
|
|
10513
11133
|
}));
|
|
10514
11134
|
|
|
10515
|
-
function
|
|
10516
|
-
return
|
|
11135
|
+
function deleteSegmentTargets(_x98, _x99) {
|
|
11136
|
+
return _deleteSegmentTargets.apply(this, arguments);
|
|
10517
11137
|
}
|
|
10518
11138
|
|
|
10519
|
-
return
|
|
11139
|
+
return deleteSegmentTargets;
|
|
10520
11140
|
}()
|
|
10521
11141
|
/**
|
|
10522
|
-
* querySegments - Query
|
|
11142
|
+
* querySegments - Query Segments
|
|
10523
11143
|
*
|
|
11144
|
+
* @param {filter} filter MongoDB style filter conditions
|
|
11145
|
+
* @param {QuerySegmentsOptions} options Options for sorting/paginating the results
|
|
10524
11146
|
*
|
|
10525
11147
|
* @return {Segment[]} Segments
|
|
10526
11148
|
*/
|
|
@@ -10528,112 +11150,110 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10528
11150
|
}, {
|
|
10529
11151
|
key: "querySegments",
|
|
10530
11152
|
value: function () {
|
|
10531
|
-
var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11153
|
+
var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(filter) {
|
|
10532
11154
|
var options,
|
|
10533
|
-
|
|
10534
|
-
return _regeneratorRuntime.wrap(function
|
|
11155
|
+
_args69 = arguments;
|
|
11156
|
+
return _regeneratorRuntime.wrap(function _callee69$(_context69) {
|
|
10535
11157
|
while (1) {
|
|
10536
|
-
switch (
|
|
11158
|
+
switch (_context69.prev = _context69.next) {
|
|
10537
11159
|
case 0:
|
|
10538
|
-
options =
|
|
10539
|
-
|
|
11160
|
+
options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
|
|
11161
|
+
_context69.next = 3;
|
|
10540
11162
|
return this.get(this.baseURL + "/segments", {
|
|
10541
11163
|
payload: _objectSpread({
|
|
10542
|
-
|
|
11164
|
+
filter: filter
|
|
10543
11165
|
}, options)
|
|
10544
11166
|
});
|
|
10545
11167
|
|
|
10546
11168
|
case 3:
|
|
10547
|
-
return
|
|
11169
|
+
return _context69.abrupt("return", _context69.sent);
|
|
10548
11170
|
|
|
10549
11171
|
case 4:
|
|
10550
11172
|
case "end":
|
|
10551
|
-
return
|
|
11173
|
+
return _context69.stop();
|
|
10552
11174
|
}
|
|
10553
11175
|
}
|
|
10554
|
-
},
|
|
11176
|
+
}, _callee69, this);
|
|
10555
11177
|
}));
|
|
10556
11178
|
|
|
10557
|
-
function querySegments(
|
|
11179
|
+
function querySegments(_x100) {
|
|
10558
11180
|
return _querySegments.apply(this, arguments);
|
|
10559
11181
|
}
|
|
10560
11182
|
|
|
10561
11183
|
return querySegments;
|
|
10562
11184
|
}()
|
|
10563
11185
|
/**
|
|
10564
|
-
*
|
|
11186
|
+
* deleteSegment - Delete a Campaign Segment
|
|
10565
11187
|
*
|
|
10566
11188
|
* @param {string} id Segment ID
|
|
10567
|
-
* @param {Partial<SegmentData>} params Segment data
|
|
10568
11189
|
*
|
|
10569
|
-
* @return {
|
|
11190
|
+
* @return {Promise<APIResponse>} The Server Response
|
|
10570
11191
|
*/
|
|
10571
11192
|
|
|
10572
11193
|
}, {
|
|
10573
|
-
key: "
|
|
11194
|
+
key: "deleteSegment",
|
|
10574
11195
|
value: function () {
|
|
10575
|
-
var
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
return _regeneratorRuntime.wrap(function _callee61$(_context61) {
|
|
11196
|
+
var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id) {
|
|
11197
|
+
return _regeneratorRuntime.wrap(function _callee70$(_context70) {
|
|
10579
11198
|
while (1) {
|
|
10580
|
-
switch (
|
|
11199
|
+
switch (_context70.prev = _context70.next) {
|
|
10581
11200
|
case 0:
|
|
10582
|
-
|
|
10583
|
-
return this.
|
|
10584
|
-
segment: params
|
|
10585
|
-
});
|
|
11201
|
+
_context70.next = 2;
|
|
11202
|
+
return this.delete(this.baseURL + "/segments/".concat(id));
|
|
10586
11203
|
|
|
10587
11204
|
case 2:
|
|
10588
|
-
|
|
10589
|
-
segment = _yield$this$put.segment;
|
|
10590
|
-
return _context61.abrupt("return", segment);
|
|
11205
|
+
return _context70.abrupt("return", _context70.sent);
|
|
10591
11206
|
|
|
10592
|
-
case
|
|
11207
|
+
case 3:
|
|
10593
11208
|
case "end":
|
|
10594
|
-
return
|
|
11209
|
+
return _context70.stop();
|
|
10595
11210
|
}
|
|
10596
11211
|
}
|
|
10597
|
-
},
|
|
11212
|
+
}, _callee70, this);
|
|
10598
11213
|
}));
|
|
10599
11214
|
|
|
10600
|
-
function
|
|
10601
|
-
return
|
|
11215
|
+
function deleteSegment(_x101) {
|
|
11216
|
+
return _deleteSegment.apply(this, arguments);
|
|
10602
11217
|
}
|
|
10603
11218
|
|
|
10604
|
-
return
|
|
11219
|
+
return deleteSegment;
|
|
10605
11220
|
}()
|
|
10606
11221
|
/**
|
|
10607
|
-
*
|
|
11222
|
+
* segmentTargetExists - Check if a target exists in a segment
|
|
10608
11223
|
*
|
|
10609
|
-
* @param {string}
|
|
11224
|
+
* @param {string} segmentId Segment ID
|
|
11225
|
+
* @param {string} targetId Target ID
|
|
10610
11226
|
*
|
|
10611
11227
|
* @return {Promise<APIResponse>} The Server Response
|
|
10612
11228
|
*/
|
|
10613
11229
|
|
|
10614
11230
|
}, {
|
|
10615
|
-
key: "
|
|
11231
|
+
key: "segmentTargetExists",
|
|
10616
11232
|
value: function () {
|
|
10617
|
-
var
|
|
10618
|
-
return _regeneratorRuntime.wrap(function
|
|
11233
|
+
var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(segmentId, targetId) {
|
|
11234
|
+
return _regeneratorRuntime.wrap(function _callee71$(_context71) {
|
|
10619
11235
|
while (1) {
|
|
10620
|
-
switch (
|
|
11236
|
+
switch (_context71.prev = _context71.next) {
|
|
10621
11237
|
case 0:
|
|
10622
|
-
|
|
11238
|
+
_context71.next = 2;
|
|
11239
|
+
return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
|
|
10623
11240
|
|
|
10624
|
-
case
|
|
11241
|
+
case 2:
|
|
11242
|
+
return _context71.abrupt("return", _context71.sent);
|
|
11243
|
+
|
|
11244
|
+
case 3:
|
|
10625
11245
|
case "end":
|
|
10626
|
-
return
|
|
11246
|
+
return _context71.stop();
|
|
10627
11247
|
}
|
|
10628
11248
|
}
|
|
10629
|
-
},
|
|
11249
|
+
}, _callee71, this);
|
|
10630
11250
|
}));
|
|
10631
11251
|
|
|
10632
|
-
function
|
|
10633
|
-
return
|
|
11252
|
+
function segmentTargetExists(_x102, _x103) {
|
|
11253
|
+
return _segmentTargetExists.apply(this, arguments);
|
|
10634
11254
|
}
|
|
10635
11255
|
|
|
10636
|
-
return
|
|
11256
|
+
return segmentTargetExists;
|
|
10637
11257
|
}()
|
|
10638
11258
|
/**
|
|
10639
11259
|
* createCampaign - Creates a Campaign
|
|
@@ -10646,32 +11266,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10646
11266
|
}, {
|
|
10647
11267
|
key: "createCampaign",
|
|
10648
11268
|
value: function () {
|
|
10649
|
-
var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11269
|
+
var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(params) {
|
|
10650
11270
|
var _yield$this$post2, campaign;
|
|
10651
11271
|
|
|
10652
|
-
return _regeneratorRuntime.wrap(function
|
|
11272
|
+
return _regeneratorRuntime.wrap(function _callee72$(_context72) {
|
|
10653
11273
|
while (1) {
|
|
10654
|
-
switch (
|
|
11274
|
+
switch (_context72.prev = _context72.next) {
|
|
10655
11275
|
case 0:
|
|
10656
|
-
|
|
11276
|
+
_context72.next = 2;
|
|
10657
11277
|
return this.post(this.baseURL + "/campaigns", {
|
|
10658
11278
|
campaign: params
|
|
10659
11279
|
});
|
|
10660
11280
|
|
|
10661
11281
|
case 2:
|
|
10662
|
-
_yield$this$post2 =
|
|
11282
|
+
_yield$this$post2 = _context72.sent;
|
|
10663
11283
|
campaign = _yield$this$post2.campaign;
|
|
10664
|
-
return
|
|
11284
|
+
return _context72.abrupt("return", campaign);
|
|
10665
11285
|
|
|
10666
11286
|
case 5:
|
|
10667
11287
|
case "end":
|
|
10668
|
-
return
|
|
11288
|
+
return _context72.stop();
|
|
10669
11289
|
}
|
|
10670
11290
|
}
|
|
10671
|
-
},
|
|
11291
|
+
}, _callee72, this);
|
|
10672
11292
|
}));
|
|
10673
11293
|
|
|
10674
|
-
function createCampaign(
|
|
11294
|
+
function createCampaign(_x104) {
|
|
10675
11295
|
return _createCampaign.apply(this, arguments);
|
|
10676
11296
|
}
|
|
10677
11297
|
|
|
@@ -10687,15 +11307,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10687
11307
|
}, {
|
|
10688
11308
|
key: "queryCampaigns",
|
|
10689
11309
|
value: function () {
|
|
10690
|
-
var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11310
|
+
var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(filters) {
|
|
10691
11311
|
var options,
|
|
10692
|
-
|
|
10693
|
-
return _regeneratorRuntime.wrap(function
|
|
11312
|
+
_args73 = arguments;
|
|
11313
|
+
return _regeneratorRuntime.wrap(function _callee73$(_context73) {
|
|
10694
11314
|
while (1) {
|
|
10695
|
-
switch (
|
|
11315
|
+
switch (_context73.prev = _context73.next) {
|
|
10696
11316
|
case 0:
|
|
10697
|
-
options =
|
|
10698
|
-
|
|
11317
|
+
options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
|
|
11318
|
+
_context73.next = 3;
|
|
10699
11319
|
return this.get(this.baseURL + "/campaigns", {
|
|
10700
11320
|
payload: _objectSpread({
|
|
10701
11321
|
filter_conditions: filters
|
|
@@ -10703,17 +11323,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10703
11323
|
});
|
|
10704
11324
|
|
|
10705
11325
|
case 3:
|
|
10706
|
-
return
|
|
11326
|
+
return _context73.abrupt("return", _context73.sent);
|
|
10707
11327
|
|
|
10708
11328
|
case 4:
|
|
10709
11329
|
case "end":
|
|
10710
|
-
return
|
|
11330
|
+
return _context73.stop();
|
|
10711
11331
|
}
|
|
10712
11332
|
}
|
|
10713
|
-
},
|
|
11333
|
+
}, _callee73, this);
|
|
10714
11334
|
}));
|
|
10715
11335
|
|
|
10716
|
-
function queryCampaigns(
|
|
11336
|
+
function queryCampaigns(_x105) {
|
|
10717
11337
|
return _queryCampaigns.apply(this, arguments);
|
|
10718
11338
|
}
|
|
10719
11339
|
|
|
@@ -10731,32 +11351,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10731
11351
|
}, {
|
|
10732
11352
|
key: "updateCampaign",
|
|
10733
11353
|
value: function () {
|
|
10734
|
-
var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11354
|
+
var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id, params) {
|
|
10735
11355
|
var _yield$this$put2, campaign;
|
|
10736
11356
|
|
|
10737
|
-
return _regeneratorRuntime.wrap(function
|
|
11357
|
+
return _regeneratorRuntime.wrap(function _callee74$(_context74) {
|
|
10738
11358
|
while (1) {
|
|
10739
|
-
switch (
|
|
11359
|
+
switch (_context74.prev = _context74.next) {
|
|
10740
11360
|
case 0:
|
|
10741
|
-
|
|
11361
|
+
_context74.next = 2;
|
|
10742
11362
|
return this.put(this.baseURL + "/campaigns/".concat(id), {
|
|
10743
11363
|
campaign: params
|
|
10744
11364
|
});
|
|
10745
11365
|
|
|
10746
11366
|
case 2:
|
|
10747
|
-
_yield$this$put2 =
|
|
11367
|
+
_yield$this$put2 = _context74.sent;
|
|
10748
11368
|
campaign = _yield$this$put2.campaign;
|
|
10749
|
-
return
|
|
11369
|
+
return _context74.abrupt("return", campaign);
|
|
10750
11370
|
|
|
10751
11371
|
case 5:
|
|
10752
11372
|
case "end":
|
|
10753
|
-
return
|
|
11373
|
+
return _context74.stop();
|
|
10754
11374
|
}
|
|
10755
11375
|
}
|
|
10756
|
-
},
|
|
11376
|
+
}, _callee74, this);
|
|
10757
11377
|
}));
|
|
10758
11378
|
|
|
10759
|
-
function updateCampaign(
|
|
11379
|
+
function updateCampaign(_x106, _x107) {
|
|
10760
11380
|
return _updateCampaign.apply(this, arguments);
|
|
10761
11381
|
}
|
|
10762
11382
|
|
|
@@ -10773,25 +11393,25 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10773
11393
|
}, {
|
|
10774
11394
|
key: "deleteCampaign",
|
|
10775
11395
|
value: function () {
|
|
10776
|
-
var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11396
|
+
var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
|
|
10777
11397
|
var params,
|
|
10778
|
-
|
|
10779
|
-
return _regeneratorRuntime.wrap(function
|
|
11398
|
+
_args75 = arguments;
|
|
11399
|
+
return _regeneratorRuntime.wrap(function _callee75$(_context75) {
|
|
10780
11400
|
while (1) {
|
|
10781
|
-
switch (
|
|
11401
|
+
switch (_context75.prev = _context75.next) {
|
|
10782
11402
|
case 0:
|
|
10783
|
-
params =
|
|
10784
|
-
return
|
|
11403
|
+
params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
|
|
11404
|
+
return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
|
|
10785
11405
|
|
|
10786
11406
|
case 2:
|
|
10787
11407
|
case "end":
|
|
10788
|
-
return
|
|
11408
|
+
return _context75.stop();
|
|
10789
11409
|
}
|
|
10790
11410
|
}
|
|
10791
|
-
},
|
|
11411
|
+
}, _callee75, this);
|
|
10792
11412
|
}));
|
|
10793
11413
|
|
|
10794
|
-
function deleteCampaign(
|
|
11414
|
+
function deleteCampaign(_x108) {
|
|
10795
11415
|
return _deleteCampaign.apply(this, arguments);
|
|
10796
11416
|
}
|
|
10797
11417
|
|
|
@@ -10809,33 +11429,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10809
11429
|
}, {
|
|
10810
11430
|
key: "scheduleCampaign",
|
|
10811
11431
|
value: function () {
|
|
10812
|
-
var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11432
|
+
var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, params) {
|
|
10813
11433
|
var scheduledFor, _yield$this$patch, campaign;
|
|
10814
11434
|
|
|
10815
|
-
return _regeneratorRuntime.wrap(function
|
|
11435
|
+
return _regeneratorRuntime.wrap(function _callee76$(_context76) {
|
|
10816
11436
|
while (1) {
|
|
10817
|
-
switch (
|
|
11437
|
+
switch (_context76.prev = _context76.next) {
|
|
10818
11438
|
case 0:
|
|
10819
11439
|
scheduledFor = params.scheduledFor;
|
|
10820
|
-
|
|
11440
|
+
_context76.next = 3;
|
|
10821
11441
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
|
|
10822
11442
|
scheduled_for: scheduledFor
|
|
10823
11443
|
});
|
|
10824
11444
|
|
|
10825
11445
|
case 3:
|
|
10826
|
-
_yield$this$patch =
|
|
11446
|
+
_yield$this$patch = _context76.sent;
|
|
10827
11447
|
campaign = _yield$this$patch.campaign;
|
|
10828
|
-
return
|
|
11448
|
+
return _context76.abrupt("return", campaign);
|
|
10829
11449
|
|
|
10830
11450
|
case 6:
|
|
10831
11451
|
case "end":
|
|
10832
|
-
return
|
|
11452
|
+
return _context76.stop();
|
|
10833
11453
|
}
|
|
10834
11454
|
}
|
|
10835
|
-
},
|
|
11455
|
+
}, _callee76, this);
|
|
10836
11456
|
}));
|
|
10837
11457
|
|
|
10838
|
-
function scheduleCampaign(
|
|
11458
|
+
function scheduleCampaign(_x109, _x110) {
|
|
10839
11459
|
return _scheduleCampaign.apply(this, arguments);
|
|
10840
11460
|
}
|
|
10841
11461
|
|
|
@@ -10852,30 +11472,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10852
11472
|
}, {
|
|
10853
11473
|
key: "stopCampaign",
|
|
10854
11474
|
value: function () {
|
|
10855
|
-
var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11475
|
+
var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(id) {
|
|
10856
11476
|
var _yield$this$patch2, campaign;
|
|
10857
11477
|
|
|
10858
|
-
return _regeneratorRuntime.wrap(function
|
|
11478
|
+
return _regeneratorRuntime.wrap(function _callee77$(_context77) {
|
|
10859
11479
|
while (1) {
|
|
10860
|
-
switch (
|
|
11480
|
+
switch (_context77.prev = _context77.next) {
|
|
10861
11481
|
case 0:
|
|
10862
|
-
|
|
11482
|
+
_context77.next = 2;
|
|
10863
11483
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
|
|
10864
11484
|
|
|
10865
11485
|
case 2:
|
|
10866
|
-
_yield$this$patch2 =
|
|
11486
|
+
_yield$this$patch2 = _context77.sent;
|
|
10867
11487
|
campaign = _yield$this$patch2.campaign;
|
|
10868
|
-
return
|
|
11488
|
+
return _context77.abrupt("return", campaign);
|
|
10869
11489
|
|
|
10870
11490
|
case 5:
|
|
10871
11491
|
case "end":
|
|
10872
|
-
return
|
|
11492
|
+
return _context77.stop();
|
|
10873
11493
|
}
|
|
10874
11494
|
}
|
|
10875
|
-
},
|
|
11495
|
+
}, _callee77, this);
|
|
10876
11496
|
}));
|
|
10877
11497
|
|
|
10878
|
-
function stopCampaign(
|
|
11498
|
+
function stopCampaign(_x111) {
|
|
10879
11499
|
return _stopCampaign.apply(this, arguments);
|
|
10880
11500
|
}
|
|
10881
11501
|
|
|
@@ -10892,30 +11512,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10892
11512
|
}, {
|
|
10893
11513
|
key: "resumeCampaign",
|
|
10894
11514
|
value: function () {
|
|
10895
|
-
var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11515
|
+
var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
|
|
10896
11516
|
var _yield$this$patch3, campaign;
|
|
10897
11517
|
|
|
10898
|
-
return _regeneratorRuntime.wrap(function
|
|
11518
|
+
return _regeneratorRuntime.wrap(function _callee78$(_context78) {
|
|
10899
11519
|
while (1) {
|
|
10900
|
-
switch (
|
|
11520
|
+
switch (_context78.prev = _context78.next) {
|
|
10901
11521
|
case 0:
|
|
10902
|
-
|
|
11522
|
+
_context78.next = 2;
|
|
10903
11523
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
|
|
10904
11524
|
|
|
10905
11525
|
case 2:
|
|
10906
|
-
_yield$this$patch3 =
|
|
11526
|
+
_yield$this$patch3 = _context78.sent;
|
|
10907
11527
|
campaign = _yield$this$patch3.campaign;
|
|
10908
|
-
return
|
|
11528
|
+
return _context78.abrupt("return", campaign);
|
|
10909
11529
|
|
|
10910
11530
|
case 5:
|
|
10911
11531
|
case "end":
|
|
10912
|
-
return
|
|
11532
|
+
return _context78.stop();
|
|
10913
11533
|
}
|
|
10914
11534
|
}
|
|
10915
|
-
},
|
|
11535
|
+
}, _callee78, this);
|
|
10916
11536
|
}));
|
|
10917
11537
|
|
|
10918
|
-
function resumeCampaign(
|
|
11538
|
+
function resumeCampaign(_x112) {
|
|
10919
11539
|
return _resumeCampaign.apply(this, arguments);
|
|
10920
11540
|
}
|
|
10921
11541
|
|
|
@@ -10933,77 +11553,35 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10933
11553
|
}, {
|
|
10934
11554
|
key: "testCampaign",
|
|
10935
11555
|
value: function () {
|
|
10936
|
-
var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11556
|
+
var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id, params) {
|
|
10937
11557
|
var users;
|
|
10938
|
-
return _regeneratorRuntime.wrap(function
|
|
11558
|
+
return _regeneratorRuntime.wrap(function _callee79$(_context79) {
|
|
10939
11559
|
while (1) {
|
|
10940
|
-
switch (
|
|
11560
|
+
switch (_context79.prev = _context79.next) {
|
|
10941
11561
|
case 0:
|
|
10942
11562
|
users = params.users;
|
|
10943
|
-
|
|
11563
|
+
_context79.next = 3;
|
|
10944
11564
|
return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
|
|
10945
11565
|
users: users
|
|
10946
11566
|
});
|
|
10947
11567
|
|
|
10948
11568
|
case 3:
|
|
10949
|
-
return
|
|
11569
|
+
return _context79.abrupt("return", _context79.sent);
|
|
10950
11570
|
|
|
10951
11571
|
case 4:
|
|
10952
11572
|
case "end":
|
|
10953
|
-
return
|
|
11573
|
+
return _context79.stop();
|
|
10954
11574
|
}
|
|
10955
11575
|
}
|
|
10956
|
-
},
|
|
11576
|
+
}, _callee79, this);
|
|
10957
11577
|
}));
|
|
10958
11578
|
|
|
10959
|
-
function testCampaign(
|
|
11579
|
+
function testCampaign(_x113, _x114) {
|
|
10960
11580
|
return _testCampaign.apply(this, arguments);
|
|
10961
11581
|
}
|
|
10962
11582
|
|
|
10963
11583
|
return testCampaign;
|
|
10964
11584
|
}()
|
|
10965
|
-
/**
|
|
10966
|
-
* queryRecipients - Query Campaign Recipient Results
|
|
10967
|
-
*
|
|
10968
|
-
*
|
|
10969
|
-
* @return {Recipient[]} Recipients
|
|
10970
|
-
*/
|
|
10971
|
-
|
|
10972
|
-
}, {
|
|
10973
|
-
key: "queryRecipients",
|
|
10974
|
-
value: function () {
|
|
10975
|
-
var _queryRecipients = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(filters) {
|
|
10976
|
-
var options,
|
|
10977
|
-
_args71 = arguments;
|
|
10978
|
-
return _regeneratorRuntime.wrap(function _callee71$(_context71) {
|
|
10979
|
-
while (1) {
|
|
10980
|
-
switch (_context71.prev = _context71.next) {
|
|
10981
|
-
case 0:
|
|
10982
|
-
options = _args71.length > 1 && _args71[1] !== undefined ? _args71[1] : {};
|
|
10983
|
-
_context71.next = 3;
|
|
10984
|
-
return this.get(this.baseURL + "/recipients", {
|
|
10985
|
-
payload: _objectSpread({
|
|
10986
|
-
filter_conditions: filters
|
|
10987
|
-
}, options)
|
|
10988
|
-
});
|
|
10989
|
-
|
|
10990
|
-
case 3:
|
|
10991
|
-
return _context71.abrupt("return", _context71.sent);
|
|
10992
|
-
|
|
10993
|
-
case 4:
|
|
10994
|
-
case "end":
|
|
10995
|
-
return _context71.stop();
|
|
10996
|
-
}
|
|
10997
|
-
}
|
|
10998
|
-
}, _callee71, this);
|
|
10999
|
-
}));
|
|
11000
|
-
|
|
11001
|
-
function queryRecipients(_x95) {
|
|
11002
|
-
return _queryRecipients.apply(this, arguments);
|
|
11003
|
-
}
|
|
11004
|
-
|
|
11005
|
-
return queryRecipients;
|
|
11006
|
-
}()
|
|
11007
11585
|
/**
|
|
11008
11586
|
* enrichURL - Get OpenGraph data of the given link
|
|
11009
11587
|
*
|
|
@@ -11014,24 +11592,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11014
11592
|
}, {
|
|
11015
11593
|
key: "enrichURL",
|
|
11016
11594
|
value: function () {
|
|
11017
|
-
var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11018
|
-
return _regeneratorRuntime.wrap(function
|
|
11595
|
+
var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(url) {
|
|
11596
|
+
return _regeneratorRuntime.wrap(function _callee80$(_context80) {
|
|
11019
11597
|
while (1) {
|
|
11020
|
-
switch (
|
|
11598
|
+
switch (_context80.prev = _context80.next) {
|
|
11021
11599
|
case 0:
|
|
11022
|
-
return
|
|
11600
|
+
return _context80.abrupt("return", this.get(this.baseURL + "/og", {
|
|
11023
11601
|
url: url
|
|
11024
11602
|
}));
|
|
11025
11603
|
|
|
11026
11604
|
case 1:
|
|
11027
11605
|
case "end":
|
|
11028
|
-
return
|
|
11606
|
+
return _context80.stop();
|
|
11029
11607
|
}
|
|
11030
11608
|
}
|
|
11031
|
-
},
|
|
11609
|
+
}, _callee80, this);
|
|
11032
11610
|
}));
|
|
11033
11611
|
|
|
11034
|
-
function enrichURL(
|
|
11612
|
+
function enrichURL(_x115) {
|
|
11035
11613
|
return _enrichURL.apply(this, arguments);
|
|
11036
11614
|
}
|
|
11037
11615
|
|
|
@@ -11048,22 +11626,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11048
11626
|
}, {
|
|
11049
11627
|
key: "getTask",
|
|
11050
11628
|
value: function () {
|
|
11051
|
-
var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11052
|
-
return _regeneratorRuntime.wrap(function
|
|
11629
|
+
var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
|
|
11630
|
+
return _regeneratorRuntime.wrap(function _callee81$(_context81) {
|
|
11053
11631
|
while (1) {
|
|
11054
|
-
switch (
|
|
11632
|
+
switch (_context81.prev = _context81.next) {
|
|
11055
11633
|
case 0:
|
|
11056
|
-
return
|
|
11634
|
+
return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
|
|
11057
11635
|
|
|
11058
11636
|
case 1:
|
|
11059
11637
|
case "end":
|
|
11060
|
-
return
|
|
11638
|
+
return _context81.stop();
|
|
11061
11639
|
}
|
|
11062
11640
|
}
|
|
11063
|
-
},
|
|
11641
|
+
}, _callee81, this);
|
|
11064
11642
|
}));
|
|
11065
11643
|
|
|
11066
|
-
function getTask(
|
|
11644
|
+
function getTask(_x116) {
|
|
11067
11645
|
return _getTask.apply(this, arguments);
|
|
11068
11646
|
}
|
|
11069
11647
|
|
|
@@ -11081,31 +11659,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11081
11659
|
}, {
|
|
11082
11660
|
key: "deleteChannels",
|
|
11083
11661
|
value: function () {
|
|
11084
|
-
var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11662
|
+
var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(cids) {
|
|
11085
11663
|
var options,
|
|
11086
|
-
|
|
11087
|
-
return _regeneratorRuntime.wrap(function
|
|
11664
|
+
_args82 = arguments;
|
|
11665
|
+
return _regeneratorRuntime.wrap(function _callee82$(_context82) {
|
|
11088
11666
|
while (1) {
|
|
11089
|
-
switch (
|
|
11667
|
+
switch (_context82.prev = _context82.next) {
|
|
11090
11668
|
case 0:
|
|
11091
|
-
options =
|
|
11092
|
-
|
|
11669
|
+
options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
|
|
11670
|
+
_context82.next = 3;
|
|
11093
11671
|
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
11094
11672
|
cids: cids
|
|
11095
11673
|
}, options));
|
|
11096
11674
|
|
|
11097
11675
|
case 3:
|
|
11098
|
-
return
|
|
11676
|
+
return _context82.abrupt("return", _context82.sent);
|
|
11099
11677
|
|
|
11100
11678
|
case 4:
|
|
11101
11679
|
case "end":
|
|
11102
|
-
return
|
|
11680
|
+
return _context82.stop();
|
|
11103
11681
|
}
|
|
11104
11682
|
}
|
|
11105
|
-
},
|
|
11683
|
+
}, _callee82, this);
|
|
11106
11684
|
}));
|
|
11107
11685
|
|
|
11108
|
-
function deleteChannels(
|
|
11686
|
+
function deleteChannels(_x117) {
|
|
11109
11687
|
return _deleteChannels.apply(this, arguments);
|
|
11110
11688
|
}
|
|
11111
11689
|
|
|
@@ -11123,17 +11701,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11123
11701
|
}, {
|
|
11124
11702
|
key: "deleteUsers",
|
|
11125
11703
|
value: function () {
|
|
11126
|
-
var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11704
|
+
var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(user_ids) {
|
|
11127
11705
|
var options,
|
|
11128
|
-
|
|
11129
|
-
return _regeneratorRuntime.wrap(function
|
|
11706
|
+
_args83 = arguments;
|
|
11707
|
+
return _regeneratorRuntime.wrap(function _callee83$(_context83) {
|
|
11130
11708
|
while (1) {
|
|
11131
|
-
switch (
|
|
11709
|
+
switch (_context83.prev = _context83.next) {
|
|
11132
11710
|
case 0:
|
|
11133
|
-
options =
|
|
11711
|
+
options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
|
|
11134
11712
|
|
|
11135
11713
|
if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
|
|
11136
|
-
|
|
11714
|
+
_context83.next = 3;
|
|
11137
11715
|
break;
|
|
11138
11716
|
}
|
|
11139
11717
|
|
|
@@ -11141,7 +11719,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11141
11719
|
|
|
11142
11720
|
case 3:
|
|
11143
11721
|
if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
|
|
11144
|
-
|
|
11722
|
+
_context83.next = 5;
|
|
11145
11723
|
break;
|
|
11146
11724
|
}
|
|
11147
11725
|
|
|
@@ -11149,30 +11727,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11149
11727
|
|
|
11150
11728
|
case 5:
|
|
11151
11729
|
if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
|
|
11152
|
-
|
|
11730
|
+
_context83.next = 7;
|
|
11153
11731
|
break;
|
|
11154
11732
|
}
|
|
11155
11733
|
|
|
11156
11734
|
throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
|
|
11157
11735
|
|
|
11158
11736
|
case 7:
|
|
11159
|
-
|
|
11737
|
+
_context83.next = 9;
|
|
11160
11738
|
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
11161
11739
|
user_ids: user_ids
|
|
11162
11740
|
}, options));
|
|
11163
11741
|
|
|
11164
11742
|
case 9:
|
|
11165
|
-
return
|
|
11743
|
+
return _context83.abrupt("return", _context83.sent);
|
|
11166
11744
|
|
|
11167
11745
|
case 10:
|
|
11168
11746
|
case "end":
|
|
11169
|
-
return
|
|
11747
|
+
return _context83.stop();
|
|
11170
11748
|
}
|
|
11171
11749
|
}
|
|
11172
|
-
},
|
|
11750
|
+
}, _callee83, this);
|
|
11173
11751
|
}));
|
|
11174
11752
|
|
|
11175
|
-
function deleteUsers(
|
|
11753
|
+
function deleteUsers(_x118) {
|
|
11176
11754
|
return _deleteUsers.apply(this, arguments);
|
|
11177
11755
|
}
|
|
11178
11756
|
|
|
@@ -11193,28 +11771,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11193
11771
|
}, {
|
|
11194
11772
|
key: "_createImportURL",
|
|
11195
11773
|
value: function () {
|
|
11196
|
-
var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11197
|
-
return _regeneratorRuntime.wrap(function
|
|
11774
|
+
var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(filename) {
|
|
11775
|
+
return _regeneratorRuntime.wrap(function _callee84$(_context84) {
|
|
11198
11776
|
while (1) {
|
|
11199
|
-
switch (
|
|
11777
|
+
switch (_context84.prev = _context84.next) {
|
|
11200
11778
|
case 0:
|
|
11201
|
-
|
|
11779
|
+
_context84.next = 2;
|
|
11202
11780
|
return this.post(this.baseURL + "/import_urls", {
|
|
11203
11781
|
filename: filename
|
|
11204
11782
|
});
|
|
11205
11783
|
|
|
11206
11784
|
case 2:
|
|
11207
|
-
return
|
|
11785
|
+
return _context84.abrupt("return", _context84.sent);
|
|
11208
11786
|
|
|
11209
11787
|
case 3:
|
|
11210
11788
|
case "end":
|
|
11211
|
-
return
|
|
11789
|
+
return _context84.stop();
|
|
11212
11790
|
}
|
|
11213
11791
|
}
|
|
11214
|
-
},
|
|
11792
|
+
}, _callee84, this);
|
|
11215
11793
|
}));
|
|
11216
11794
|
|
|
11217
|
-
function _createImportURL(
|
|
11795
|
+
function _createImportURL(_x119) {
|
|
11218
11796
|
return _createImportURL2.apply(this, arguments);
|
|
11219
11797
|
}
|
|
11220
11798
|
|
|
@@ -11236,33 +11814,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11236
11814
|
}, {
|
|
11237
11815
|
key: "_createImport",
|
|
11238
11816
|
value: function () {
|
|
11239
|
-
var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11817
|
+
var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(path) {
|
|
11240
11818
|
var options,
|
|
11241
|
-
|
|
11242
|
-
return _regeneratorRuntime.wrap(function
|
|
11819
|
+
_args85 = arguments;
|
|
11820
|
+
return _regeneratorRuntime.wrap(function _callee85$(_context85) {
|
|
11243
11821
|
while (1) {
|
|
11244
|
-
switch (
|
|
11822
|
+
switch (_context85.prev = _context85.next) {
|
|
11245
11823
|
case 0:
|
|
11246
|
-
options =
|
|
11824
|
+
options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
|
|
11247
11825
|
mode: 'upsert'
|
|
11248
11826
|
};
|
|
11249
|
-
|
|
11827
|
+
_context85.next = 3;
|
|
11250
11828
|
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
11251
11829
|
path: path
|
|
11252
11830
|
}, options));
|
|
11253
11831
|
|
|
11254
11832
|
case 3:
|
|
11255
|
-
return
|
|
11833
|
+
return _context85.abrupt("return", _context85.sent);
|
|
11256
11834
|
|
|
11257
11835
|
case 4:
|
|
11258
11836
|
case "end":
|
|
11259
|
-
return
|
|
11837
|
+
return _context85.stop();
|
|
11260
11838
|
}
|
|
11261
11839
|
}
|
|
11262
|
-
},
|
|
11840
|
+
}, _callee85, this);
|
|
11263
11841
|
}));
|
|
11264
11842
|
|
|
11265
|
-
function _createImport(
|
|
11843
|
+
function _createImport(_x120) {
|
|
11266
11844
|
return _createImport2.apply(this, arguments);
|
|
11267
11845
|
}
|
|
11268
11846
|
|
|
@@ -11284,26 +11862,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11284
11862
|
}, {
|
|
11285
11863
|
key: "_getImport",
|
|
11286
11864
|
value: function () {
|
|
11287
|
-
var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11288
|
-
return _regeneratorRuntime.wrap(function
|
|
11865
|
+
var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(id) {
|
|
11866
|
+
return _regeneratorRuntime.wrap(function _callee86$(_context86) {
|
|
11289
11867
|
while (1) {
|
|
11290
|
-
switch (
|
|
11868
|
+
switch (_context86.prev = _context86.next) {
|
|
11291
11869
|
case 0:
|
|
11292
|
-
|
|
11870
|
+
_context86.next = 2;
|
|
11293
11871
|
return this.get(this.baseURL + "/imports/".concat(id));
|
|
11294
11872
|
|
|
11295
11873
|
case 2:
|
|
11296
|
-
return
|
|
11874
|
+
return _context86.abrupt("return", _context86.sent);
|
|
11297
11875
|
|
|
11298
11876
|
case 3:
|
|
11299
11877
|
case "end":
|
|
11300
|
-
return
|
|
11878
|
+
return _context86.stop();
|
|
11301
11879
|
}
|
|
11302
11880
|
}
|
|
11303
|
-
},
|
|
11881
|
+
}, _callee86, this);
|
|
11304
11882
|
}));
|
|
11305
11883
|
|
|
11306
|
-
function _getImport(
|
|
11884
|
+
function _getImport(_x121) {
|
|
11307
11885
|
return _getImport2.apply(this, arguments);
|
|
11308
11886
|
}
|
|
11309
11887
|
|
|
@@ -11325,26 +11903,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11325
11903
|
}, {
|
|
11326
11904
|
key: "_listImports",
|
|
11327
11905
|
value: function () {
|
|
11328
|
-
var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11329
|
-
return _regeneratorRuntime.wrap(function
|
|
11906
|
+
var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(options) {
|
|
11907
|
+
return _regeneratorRuntime.wrap(function _callee87$(_context87) {
|
|
11330
11908
|
while (1) {
|
|
11331
|
-
switch (
|
|
11909
|
+
switch (_context87.prev = _context87.next) {
|
|
11332
11910
|
case 0:
|
|
11333
|
-
|
|
11911
|
+
_context87.next = 2;
|
|
11334
11912
|
return this.get(this.baseURL + "/imports", options);
|
|
11335
11913
|
|
|
11336
11914
|
case 2:
|
|
11337
|
-
return
|
|
11915
|
+
return _context87.abrupt("return", _context87.sent);
|
|
11338
11916
|
|
|
11339
11917
|
case 3:
|
|
11340
11918
|
case "end":
|
|
11341
|
-
return
|
|
11919
|
+
return _context87.stop();
|
|
11342
11920
|
}
|
|
11343
11921
|
}
|
|
11344
|
-
},
|
|
11922
|
+
}, _callee87, this);
|
|
11345
11923
|
}));
|
|
11346
11924
|
|
|
11347
|
-
function _listImports(
|
|
11925
|
+
function _listImports(_x122) {
|
|
11348
11926
|
return _listImports2.apply(this, arguments);
|
|
11349
11927
|
}
|
|
11350
11928
|
|
|
@@ -11363,28 +11941,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11363
11941
|
}, {
|
|
11364
11942
|
key: "upsertPushProvider",
|
|
11365
11943
|
value: function () {
|
|
11366
|
-
var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11367
|
-
return _regeneratorRuntime.wrap(function
|
|
11944
|
+
var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(pushProvider) {
|
|
11945
|
+
return _regeneratorRuntime.wrap(function _callee88$(_context88) {
|
|
11368
11946
|
while (1) {
|
|
11369
|
-
switch (
|
|
11947
|
+
switch (_context88.prev = _context88.next) {
|
|
11370
11948
|
case 0:
|
|
11371
|
-
|
|
11949
|
+
_context88.next = 2;
|
|
11372
11950
|
return this.post(this.baseURL + "/push_providers", {
|
|
11373
11951
|
push_provider: pushProvider
|
|
11374
11952
|
});
|
|
11375
11953
|
|
|
11376
11954
|
case 2:
|
|
11377
|
-
return
|
|
11955
|
+
return _context88.abrupt("return", _context88.sent);
|
|
11378
11956
|
|
|
11379
11957
|
case 3:
|
|
11380
11958
|
case "end":
|
|
11381
|
-
return
|
|
11959
|
+
return _context88.stop();
|
|
11382
11960
|
}
|
|
11383
11961
|
}
|
|
11384
|
-
},
|
|
11962
|
+
}, _callee88, this);
|
|
11385
11963
|
}));
|
|
11386
11964
|
|
|
11387
|
-
function upsertPushProvider(
|
|
11965
|
+
function upsertPushProvider(_x123) {
|
|
11388
11966
|
return _upsertPushProvider.apply(this, arguments);
|
|
11389
11967
|
}
|
|
11390
11968
|
|
|
@@ -11403,28 +11981,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11403
11981
|
}, {
|
|
11404
11982
|
key: "deletePushProvider",
|
|
11405
11983
|
value: function () {
|
|
11406
|
-
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11984
|
+
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(_ref10) {
|
|
11407
11985
|
var type, name;
|
|
11408
|
-
return _regeneratorRuntime.wrap(function
|
|
11986
|
+
return _regeneratorRuntime.wrap(function _callee89$(_context89) {
|
|
11409
11987
|
while (1) {
|
|
11410
|
-
switch (
|
|
11988
|
+
switch (_context89.prev = _context89.next) {
|
|
11411
11989
|
case 0:
|
|
11412
11990
|
type = _ref10.type, name = _ref10.name;
|
|
11413
|
-
|
|
11991
|
+
_context89.next = 3;
|
|
11414
11992
|
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
11415
11993
|
|
|
11416
11994
|
case 3:
|
|
11417
|
-
return
|
|
11995
|
+
return _context89.abrupt("return", _context89.sent);
|
|
11418
11996
|
|
|
11419
11997
|
case 4:
|
|
11420
11998
|
case "end":
|
|
11421
|
-
return
|
|
11999
|
+
return _context89.stop();
|
|
11422
12000
|
}
|
|
11423
12001
|
}
|
|
11424
|
-
},
|
|
12002
|
+
}, _callee89, this);
|
|
11425
12003
|
}));
|
|
11426
12004
|
|
|
11427
|
-
function deletePushProvider(
|
|
12005
|
+
function deletePushProvider(_x124) {
|
|
11428
12006
|
return _deletePushProvider.apply(this, arguments);
|
|
11429
12007
|
}
|
|
11430
12008
|
|
|
@@ -11441,23 +12019,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11441
12019
|
}, {
|
|
11442
12020
|
key: "listPushProviders",
|
|
11443
12021
|
value: function () {
|
|
11444
|
-
var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11445
|
-
return _regeneratorRuntime.wrap(function
|
|
12022
|
+
var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90() {
|
|
12023
|
+
return _regeneratorRuntime.wrap(function _callee90$(_context90) {
|
|
11446
12024
|
while (1) {
|
|
11447
|
-
switch (
|
|
12025
|
+
switch (_context90.prev = _context90.next) {
|
|
11448
12026
|
case 0:
|
|
11449
|
-
|
|
12027
|
+
_context90.next = 2;
|
|
11450
12028
|
return this.get(this.baseURL + "/push_providers");
|
|
11451
12029
|
|
|
11452
12030
|
case 2:
|
|
11453
|
-
return
|
|
12031
|
+
return _context90.abrupt("return", _context90.sent);
|
|
11454
12032
|
|
|
11455
12033
|
case 3:
|
|
11456
12034
|
case "end":
|
|
11457
|
-
return
|
|
12035
|
+
return _context90.stop();
|
|
11458
12036
|
}
|
|
11459
12037
|
}
|
|
11460
|
-
},
|
|
12038
|
+
}, _callee90, this);
|
|
11461
12039
|
}));
|
|
11462
12040
|
|
|
11463
12041
|
function listPushProviders() {
|
|
@@ -11485,26 +12063,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11485
12063
|
}, {
|
|
11486
12064
|
key: "commitMessage",
|
|
11487
12065
|
value: function () {
|
|
11488
|
-
var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11489
|
-
return _regeneratorRuntime.wrap(function
|
|
12066
|
+
var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91(id) {
|
|
12067
|
+
return _regeneratorRuntime.wrap(function _callee91$(_context91) {
|
|
11490
12068
|
while (1) {
|
|
11491
|
-
switch (
|
|
12069
|
+
switch (_context91.prev = _context91.next) {
|
|
11492
12070
|
case 0:
|
|
11493
|
-
|
|
12071
|
+
_context91.next = 2;
|
|
11494
12072
|
return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
|
|
11495
12073
|
|
|
11496
12074
|
case 2:
|
|
11497
|
-
return
|
|
12075
|
+
return _context91.abrupt("return", _context91.sent);
|
|
11498
12076
|
|
|
11499
12077
|
case 3:
|
|
11500
12078
|
case "end":
|
|
11501
|
-
return
|
|
12079
|
+
return _context91.stop();
|
|
11502
12080
|
}
|
|
11503
12081
|
}
|
|
11504
|
-
},
|
|
12082
|
+
}, _callee91, this);
|
|
11505
12083
|
}));
|
|
11506
12084
|
|
|
11507
|
-
function commitMessage(
|
|
12085
|
+
function commitMessage(_x125) {
|
|
11508
12086
|
return _commitMessage.apply(this, arguments);
|
|
11509
12087
|
}
|
|
11510
12088
|
|
|
@@ -11556,9 +12134,11 @@ var EVENT_MAP = {
|
|
|
11556
12134
|
'notification.invite_rejected': true,
|
|
11557
12135
|
'notification.invited': true,
|
|
11558
12136
|
'notification.mark_read': true,
|
|
12137
|
+
'notification.mark_unread': true,
|
|
11559
12138
|
'notification.message_new': true,
|
|
11560
12139
|
'notification.mutes_updated': true,
|
|
11561
12140
|
'notification.removed_from_channel': true,
|
|
12141
|
+
'notification.thread_message_new': true,
|
|
11562
12142
|
'reaction.deleted': true,
|
|
11563
12143
|
'reaction.new': true,
|
|
11564
12144
|
'reaction.updated': true,
|
|
@@ -11654,5 +12234,5 @@ var BuiltinPermissions = {
|
|
|
11654
12234
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
11655
12235
|
};
|
|
11656
12236
|
|
|
11657
|
-
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
|
|
12237
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
|
|
11658
12238
|
//# sourceMappingURL=browser.es.js.map
|