stream-chat 8.15.0 → 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 +1018 -668
- 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 +1019 -667
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +1018 -668
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1019 -667
- 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.map +1 -1
- package/dist/types/client.d.ts +40 -27
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/events.d.ts +1 -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 +54 -0
- 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 +4 -2
- package/src/channel_state.ts +2 -58
- package/src/client.ts +103 -0
- package/src/events.ts +1 -0
- package/src/index.ts +2 -1
- package/src/thread.ts +116 -0
- package/src/types.ts +61 -0
- package/src/utils.ts +101 -1
package/dist/index.es.js
CHANGED
|
@@ -94,9 +94,347 @@ var decodeBase64 = function decodeBase64(s) {
|
|
|
94
94
|
return r;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
function ownKeys$
|
|
97
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
98
98
|
|
|
99
|
-
function _objectSpread$
|
|
99
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
100
|
+
|
|
101
|
+
function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
102
|
+
|
|
103
|
+
function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
|
|
104
|
+
|
|
105
|
+
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
109
|
+
* use this when you want to run the promise and handle errors by logging a warning
|
|
110
|
+
*
|
|
111
|
+
* @param {Promise<T>} promise The promise you want to run and log
|
|
112
|
+
* @param {string} name A descriptive name of what the promise does for log output
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
function logChatPromiseExecution(promise, name) {
|
|
116
|
+
promise.then().catch(function (error) {
|
|
117
|
+
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
var sleep = function sleep(m) {
|
|
121
|
+
return new Promise(function (r) {
|
|
122
|
+
return setTimeout(r, m);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
function isFunction(value) {
|
|
126
|
+
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
127
|
+
}
|
|
128
|
+
var chatCodes = {
|
|
129
|
+
TOKEN_EXPIRED: 40,
|
|
130
|
+
WS_CLOSED_SUCCESS: 1000
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
function isReadableStream(obj) {
|
|
134
|
+
return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function isBuffer(obj) {
|
|
138
|
+
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
139
|
+
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
140
|
+
obj.constructor.isBuffer(obj);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isFileWebAPI(uri) {
|
|
144
|
+
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function isOwnUser(user) {
|
|
148
|
+
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function isBlobWebAPI(uri) {
|
|
152
|
+
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function isOwnUserBaseProperty(property) {
|
|
156
|
+
var ownUserBaseProperties = {
|
|
157
|
+
channel_mutes: true,
|
|
158
|
+
devices: true,
|
|
159
|
+
mutes: true,
|
|
160
|
+
total_unread_count: true,
|
|
161
|
+
unread_channels: true,
|
|
162
|
+
unread_count: true,
|
|
163
|
+
invisible: true,
|
|
164
|
+
roles: true
|
|
165
|
+
};
|
|
166
|
+
return ownUserBaseProperties[property];
|
|
167
|
+
}
|
|
168
|
+
function addFileToFormData(uri, name, contentType) {
|
|
169
|
+
var data = new FormData();
|
|
170
|
+
|
|
171
|
+
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
172
|
+
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
173
|
+
} else {
|
|
174
|
+
data.append('file', {
|
|
175
|
+
uri: uri,
|
|
176
|
+
name: name || uri.split('/').reverse()[0],
|
|
177
|
+
contentType: contentType || undefined,
|
|
178
|
+
type: contentType || undefined
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return data;
|
|
183
|
+
}
|
|
184
|
+
function normalizeQuerySort(sort) {
|
|
185
|
+
var sortFields = [];
|
|
186
|
+
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
187
|
+
|
|
188
|
+
var _iterator = _createForOfIteratorHelper$4(sortArr),
|
|
189
|
+
_step;
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
193
|
+
var item = _step.value;
|
|
194
|
+
var entries = Object.entries(item);
|
|
195
|
+
|
|
196
|
+
if (entries.length > 1) {
|
|
197
|
+
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
201
|
+
var _entries$_i = _slicedToArray(_entries[_i], 2),
|
|
202
|
+
field = _entries$_i[0],
|
|
203
|
+
direction = _entries$_i[1];
|
|
204
|
+
|
|
205
|
+
sortFields.push({
|
|
206
|
+
field: field,
|
|
207
|
+
direction: direction
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
} catch (err) {
|
|
212
|
+
_iterator.e(err);
|
|
213
|
+
} finally {
|
|
214
|
+
_iterator.f();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return sortFields;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* retryInterval - A retry interval which increases acc to number of failures
|
|
221
|
+
*
|
|
222
|
+
* @return {number} Duration to wait in milliseconds
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
function retryInterval(numberOfFailures) {
|
|
226
|
+
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
227
|
+
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
228
|
+
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
229
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
230
|
+
}
|
|
231
|
+
function randomId() {
|
|
232
|
+
return generateUUIDv4();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function hex(bytes) {
|
|
236
|
+
var s = '';
|
|
237
|
+
|
|
238
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
239
|
+
s += bytes[i].toString(16).padStart(2, '0');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return s;
|
|
243
|
+
} // https://tools.ietf.org/html/rfc4122
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
function generateUUIDv4() {
|
|
247
|
+
var bytes = getRandomBytes(16);
|
|
248
|
+
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
249
|
+
|
|
250
|
+
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
251
|
+
|
|
252
|
+
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function getRandomValuesWithMathRandom(bytes) {
|
|
256
|
+
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
257
|
+
|
|
258
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
259
|
+
bytes[i] = Math.random() * max;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
var getRandomValues = function () {
|
|
264
|
+
var _crypto;
|
|
265
|
+
|
|
266
|
+
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
267
|
+
return crypto.getRandomValues.bind(crypto);
|
|
268
|
+
} else if (typeof msCrypto !== 'undefined') {
|
|
269
|
+
return msCrypto.getRandomValues.bind(msCrypto);
|
|
270
|
+
} else {
|
|
271
|
+
return getRandomValuesWithMathRandom;
|
|
272
|
+
}
|
|
273
|
+
}();
|
|
274
|
+
|
|
275
|
+
function getRandomBytes(length) {
|
|
276
|
+
var bytes = new Uint8Array(length);
|
|
277
|
+
getRandomValues(bytes);
|
|
278
|
+
return bytes;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function convertErrorToJson(err) {
|
|
282
|
+
var jsonObj = {};
|
|
283
|
+
if (!err) return jsonObj;
|
|
284
|
+
|
|
285
|
+
try {
|
|
286
|
+
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
287
|
+
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
288
|
+
});
|
|
289
|
+
} catch (_) {
|
|
290
|
+
return {
|
|
291
|
+
error: 'failed to serialize the error'
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return jsonObj;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* isOnline safely return the navigator.online value for browser env
|
|
299
|
+
* if navigator is not in global object, it always return true
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
function isOnline() {
|
|
303
|
+
var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
|
|
304
|
+
|
|
305
|
+
if (!nav) {
|
|
306
|
+
console.warn('isOnline failed to access window.navigator and assume browser is online');
|
|
307
|
+
return true;
|
|
308
|
+
} // RN navigator has undefined for onLine
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
if (typeof nav.onLine !== 'boolean') {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return nav.onLine;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
function addConnectionEventListeners(cb) {
|
|
322
|
+
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
323
|
+
window.addEventListener('offline', cb);
|
|
324
|
+
window.addEventListener('online', cb);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function removeConnectionEventListeners(cb) {
|
|
328
|
+
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
329
|
+
window.removeEventListener('offline', cb);
|
|
330
|
+
window.removeEventListener('online', cb);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
334
|
+
var newParams = [];
|
|
335
|
+
|
|
336
|
+
for (var k in params) {
|
|
337
|
+
// Stream backend doesn't treat "undefined" value same as value not being present.
|
|
338
|
+
// So, we need to skip the undefined values.
|
|
339
|
+
if (params[k] === undefined) continue;
|
|
340
|
+
|
|
341
|
+
if (Array.isArray(params[k]) || _typeof(params[k]) === 'object') {
|
|
342
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(JSON.stringify(params[k]))));
|
|
343
|
+
} else {
|
|
344
|
+
newParams.push("".concat(k, "=").concat(encodeURIComponent(params[k])));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return newParams.join('&');
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
352
|
+
* and sets the status to received if missing. Returns a message object
|
|
353
|
+
*
|
|
354
|
+
* @param {MessageResponse<StreamChatGenerics>} message a message object
|
|
355
|
+
*
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
function formatMessage(message) {
|
|
359
|
+
return _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
360
|
+
/**
|
|
361
|
+
* @deprecated please use `html`
|
|
362
|
+
*/
|
|
363
|
+
__html: message.html,
|
|
364
|
+
// parse the date..
|
|
365
|
+
pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
|
|
366
|
+
created_at: message.created_at ? new Date(message.created_at) : new Date(),
|
|
367
|
+
updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
|
|
368
|
+
status: message.status || 'received'
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
function addToMessageList(messages, message) {
|
|
372
|
+
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
373
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
374
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
375
|
+
var addMessageToList = addIfDoesNotExist || timestampChanged;
|
|
376
|
+
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
377
|
+
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
378
|
+
|
|
379
|
+
if (timestampChanged) {
|
|
380
|
+
messageArr = messageArr.filter(function (msg) {
|
|
381
|
+
return !(msg.id && message.id === msg.id);
|
|
382
|
+
});
|
|
383
|
+
} // Get array length after filtering
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
387
|
+
|
|
388
|
+
if (messageArrayLength === 0 && addMessageToList) {
|
|
389
|
+
return messageArr.concat(message);
|
|
390
|
+
} else if (messageArrayLength === 0) {
|
|
391
|
+
return _toConsumableArray(messageArr);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
var messageTime = message[sortBy].getTime();
|
|
395
|
+
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
396
|
+
|
|
397
|
+
if (messageIsNewest && addMessageToList) {
|
|
398
|
+
return messageArr.concat(message);
|
|
399
|
+
} else if (messageIsNewest) {
|
|
400
|
+
return _toConsumableArray(messageArr);
|
|
401
|
+
} // find the closest index to push the new message
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
var left = 0;
|
|
405
|
+
var middle = 0;
|
|
406
|
+
var right = messageArrayLength - 1;
|
|
407
|
+
|
|
408
|
+
while (left <= right) {
|
|
409
|
+
middle = Math.floor((right + left) / 2);
|
|
410
|
+
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
411
|
+
} // message already exists and not filtered due to timestampChanged, update and return
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
if (!timestampChanged && message.id) {
|
|
415
|
+
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
416
|
+
messageArr[left] = message;
|
|
417
|
+
return _toConsumableArray(messageArr);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
421
|
+
messageArr[left - 1] = message;
|
|
422
|
+
return _toConsumableArray(messageArr);
|
|
423
|
+
}
|
|
424
|
+
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
425
|
+
// or have a timestamp change.
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
if (addMessageToList) {
|
|
429
|
+
messageArr.splice(left, 0, message);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return _toConsumableArray(messageArr);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
436
|
+
|
|
437
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
100
438
|
|
|
101
439
|
/**
|
|
102
440
|
* ChannelState - A container class for the channel state.
|
|
@@ -173,7 +511,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
173
511
|
var m = messages[i];
|
|
174
512
|
|
|
175
513
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
176
|
-
messages[i] = _objectSpread$
|
|
514
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
177
515
|
user: user
|
|
178
516
|
});
|
|
179
517
|
}
|
|
@@ -228,7 +566,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
228
566
|
user: m.user
|
|
229
567
|
};
|
|
230
568
|
} else {
|
|
231
|
-
messages[i] = _objectSpread$
|
|
569
|
+
messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
232
570
|
type: 'deleted',
|
|
233
571
|
deleted_at: user.deleted_at
|
|
234
572
|
});
|
|
@@ -335,7 +673,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
335
673
|
}, {
|
|
336
674
|
key: "formatMessage",
|
|
337
675
|
value: function formatMessage(message) {
|
|
338
|
-
return _objectSpread$
|
|
676
|
+
return _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
339
677
|
/**
|
|
340
678
|
* @deprecated please use `html`
|
|
341
679
|
*/
|
|
@@ -553,7 +891,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
553
891
|
var parseMessage = function parseMessage(m) {
|
|
554
892
|
var _m$pinned_at, _m$updated_at;
|
|
555
893
|
|
|
556
|
-
return _objectSpread$
|
|
894
|
+
return _objectSpread$7(_objectSpread$7({}, m), {}, {
|
|
557
895
|
created_at: m.created_at.toISOString(),
|
|
558
896
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
559
897
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -564,8 +902,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
564
902
|
var updatedMessages = set.messages.filter(function (msg) {
|
|
565
903
|
return msg.quoted_message_id === message.id;
|
|
566
904
|
}).map(parseMessage).map(function (msg) {
|
|
567
|
-
return _objectSpread$
|
|
568
|
-
quoted_message: _objectSpread$
|
|
905
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
906
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
569
907
|
attachments: []
|
|
570
908
|
})
|
|
571
909
|
});
|
|
@@ -641,71 +979,14 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
641
979
|
* @param {Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>} messages A list of messages
|
|
642
980
|
* @param message
|
|
643
981
|
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
644
|
-
* @param {string} sortBy field name to use to sort the messages by
|
|
645
|
-
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
646
|
-
*/
|
|
647
|
-
function _addToMessageList(messages, message) {
|
|
648
|
-
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
649
|
-
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
650
|
-
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
651
|
-
|
|
652
|
-
var messageArr = messages; // if created_at has changed, message should be filtered and re-inserted in correct order
|
|
653
|
-
// slow op but usually this only happens for a message inserted to state before actual response with correct timestamp
|
|
654
|
-
|
|
655
|
-
if (timestampChanged) {
|
|
656
|
-
messageArr = messageArr.filter(function (msg) {
|
|
657
|
-
return !(msg.id && message.id === msg.id);
|
|
658
|
-
});
|
|
659
|
-
} // Get array length after filtering
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
var messageArrayLength = messageArr.length; // for empty list just concat and return unless it's an update or deletion
|
|
663
|
-
|
|
664
|
-
if (messageArrayLength === 0 && addMessageToList) {
|
|
665
|
-
return messageArr.concat(message);
|
|
666
|
-
} else if (messageArrayLength === 0) {
|
|
667
|
-
return _toConsumableArray(messageArr);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
var messageTime = message[sortBy].getTime();
|
|
671
|
-
var messageIsNewest = messageArr[messageArrayLength - 1][sortBy].getTime() < messageTime; // if message is newer than last item in the list concat and return unless it's an update or deletion
|
|
672
|
-
|
|
673
|
-
if (messageIsNewest && addMessageToList) {
|
|
674
|
-
return messageArr.concat(message);
|
|
675
|
-
} else if (messageIsNewest) {
|
|
676
|
-
return _toConsumableArray(messageArr);
|
|
677
|
-
} // find the closest index to push the new message
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
var left = 0;
|
|
681
|
-
var middle = 0;
|
|
682
|
-
var right = messageArrayLength - 1;
|
|
683
|
-
|
|
684
|
-
while (left <= right) {
|
|
685
|
-
middle = Math.floor((right + left) / 2);
|
|
686
|
-
if (messageArr[middle][sortBy].getTime() <= messageTime) left = middle + 1;else right = middle - 1;
|
|
687
|
-
} // message already exists and not filtered due to timestampChanged, update and return
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (!timestampChanged && message.id) {
|
|
691
|
-
if (messageArr[left] && message.id === messageArr[left].id) {
|
|
692
|
-
messageArr[left] = message;
|
|
693
|
-
return _toConsumableArray(messageArr);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
if (messageArr[left - 1] && message.id === messageArr[left - 1].id) {
|
|
697
|
-
messageArr[left - 1] = message;
|
|
698
|
-
return _toConsumableArray(messageArr);
|
|
699
|
-
}
|
|
700
|
-
} // Do not add updated or deleted messages to the list if they do not already exist
|
|
701
|
-
// or have a timestamp change.
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
if (addMessageToList) {
|
|
705
|
-
messageArr.splice(left, 0, message);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
return _toConsumableArray(messageArr);
|
|
982
|
+
* @param {string} sortBy field name to use to sort the messages by
|
|
983
|
+
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
984
|
+
*/
|
|
985
|
+
function _addToMessageList(messages, message) {
|
|
986
|
+
var timestampChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
987
|
+
var sortBy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'created_at';
|
|
988
|
+
var addIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
989
|
+
return addToMessageList(messages, message, timestampChanged, sortBy, addIfDoesNotExist);
|
|
709
990
|
}
|
|
710
991
|
/**
|
|
711
992
|
* removeMessage - Description
|
|
@@ -1068,277 +1349,27 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1068
1349
|
} else {
|
|
1069
1350
|
// assumes that all new messages belong to the same set
|
|
1070
1351
|
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
return {
|
|
1074
|
-
targetMessageSetIndex: targetMessageSetIndex,
|
|
1075
|
-
messagesToAdd: messagesToAdd
|
|
1076
|
-
};
|
|
1077
|
-
}
|
|
1078
|
-
}]);
|
|
1079
|
-
|
|
1080
|
-
return ChannelState;
|
|
1081
|
-
}();
|
|
1082
|
-
|
|
1083
|
-
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1084
|
-
|
|
1085
|
-
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1086
|
-
|
|
1087
|
-
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1088
|
-
|
|
1089
|
-
/**
|
|
1090
|
-
* logChatPromiseExecution - utility function for logging the execution of a promise..
|
|
1091
|
-
* use this when you want to run the promise and handle errors by logging a warning
|
|
1092
|
-
*
|
|
1093
|
-
* @param {Promise<T>} promise The promise you want to run and log
|
|
1094
|
-
* @param {string} name A descriptive name of what the promise does for log output
|
|
1095
|
-
*
|
|
1096
|
-
*/
|
|
1097
|
-
function logChatPromiseExecution(promise, name) {
|
|
1098
|
-
promise.then().catch(function (error) {
|
|
1099
|
-
console.warn("failed to do ".concat(name, ", ran into error: "), error);
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
var sleep = function sleep(m) {
|
|
1103
|
-
return new Promise(function (r) {
|
|
1104
|
-
return setTimeout(r, m);
|
|
1105
|
-
});
|
|
1106
|
-
};
|
|
1107
|
-
function isFunction(value) {
|
|
1108
|
-
return value && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
1109
|
-
}
|
|
1110
|
-
var chatCodes = {
|
|
1111
|
-
TOKEN_EXPIRED: 40,
|
|
1112
|
-
WS_CLOSED_SUCCESS: 1000
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
|
-
function isReadableStream(obj) {
|
|
1116
|
-
return obj !== null && _typeof(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
function isBuffer(obj) {
|
|
1120
|
-
return obj != null && obj.constructor != null && // @ts-expect-error
|
|
1121
|
-
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
|
|
1122
|
-
obj.constructor.isBuffer(obj);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
function isFileWebAPI(uri) {
|
|
1126
|
-
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
function isOwnUser(user) {
|
|
1130
|
-
return (user === null || user === void 0 ? void 0 : user.total_unread_count) !== undefined;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
function isBlobWebAPI(uri) {
|
|
1134
|
-
return typeof window !== 'undefined' && 'Blob' in window && uri instanceof Blob;
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
function isOwnUserBaseProperty(property) {
|
|
1138
|
-
var ownUserBaseProperties = {
|
|
1139
|
-
channel_mutes: true,
|
|
1140
|
-
devices: true,
|
|
1141
|
-
mutes: true,
|
|
1142
|
-
total_unread_count: true,
|
|
1143
|
-
unread_channels: true,
|
|
1144
|
-
unread_count: true,
|
|
1145
|
-
invisible: true,
|
|
1146
|
-
roles: true
|
|
1147
|
-
};
|
|
1148
|
-
return ownUserBaseProperties[property];
|
|
1149
|
-
}
|
|
1150
|
-
function addFileToFormData(uri, name, contentType) {
|
|
1151
|
-
var data = new FormData();
|
|
1152
|
-
|
|
1153
|
-
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri) || isBlobWebAPI(uri)) {
|
|
1154
|
-
if (name) data.append('file', uri, name);else data.append('file', uri);
|
|
1155
|
-
} else {
|
|
1156
|
-
data.append('file', {
|
|
1157
|
-
uri: uri,
|
|
1158
|
-
name: name || uri.split('/').reverse()[0],
|
|
1159
|
-
contentType: contentType || undefined,
|
|
1160
|
-
type: contentType || undefined
|
|
1161
|
-
});
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
return data;
|
|
1165
|
-
}
|
|
1166
|
-
function normalizeQuerySort(sort) {
|
|
1167
|
-
var sortFields = [];
|
|
1168
|
-
var sortArr = Array.isArray(sort) ? sort : [sort];
|
|
1169
|
-
|
|
1170
|
-
var _iterator = _createForOfIteratorHelper$3(sortArr),
|
|
1171
|
-
_step;
|
|
1172
|
-
|
|
1173
|
-
try {
|
|
1174
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1175
|
-
var item = _step.value;
|
|
1176
|
-
var entries = Object.entries(item);
|
|
1177
|
-
|
|
1178
|
-
if (entries.length > 1) {
|
|
1179
|
-
console.warn("client._buildSort() - multiple fields in a single sort object detected. Object's field order is not guaranteed");
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
|
|
1183
|
-
var _entries$_i = _slicedToArray(_entries[_i], 2),
|
|
1184
|
-
field = _entries$_i[0],
|
|
1185
|
-
direction = _entries$_i[1];
|
|
1186
|
-
|
|
1187
|
-
sortFields.push({
|
|
1188
|
-
field: field,
|
|
1189
|
-
direction: direction
|
|
1190
|
-
});
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
} catch (err) {
|
|
1194
|
-
_iterator.e(err);
|
|
1195
|
-
} finally {
|
|
1196
|
-
_iterator.f();
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
return sortFields;
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* retryInterval - A retry interval which increases acc to number of failures
|
|
1203
|
-
*
|
|
1204
|
-
* @return {number} Duration to wait in milliseconds
|
|
1205
|
-
*/
|
|
1206
|
-
|
|
1207
|
-
function retryInterval(numberOfFailures) {
|
|
1208
|
-
// try to reconnect in 0.25-25 seconds (random to spread out the load from failures)
|
|
1209
|
-
var max = Math.min(500 + numberOfFailures * 2000, 25000);
|
|
1210
|
-
var min = Math.min(Math.max(250, (numberOfFailures - 1) * 2000), 25000);
|
|
1211
|
-
return Math.floor(Math.random() * (max - min) + min);
|
|
1212
|
-
}
|
|
1213
|
-
function randomId() {
|
|
1214
|
-
return generateUUIDv4();
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
function hex(bytes) {
|
|
1218
|
-
var s = '';
|
|
1219
|
-
|
|
1220
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1221
|
-
s += bytes[i].toString(16).padStart(2, '0');
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
return s;
|
|
1225
|
-
} // https://tools.ietf.org/html/rfc4122
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
function generateUUIDv4() {
|
|
1229
|
-
var bytes = getRandomBytes(16);
|
|
1230
|
-
bytes[6] = bytes[6] & 0x0f | 0x40; // version
|
|
1231
|
-
|
|
1232
|
-
bytes[8] = bytes[8] & 0xbf | 0x80; // variant
|
|
1233
|
-
|
|
1234
|
-
return hex(bytes.subarray(0, 4)) + '-' + hex(bytes.subarray(4, 6)) + '-' + hex(bytes.subarray(6, 8)) + '-' + hex(bytes.subarray(8, 10)) + '-' + hex(bytes.subarray(10, 16));
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
function getRandomValuesWithMathRandom(bytes) {
|
|
1238
|
-
var max = Math.pow(2, 8 * bytes.byteLength / bytes.length);
|
|
1239
|
-
|
|
1240
|
-
for (var i = 0; i < bytes.length; i++) {
|
|
1241
|
-
bytes[i] = Math.random() * max;
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
var getRandomValues = function () {
|
|
1246
|
-
var _crypto;
|
|
1247
|
-
|
|
1248
|
-
if (typeof crypto !== 'undefined' && typeof ((_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.getRandomValues) !== 'undefined') {
|
|
1249
|
-
return crypto.getRandomValues.bind(crypto);
|
|
1250
|
-
} else if (typeof msCrypto !== 'undefined') {
|
|
1251
|
-
return msCrypto.getRandomValues.bind(msCrypto);
|
|
1252
|
-
} else {
|
|
1253
|
-
return getRandomValuesWithMathRandom;
|
|
1254
|
-
}
|
|
1255
|
-
}();
|
|
1256
|
-
|
|
1257
|
-
function getRandomBytes(length) {
|
|
1258
|
-
var bytes = new Uint8Array(length);
|
|
1259
|
-
getRandomValues(bytes);
|
|
1260
|
-
return bytes;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
function convertErrorToJson(err) {
|
|
1264
|
-
var jsonObj = {};
|
|
1265
|
-
if (!err) return jsonObj;
|
|
1266
|
-
|
|
1267
|
-
try {
|
|
1268
|
-
Object.getOwnPropertyNames(err).forEach(function (key) {
|
|
1269
|
-
jsonObj[key] = Object.getOwnPropertyDescriptor(err, key);
|
|
1270
|
-
});
|
|
1271
|
-
} catch (_) {
|
|
1272
|
-
return {
|
|
1273
|
-
error: 'failed to serialize the error'
|
|
1274
|
-
};
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
return jsonObj;
|
|
1278
|
-
}
|
|
1279
|
-
/**
|
|
1280
|
-
* isOnline safely return the navigator.online value for browser env
|
|
1281
|
-
* if navigator is not in global object, it always return true
|
|
1282
|
-
*/
|
|
1283
|
-
|
|
1284
|
-
function isOnline() {
|
|
1285
|
-
var nav = typeof navigator !== 'undefined' ? navigator : typeof window !== 'undefined' && window.navigator ? window.navigator : undefined;
|
|
1286
|
-
|
|
1287
|
-
if (!nav) {
|
|
1288
|
-
console.warn('isOnline failed to access window.navigator and assume browser is online');
|
|
1289
|
-
return true;
|
|
1290
|
-
} // RN navigator has undefined for onLine
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
if (typeof nav.onLine !== 'boolean') {
|
|
1294
|
-
return true;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
return nav.onLine;
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
1301
|
-
*/
|
|
1302
|
-
|
|
1303
|
-
function addConnectionEventListeners(cb) {
|
|
1304
|
-
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
1305
|
-
window.addEventListener('offline', cb);
|
|
1306
|
-
window.addEventListener('online', cb);
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
function removeConnectionEventListeners(cb) {
|
|
1310
|
-
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
1311
|
-
window.removeEventListener('offline', cb);
|
|
1312
|
-
window.removeEventListener('online', cb);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
1316
|
-
var newParams = [];
|
|
1317
|
-
|
|
1318
|
-
for (var k in params) {
|
|
1319
|
-
// Stream backend doesn't treat "undefined" value same as value not being present.
|
|
1320
|
-
// So, we need to skip the undefined values.
|
|
1321
|
-
if (params[k] === undefined) continue;
|
|
1352
|
+
}
|
|
1322
1353
|
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1354
|
+
return {
|
|
1355
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1356
|
+
messagesToAdd: messagesToAdd
|
|
1357
|
+
};
|
|
1327
1358
|
}
|
|
1328
|
-
}
|
|
1359
|
+
}]);
|
|
1329
1360
|
|
|
1330
|
-
return
|
|
1331
|
-
};
|
|
1361
|
+
return ChannelState;
|
|
1362
|
+
}();
|
|
1332
1363
|
|
|
1333
|
-
function _createForOfIteratorHelper$
|
|
1364
|
+
function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1334
1365
|
|
|
1335
|
-
function _unsupportedIterableToArray$
|
|
1366
|
+
function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
|
|
1336
1367
|
|
|
1337
|
-
function _arrayLikeToArray$
|
|
1368
|
+
function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1338
1369
|
|
|
1339
|
-
function ownKeys$
|
|
1370
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1340
1371
|
|
|
1341
|
-
function _objectSpread$
|
|
1372
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1342
1373
|
|
|
1343
1374
|
/**
|
|
1344
1375
|
* Channel - The Channel class manages it's own state.
|
|
@@ -1411,7 +1442,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1411
1442
|
while (1) {
|
|
1412
1443
|
switch (_context.prev = _context.next) {
|
|
1413
1444
|
case 0:
|
|
1414
|
-
defaultOptions = _objectSpread$
|
|
1445
|
+
defaultOptions = _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
1415
1446
|
watch: false,
|
|
1416
1447
|
state: false,
|
|
1417
1448
|
presence: false
|
|
@@ -1483,7 +1514,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1483
1514
|
|
|
1484
1515
|
this.data = data; // this._data is used for the requests...
|
|
1485
1516
|
|
|
1486
|
-
this._data = _objectSpread$
|
|
1517
|
+
this._data = _objectSpread$6({}, data);
|
|
1487
1518
|
this.cid = "".concat(type, ":").concat(id);
|
|
1488
1519
|
this.listeners = {}; // perhaps the state variable should be private
|
|
1489
1520
|
|
|
@@ -1545,7 +1576,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1545
1576
|
switch (_context2.prev = _context2.next) {
|
|
1546
1577
|
case 0:
|
|
1547
1578
|
_context2.next = 2;
|
|
1548
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
1579
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$6({
|
|
1549
1580
|
message: message
|
|
1550
1581
|
}, options));
|
|
1551
1582
|
|
|
@@ -1661,7 +1692,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1661
1692
|
|
|
1662
1693
|
case 3:
|
|
1663
1694
|
// Return a list of channels
|
|
1664
|
-
payload = _objectSpread$
|
|
1695
|
+
payload = _objectSpread$6(_objectSpread$6({
|
|
1665
1696
|
filter_conditions: {
|
|
1666
1697
|
cid: this.cid
|
|
1667
1698
|
}
|
|
@@ -1758,7 +1789,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1758
1789
|
|
|
1759
1790
|
_context5.next = 6;
|
|
1760
1791
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
1761
|
-
payload: _objectSpread$
|
|
1792
|
+
payload: _objectSpread$6({
|
|
1762
1793
|
type: type,
|
|
1763
1794
|
id: id,
|
|
1764
1795
|
members: members,
|
|
@@ -1819,7 +1850,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1819
1850
|
|
|
1820
1851
|
case 4:
|
|
1821
1852
|
_context6.next = 6;
|
|
1822
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$
|
|
1853
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$6({
|
|
1823
1854
|
reaction: reaction
|
|
1824
1855
|
}, options));
|
|
1825
1856
|
|
|
@@ -1900,7 +1931,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1900
1931
|
delete channelData[key];
|
|
1901
1932
|
});
|
|
1902
1933
|
_context7.next = 7;
|
|
1903
|
-
return this._update(_objectSpread$
|
|
1934
|
+
return this._update(_objectSpread$6({
|
|
1904
1935
|
message: updateMessage,
|
|
1905
1936
|
data: channelData
|
|
1906
1937
|
}, options));
|
|
@@ -2060,7 +2091,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2060
2091
|
case 0:
|
|
2061
2092
|
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
2062
2093
|
_context11.next = 3;
|
|
2063
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2094
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$6({}, options));
|
|
2064
2095
|
|
|
2065
2096
|
case 3:
|
|
2066
2097
|
return _context11.abrupt("return", _context11.sent);
|
|
@@ -2136,7 +2167,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2136
2167
|
case 0:
|
|
2137
2168
|
options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
2138
2169
|
_context13.next = 3;
|
|
2139
|
-
return this._update(_objectSpread$
|
|
2170
|
+
return this._update(_objectSpread$6({
|
|
2140
2171
|
accept_invite: true
|
|
2141
2172
|
}, options));
|
|
2142
2173
|
|
|
@@ -2177,7 +2208,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2177
2208
|
case 0:
|
|
2178
2209
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2179
2210
|
_context14.next = 3;
|
|
2180
|
-
return this._update(_objectSpread$
|
|
2211
|
+
return this._update(_objectSpread$6({
|
|
2181
2212
|
reject_invite: true
|
|
2182
2213
|
}, options));
|
|
2183
2214
|
|
|
@@ -2219,7 +2250,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2219
2250
|
case 0:
|
|
2220
2251
|
options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
2221
2252
|
_context15.next = 3;
|
|
2222
|
-
return this._update(_objectSpread$
|
|
2253
|
+
return this._update(_objectSpread$6({
|
|
2223
2254
|
add_members: members,
|
|
2224
2255
|
message: message
|
|
2225
2256
|
}, options));
|
|
@@ -2262,7 +2293,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2262
2293
|
case 0:
|
|
2263
2294
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2264
2295
|
_context16.next = 3;
|
|
2265
|
-
return this._update(_objectSpread$
|
|
2296
|
+
return this._update(_objectSpread$6({
|
|
2266
2297
|
add_moderators: members,
|
|
2267
2298
|
message: message
|
|
2268
2299
|
}, options));
|
|
@@ -2305,7 +2336,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2305
2336
|
case 0:
|
|
2306
2337
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2307
2338
|
_context17.next = 3;
|
|
2308
|
-
return this._update(_objectSpread$
|
|
2339
|
+
return this._update(_objectSpread$6({
|
|
2309
2340
|
assign_roles: roles,
|
|
2310
2341
|
message: message
|
|
2311
2342
|
}, options));
|
|
@@ -2348,7 +2379,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2348
2379
|
case 0:
|
|
2349
2380
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2350
2381
|
_context18.next = 3;
|
|
2351
|
-
return this._update(_objectSpread$
|
|
2382
|
+
return this._update(_objectSpread$6({
|
|
2352
2383
|
invites: members,
|
|
2353
2384
|
message: message
|
|
2354
2385
|
}, options));
|
|
@@ -2391,7 +2422,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2391
2422
|
case 0:
|
|
2392
2423
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2393
2424
|
_context19.next = 3;
|
|
2394
|
-
return this._update(_objectSpread$
|
|
2425
|
+
return this._update(_objectSpread$6({
|
|
2395
2426
|
remove_members: members,
|
|
2396
2427
|
message: message
|
|
2397
2428
|
}, options));
|
|
@@ -2434,7 +2465,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2434
2465
|
case 0:
|
|
2435
2466
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
2436
2467
|
_context20.next = 3;
|
|
2437
|
-
return this._update(_objectSpread$
|
|
2468
|
+
return this._update(_objectSpread$6({
|
|
2438
2469
|
demote_moderators: members,
|
|
2439
2470
|
message: message
|
|
2440
2471
|
}, options));
|
|
@@ -2519,7 +2550,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2519
2550
|
case 0:
|
|
2520
2551
|
opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
2521
2552
|
_context22.next = 3;
|
|
2522
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
2553
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$6({
|
|
2523
2554
|
channel_cid: this.cid
|
|
2524
2555
|
}, opts));
|
|
2525
2556
|
|
|
@@ -2561,7 +2592,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2561
2592
|
case 0:
|
|
2562
2593
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
2563
2594
|
_context23.next = 3;
|
|
2564
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
2595
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$6({
|
|
2565
2596
|
channel_cid: this.cid
|
|
2566
2597
|
}, opts));
|
|
2567
2598
|
|
|
@@ -2620,7 +2651,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2620
2651
|
}, {
|
|
2621
2652
|
key: "keystroke",
|
|
2622
2653
|
value: function () {
|
|
2623
|
-
var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id) {
|
|
2654
|
+
var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id, options) {
|
|
2624
2655
|
var _this$getConfig;
|
|
2625
2656
|
|
|
2626
2657
|
var now, diff;
|
|
@@ -2648,10 +2679,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2648
2679
|
|
|
2649
2680
|
this.lastTypingEvent = new Date();
|
|
2650
2681
|
_context24.next = 10;
|
|
2651
|
-
return this.sendEvent({
|
|
2682
|
+
return this.sendEvent(_objectSpread$6({
|
|
2652
2683
|
type: 'typing.start',
|
|
2653
2684
|
parent_id: parent_id
|
|
2654
|
-
});
|
|
2685
|
+
}, options || {}));
|
|
2655
2686
|
|
|
2656
2687
|
case 10:
|
|
2657
2688
|
case "end":
|
|
@@ -2661,7 +2692,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2661
2692
|
}, _callee24, this);
|
|
2662
2693
|
}));
|
|
2663
2694
|
|
|
2664
|
-
function keystroke(_x25) {
|
|
2695
|
+
function keystroke(_x25, _x26) {
|
|
2665
2696
|
return _keystroke.apply(this, arguments);
|
|
2666
2697
|
}
|
|
2667
2698
|
|
|
@@ -2676,7 +2707,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2676
2707
|
}, {
|
|
2677
2708
|
key: "stopTyping",
|
|
2678
2709
|
value: function () {
|
|
2679
|
-
var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id) {
|
|
2710
|
+
var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id, options) {
|
|
2680
2711
|
var _this$getConfig2;
|
|
2681
2712
|
|
|
2682
2713
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
@@ -2694,10 +2725,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2694
2725
|
this.lastTypingEvent = null;
|
|
2695
2726
|
this.isTyping = false;
|
|
2696
2727
|
_context25.next = 6;
|
|
2697
|
-
return this.sendEvent({
|
|
2728
|
+
return this.sendEvent(_objectSpread$6({
|
|
2698
2729
|
type: 'typing.stop',
|
|
2699
2730
|
parent_id: parent_id
|
|
2700
|
-
});
|
|
2731
|
+
}, options || {}));
|
|
2701
2732
|
|
|
2702
2733
|
case 6:
|
|
2703
2734
|
case "end":
|
|
@@ -2707,7 +2738,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2707
2738
|
}, _callee25, this);
|
|
2708
2739
|
}));
|
|
2709
2740
|
|
|
2710
|
-
function stopTyping(
|
|
2741
|
+
function stopTyping(_x27, _x28) {
|
|
2711
2742
|
return _stopTyping.apply(this, arguments);
|
|
2712
2743
|
}
|
|
2713
2744
|
|
|
@@ -2770,7 +2801,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2770
2801
|
|
|
2771
2802
|
case 4:
|
|
2772
2803
|
_context26.next = 6;
|
|
2773
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
2804
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$6({}, data));
|
|
2774
2805
|
|
|
2775
2806
|
case 6:
|
|
2776
2807
|
return _context26.abrupt("return", _context26.sent);
|
|
@@ -2817,7 +2848,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2817
2848
|
|
|
2818
2849
|
case 3:
|
|
2819
2850
|
_context27.next = 5;
|
|
2820
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
2851
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$6({}, data));
|
|
2821
2852
|
|
|
2822
2853
|
case 5:
|
|
2823
2854
|
return _context27.abrupt("return", _context27.sent);
|
|
@@ -2830,7 +2861,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2830
2861
|
}, _callee27, this);
|
|
2831
2862
|
}));
|
|
2832
2863
|
|
|
2833
|
-
function markUnread(
|
|
2864
|
+
function markUnread(_x29) {
|
|
2834
2865
|
return _markUnread.apply(this, arguments);
|
|
2835
2866
|
}
|
|
2836
2867
|
|
|
@@ -2885,7 +2916,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2885
2916
|
defaultOptions.watch = false;
|
|
2886
2917
|
}
|
|
2887
2918
|
|
|
2888
|
-
combined = _objectSpread$
|
|
2919
|
+
combined = _objectSpread$6(_objectSpread$6({}, defaultOptions), options);
|
|
2889
2920
|
_context28.next = 7;
|
|
2890
2921
|
return this.query(combined, 'latest');
|
|
2891
2922
|
|
|
@@ -2909,7 +2940,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2909
2940
|
}, _callee28, this);
|
|
2910
2941
|
}));
|
|
2911
2942
|
|
|
2912
|
-
function watch(
|
|
2943
|
+
function watch(_x30) {
|
|
2913
2944
|
return _watch.apply(this, arguments);
|
|
2914
2945
|
}
|
|
2915
2946
|
|
|
@@ -2976,7 +3007,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2976
3007
|
switch (_context30.prev = _context30.next) {
|
|
2977
3008
|
case 0:
|
|
2978
3009
|
_context30.next = 2;
|
|
2979
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$
|
|
3010
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
|
|
2980
3011
|
|
|
2981
3012
|
case 2:
|
|
2982
3013
|
data = _context30.sent;
|
|
@@ -2996,7 +3027,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2996
3027
|
}, _callee30, this);
|
|
2997
3028
|
}));
|
|
2998
3029
|
|
|
2999
|
-
function getReplies(
|
|
3030
|
+
function getReplies(_x31, _x32) {
|
|
3000
3031
|
return _getReplies.apply(this, arguments);
|
|
3001
3032
|
}
|
|
3002
3033
|
|
|
@@ -3024,7 +3055,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3024
3055
|
sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
|
|
3025
3056
|
_context31.next = 3;
|
|
3026
3057
|
return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
|
|
3027
|
-
payload: _objectSpread$
|
|
3058
|
+
payload: _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3028
3059
|
sort: normalizeQuerySort(sort)
|
|
3029
3060
|
})
|
|
3030
3061
|
});
|
|
@@ -3040,7 +3071,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3040
3071
|
}, _callee31, this);
|
|
3041
3072
|
}));
|
|
3042
3073
|
|
|
3043
|
-
function getPinnedMessages(
|
|
3074
|
+
function getPinnedMessages(_x33) {
|
|
3044
3075
|
return _getPinnedMessages.apply(this, arguments);
|
|
3045
3076
|
}
|
|
3046
3077
|
|
|
@@ -3058,7 +3089,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3058
3089
|
}, {
|
|
3059
3090
|
key: "getReactions",
|
|
3060
3091
|
value: function getReactions(message_id, options) {
|
|
3061
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$
|
|
3092
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$6({}, options));
|
|
3062
3093
|
}
|
|
3063
3094
|
/**
|
|
3064
3095
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -3205,7 +3236,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3205
3236
|
}
|
|
3206
3237
|
|
|
3207
3238
|
_context32.next = 7;
|
|
3208
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
3239
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$6({
|
|
3209
3240
|
data: this._data,
|
|
3210
3241
|
state: true
|
|
3211
3242
|
}, options));
|
|
@@ -3269,7 +3300,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3269
3300
|
}, _callee32, this);
|
|
3270
3301
|
}));
|
|
3271
3302
|
|
|
3272
|
-
function query(
|
|
3303
|
+
function query(_x34) {
|
|
3273
3304
|
return _query.apply(this, arguments);
|
|
3274
3305
|
}
|
|
3275
3306
|
|
|
@@ -3294,7 +3325,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3294
3325
|
this._checkInitialized();
|
|
3295
3326
|
|
|
3296
3327
|
_context33.next = 3;
|
|
3297
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
3328
|
+
return this.getClient().banUser(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3298
3329
|
type: this.type,
|
|
3299
3330
|
id: this.id
|
|
3300
3331
|
}));
|
|
@@ -3310,7 +3341,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3310
3341
|
}, _callee33, this);
|
|
3311
3342
|
}));
|
|
3312
3343
|
|
|
3313
|
-
function banUser(
|
|
3344
|
+
function banUser(_x35, _x36) {
|
|
3314
3345
|
return _banUser.apply(this, arguments);
|
|
3315
3346
|
}
|
|
3316
3347
|
|
|
@@ -3441,7 +3472,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3441
3472
|
}, _callee36, this);
|
|
3442
3473
|
}));
|
|
3443
3474
|
|
|
3444
|
-
function unbanUser(
|
|
3475
|
+
function unbanUser(_x37) {
|
|
3445
3476
|
return _unbanUser.apply(this, arguments);
|
|
3446
3477
|
}
|
|
3447
3478
|
|
|
@@ -3466,7 +3497,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3466
3497
|
this._checkInitialized();
|
|
3467
3498
|
|
|
3468
3499
|
_context37.next = 3;
|
|
3469
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
3500
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$6(_objectSpread$6({}, options), {}, {
|
|
3470
3501
|
type: this.type,
|
|
3471
3502
|
id: this.id
|
|
3472
3503
|
}));
|
|
@@ -3482,7 +3513,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3482
3513
|
}, _callee37, this);
|
|
3483
3514
|
}));
|
|
3484
3515
|
|
|
3485
|
-
function shadowBan(
|
|
3516
|
+
function shadowBan(_x38, _x39) {
|
|
3486
3517
|
return _shadowBan.apply(this, arguments);
|
|
3487
3518
|
}
|
|
3488
3519
|
|
|
@@ -3522,7 +3553,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3522
3553
|
}, _callee38, this);
|
|
3523
3554
|
}));
|
|
3524
3555
|
|
|
3525
|
-
function removeShadowBan(
|
|
3556
|
+
function removeShadowBan(_x40) {
|
|
3526
3557
|
return _removeShadowBan.apply(this, arguments);
|
|
3527
3558
|
}
|
|
3528
3559
|
|
|
@@ -3557,7 +3588,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3557
3588
|
}, _callee39, this);
|
|
3558
3589
|
}));
|
|
3559
3590
|
|
|
3560
|
-
function createCall(
|
|
3591
|
+
function createCall(_x41) {
|
|
3561
3592
|
return _createCall.apply(this, arguments);
|
|
3562
3593
|
}
|
|
3563
3594
|
|
|
@@ -3852,7 +3883,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3852
3883
|
});
|
|
3853
3884
|
}
|
|
3854
3885
|
|
|
3855
|
-
channel.data = _objectSpread$
|
|
3886
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, event.channel), {}, {
|
|
3856
3887
|
hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
|
|
3857
3888
|
own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
|
|
3858
3889
|
});
|
|
@@ -3883,7 +3914,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3883
3914
|
break;
|
|
3884
3915
|
|
|
3885
3916
|
case 'channel.hidden':
|
|
3886
|
-
channel.data = _objectSpread$
|
|
3917
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3887
3918
|
hidden: true
|
|
3888
3919
|
});
|
|
3889
3920
|
|
|
@@ -3894,26 +3925,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3894
3925
|
break;
|
|
3895
3926
|
|
|
3896
3927
|
case 'channel.visible':
|
|
3897
|
-
channel.data = _objectSpread$
|
|
3928
|
+
channel.data = _objectSpread$6(_objectSpread$6({}, channel.data), {}, {
|
|
3898
3929
|
hidden: false
|
|
3899
3930
|
});
|
|
3900
3931
|
break;
|
|
3901
3932
|
|
|
3902
3933
|
case 'user.banned':
|
|
3903
3934
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
3904
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3935
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3905
3936
|
shadow_banned: !!event.shadow,
|
|
3906
3937
|
banned: !event.shadow,
|
|
3907
|
-
user: _objectSpread$
|
|
3938
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
|
|
3908
3939
|
});
|
|
3909
3940
|
break;
|
|
3910
3941
|
|
|
3911
3942
|
case 'user.unbanned':
|
|
3912
3943
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
3913
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
3944
|
+
channelState.members[event.user.id] = _objectSpread$6(_objectSpread$6({}, channelState.members[event.user.id] || {}), {}, {
|
|
3914
3945
|
shadow_banned: false,
|
|
3915
3946
|
banned: false,
|
|
3916
|
-
user: _objectSpread$
|
|
3947
|
+
user: _objectSpread$6(_objectSpread$6({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
3917
3948
|
});
|
|
3918
3949
|
break;
|
|
3919
3950
|
} // any event can send over the online count
|
|
@@ -3943,7 +3974,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3943
3974
|
|
|
3944
3975
|
|
|
3945
3976
|
if (state.members) {
|
|
3946
|
-
var _iterator = _createForOfIteratorHelper$
|
|
3977
|
+
var _iterator = _createForOfIteratorHelper$3(state.members),
|
|
3947
3978
|
_step;
|
|
3948
3979
|
|
|
3949
3980
|
try {
|
|
@@ -3987,7 +4018,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3987
4018
|
|
|
3988
4019
|
|
|
3989
4020
|
if (state.watchers) {
|
|
3990
|
-
var _iterator2 = _createForOfIteratorHelper$
|
|
4021
|
+
var _iterator2 = _createForOfIteratorHelper$3(state.watchers),
|
|
3991
4022
|
_step2;
|
|
3992
4023
|
|
|
3993
4024
|
try {
|
|
@@ -4023,7 +4054,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4023
4054
|
|
|
4024
4055
|
|
|
4025
4056
|
if (state.read) {
|
|
4026
|
-
var _iterator3 = _createForOfIteratorHelper$
|
|
4057
|
+
var _iterator3 = _createForOfIteratorHelper$3(state.read),
|
|
4027
4058
|
_step3;
|
|
4028
4059
|
|
|
4029
4060
|
try {
|
|
@@ -4092,11 +4123,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4092
4123
|
return Channel;
|
|
4093
4124
|
}();
|
|
4094
4125
|
|
|
4095
|
-
function _createForOfIteratorHelper$
|
|
4126
|
+
function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4096
4127
|
|
|
4097
|
-
function _unsupportedIterableToArray$
|
|
4128
|
+
function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
|
|
4098
4129
|
|
|
4099
|
-
function _arrayLikeToArray$
|
|
4130
|
+
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
4100
4131
|
|
|
4101
4132
|
/**
|
|
4102
4133
|
* ClientState - A container class for the client state.
|
|
@@ -4119,7 +4150,7 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4119
4150
|
_createClass(ClientState, [{
|
|
4120
4151
|
key: "updateUsers",
|
|
4121
4152
|
value: function updateUsers(users) {
|
|
4122
|
-
var _iterator = _createForOfIteratorHelper$
|
|
4153
|
+
var _iterator = _createForOfIteratorHelper$2(users),
|
|
4123
4154
|
_step;
|
|
4124
4155
|
|
|
4125
4156
|
try {
|
|
@@ -4167,9 +4198,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4167
4198
|
return ClientState;
|
|
4168
4199
|
}();
|
|
4169
4200
|
|
|
4170
|
-
function ownKeys$
|
|
4201
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4171
4202
|
|
|
4172
|
-
function _objectSpread$
|
|
4203
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4173
4204
|
var InsightMetrics = function InsightMetrics() {
|
|
4174
4205
|
_classCallCheck(this, InsightMetrics);
|
|
4175
4206
|
|
|
@@ -4248,7 +4279,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
4248
4279
|
};
|
|
4249
4280
|
}();
|
|
4250
4281
|
function buildWsFatalInsight(connection, event) {
|
|
4251
|
-
return _objectSpread$
|
|
4282
|
+
return _objectSpread$5(_objectSpread$5({}, event), buildWsBaseInsight(connection));
|
|
4252
4283
|
}
|
|
4253
4284
|
|
|
4254
4285
|
function buildWsBaseInsight(connection) {
|
|
@@ -4281,9 +4312,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
4281
4312
|
return buildWsBaseInsight(connection);
|
|
4282
4313
|
}
|
|
4283
4314
|
|
|
4284
|
-
function ownKeys$
|
|
4315
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4285
4316
|
|
|
4286
|
-
function _objectSpread$
|
|
4317
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4287
4318
|
|
|
4288
4319
|
// Type guards to check WebSocket error type
|
|
4289
4320
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -4647,7 +4678,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4647
4678
|
value: function _log(msg) {
|
|
4648
4679
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4649
4680
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
4650
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
4681
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$4({
|
|
4651
4682
|
tags: ['connection']
|
|
4652
4683
|
}, extra));
|
|
4653
4684
|
}
|
|
@@ -5238,9 +5269,9 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5238
5269
|
return StableWSConnection;
|
|
5239
5270
|
}();
|
|
5240
5271
|
|
|
5241
|
-
function ownKeys$
|
|
5272
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5242
5273
|
|
|
5243
|
-
function _objectSpread$
|
|
5274
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5244
5275
|
|
|
5245
5276
|
/**
|
|
5246
5277
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -5261,7 +5292,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
5261
5292
|
throw new TypeError('userId should be a string');
|
|
5262
5293
|
}
|
|
5263
5294
|
|
|
5264
|
-
var payload = _objectSpread$
|
|
5295
|
+
var payload = _objectSpread$3({
|
|
5265
5296
|
user_id: userId
|
|
5266
5297
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
5267
5298
|
|
|
@@ -5671,9 +5702,9 @@ function isErrorResponse(res) {
|
|
|
5671
5702
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
5672
5703
|
}
|
|
5673
5704
|
|
|
5674
|
-
function ownKeys$
|
|
5705
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5675
5706
|
|
|
5676
|
-
function _objectSpread$
|
|
5707
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5677
5708
|
var ConnectionState;
|
|
5678
5709
|
|
|
5679
5710
|
(function (ConnectionState) {
|
|
@@ -5736,7 +5767,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
5736
5767
|
_context.next = 4;
|
|
5737
5768
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
5738
5769
|
undefined, {
|
|
5739
|
-
config: _objectSpread$
|
|
5770
|
+
config: _objectSpread$2(_objectSpread$2({}, config), {}, {
|
|
5740
5771
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
5741
5772
|
}),
|
|
5742
5773
|
params: params
|
|
@@ -6014,7 +6045,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6014
6045
|
value: function _log(msg) {
|
|
6015
6046
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6016
6047
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
6017
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
6048
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$2({
|
|
6018
6049
|
tags: ['connection_fallback', 'connection']
|
|
6019
6050
|
}, extra));
|
|
6020
6051
|
}
|
|
@@ -6061,6 +6092,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
6061
6092
|
/**
|
|
6062
6093
|
* Response Types
|
|
6063
6094
|
*/
|
|
6095
|
+
// TODO: Figure out a way to strongly type set and unset.
|
|
6064
6096
|
// Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
|
|
6065
6097
|
|
|
6066
6098
|
/**
|
|
@@ -6132,6 +6164,136 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
|
6132
6164
|
return ErrorFromResponse;
|
|
6133
6165
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
6134
6166
|
|
|
6167
|
+
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; }
|
|
6168
|
+
|
|
6169
|
+
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; }
|
|
6170
|
+
|
|
6171
|
+
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; } } }; }
|
|
6172
|
+
|
|
6173
|
+
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); }
|
|
6174
|
+
|
|
6175
|
+
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; }
|
|
6176
|
+
var Thread = /*#__PURE__*/function () {
|
|
6177
|
+
function Thread(client, t) {
|
|
6178
|
+
_classCallCheck(this, Thread);
|
|
6179
|
+
|
|
6180
|
+
_defineProperty(this, "id", void 0);
|
|
6181
|
+
|
|
6182
|
+
_defineProperty(this, "latestReplies", []);
|
|
6183
|
+
|
|
6184
|
+
_defineProperty(this, "participants", []);
|
|
6185
|
+
|
|
6186
|
+
_defineProperty(this, "message", void 0);
|
|
6187
|
+
|
|
6188
|
+
_defineProperty(this, "channel", void 0);
|
|
6189
|
+
|
|
6190
|
+
_defineProperty(this, "_channel", void 0);
|
|
6191
|
+
|
|
6192
|
+
_defineProperty(this, "replyCount", 0);
|
|
6193
|
+
|
|
6194
|
+
_defineProperty(this, "_client", void 0);
|
|
6195
|
+
|
|
6196
|
+
_defineProperty(this, "read", {});
|
|
6197
|
+
|
|
6198
|
+
this.id = t.parent_message.id;
|
|
6199
|
+
this.message = formatMessage(t.parent_message);
|
|
6200
|
+
this.latestReplies = t.latest_replies.map(formatMessage);
|
|
6201
|
+
this.participants = t.thread_participants;
|
|
6202
|
+
this.replyCount = t.reply_count;
|
|
6203
|
+
this.channel = t.channel;
|
|
6204
|
+
this._channel = client.channel(t.channel.type, t.channel.id);
|
|
6205
|
+
this._client = client;
|
|
6206
|
+
|
|
6207
|
+
var _iterator = _createForOfIteratorHelper$1(t.read),
|
|
6208
|
+
_step;
|
|
6209
|
+
|
|
6210
|
+
try {
|
|
6211
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6212
|
+
var r = _step.value;
|
|
6213
|
+
this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
|
|
6214
|
+
last_read: new Date(r.last_read)
|
|
6215
|
+
});
|
|
6216
|
+
}
|
|
6217
|
+
} catch (err) {
|
|
6218
|
+
_iterator.e(err);
|
|
6219
|
+
} finally {
|
|
6220
|
+
_iterator.f();
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
|
|
6224
|
+
_createClass(Thread, [{
|
|
6225
|
+
key: "getClient",
|
|
6226
|
+
value: function getClient() {
|
|
6227
|
+
return this._client;
|
|
6228
|
+
}
|
|
6229
|
+
}, {
|
|
6230
|
+
key: "addReply",
|
|
6231
|
+
value: function addReply(message) {
|
|
6232
|
+
this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
|
|
6233
|
+
}
|
|
6234
|
+
}, {
|
|
6235
|
+
key: "updateReply",
|
|
6236
|
+
value: function updateReply(message) {
|
|
6237
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6238
|
+
if (m.id === message.id) {
|
|
6239
|
+
return formatMessage(message);
|
|
6240
|
+
}
|
|
6241
|
+
|
|
6242
|
+
return m;
|
|
6243
|
+
});
|
|
6244
|
+
}
|
|
6245
|
+
}, {
|
|
6246
|
+
key: "updateMessageOrReplyIfExists",
|
|
6247
|
+
value: function updateMessageOrReplyIfExists(message) {
|
|
6248
|
+
if (!message.parent_id && message.id !== this.message.id) {
|
|
6249
|
+
return;
|
|
6250
|
+
}
|
|
6251
|
+
|
|
6252
|
+
if (message.parent_id && message.parent_id !== this.message.id) {
|
|
6253
|
+
return;
|
|
6254
|
+
}
|
|
6255
|
+
|
|
6256
|
+
if (message.parent_id && message.parent_id === this.message.id) {
|
|
6257
|
+
this.updateReply(message);
|
|
6258
|
+
}
|
|
6259
|
+
|
|
6260
|
+
if (!message.parent_id && message.id === this.message.id) {
|
|
6261
|
+
this.message = formatMessage(message);
|
|
6262
|
+
}
|
|
6263
|
+
}
|
|
6264
|
+
}, {
|
|
6265
|
+
key: "addReaction",
|
|
6266
|
+
value: function addReaction(reaction, message, enforce_unique) {
|
|
6267
|
+
var _this = this;
|
|
6268
|
+
|
|
6269
|
+
if (!message) return;
|
|
6270
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6271
|
+
if (m.id === message.id) {
|
|
6272
|
+
return formatMessage(_this._channel.state.addReaction(reaction, message, enforce_unique));
|
|
6273
|
+
}
|
|
6274
|
+
|
|
6275
|
+
return m;
|
|
6276
|
+
});
|
|
6277
|
+
}
|
|
6278
|
+
}, {
|
|
6279
|
+
key: "removeReaction",
|
|
6280
|
+
value: function removeReaction(reaction, message) {
|
|
6281
|
+
var _this2 = this;
|
|
6282
|
+
|
|
6283
|
+
if (!message) return;
|
|
6284
|
+
this.latestReplies = this.latestReplies.map(function (m) {
|
|
6285
|
+
if (m.id === message.id) {
|
|
6286
|
+
return formatMessage(_this2._channel.state.removeReaction(reaction, message));
|
|
6287
|
+
}
|
|
6288
|
+
|
|
6289
|
+
return m;
|
|
6290
|
+
});
|
|
6291
|
+
}
|
|
6292
|
+
}]);
|
|
6293
|
+
|
|
6294
|
+
return Thread;
|
|
6295
|
+
}();
|
|
6296
|
+
|
|
6135
6297
|
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
6136
6298
|
_excluded2 = ["params", "headers"];
|
|
6137
6299
|
|
|
@@ -10243,10 +10405,197 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10243
10405
|
|
|
10244
10406
|
return getMessage;
|
|
10245
10407
|
}()
|
|
10408
|
+
/**
|
|
10409
|
+
* queryThreads - returns the list of threads of current user.
|
|
10410
|
+
*
|
|
10411
|
+
* @param {QueryThreadsOptions} options Options object for pagination and limiting the participants and replies.
|
|
10412
|
+
* @param {number} options.limit Limits the number of threads to be returned.
|
|
10413
|
+
* @param {boolean} options.watch Subscribes the user to the channels of the threads.
|
|
10414
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10415
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10416
|
+
*
|
|
10417
|
+
* @returns {{ threads: Thread<StreamChatGenerics>[], next: string }} Returns the list of threads and the next cursor.
|
|
10418
|
+
*/
|
|
10419
|
+
|
|
10420
|
+
}, {
|
|
10421
|
+
key: "queryThreads",
|
|
10422
|
+
value: function () {
|
|
10423
|
+
var _queryThreads = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(options) {
|
|
10424
|
+
var _this5 = this;
|
|
10425
|
+
|
|
10426
|
+
var opts, res;
|
|
10427
|
+
return _regeneratorRuntime.wrap(function _callee59$(_context59) {
|
|
10428
|
+
while (1) {
|
|
10429
|
+
switch (_context59.prev = _context59.next) {
|
|
10430
|
+
case 0:
|
|
10431
|
+
opts = _objectSpread({
|
|
10432
|
+
limit: 10,
|
|
10433
|
+
participant_limit: 10,
|
|
10434
|
+
reply_limit: 3,
|
|
10435
|
+
watch: true
|
|
10436
|
+
}, options);
|
|
10437
|
+
_context59.next = 3;
|
|
10438
|
+
return this.post(this.baseURL + "/threads", opts);
|
|
10439
|
+
|
|
10440
|
+
case 3:
|
|
10441
|
+
res = _context59.sent;
|
|
10442
|
+
return _context59.abrupt("return", {
|
|
10443
|
+
threads: res.threads.map(function (thread) {
|
|
10444
|
+
return new Thread(_this5, thread);
|
|
10445
|
+
}),
|
|
10446
|
+
next: res.next
|
|
10447
|
+
});
|
|
10448
|
+
|
|
10449
|
+
case 5:
|
|
10450
|
+
case "end":
|
|
10451
|
+
return _context59.stop();
|
|
10452
|
+
}
|
|
10453
|
+
}
|
|
10454
|
+
}, _callee59, this);
|
|
10455
|
+
}));
|
|
10456
|
+
|
|
10457
|
+
function queryThreads(_x78) {
|
|
10458
|
+
return _queryThreads.apply(this, arguments);
|
|
10459
|
+
}
|
|
10460
|
+
|
|
10461
|
+
return queryThreads;
|
|
10462
|
+
}()
|
|
10463
|
+
/**
|
|
10464
|
+
* getThread - returns the thread of a message by its id.
|
|
10465
|
+
*
|
|
10466
|
+
* @param {string} messageId The message id
|
|
10467
|
+
* @param {GetThreadOptions} options Options object for pagination and limiting the participants and replies.
|
|
10468
|
+
* @param {boolean} options.watch Subscribes the user to the channel of the thread.
|
|
10469
|
+
* @param {number} options.participant_limit Limits the number of participants returned per threads.
|
|
10470
|
+
* @param {number} options.reply_limit Limits the number of replies returned per threads.
|
|
10471
|
+
*
|
|
10472
|
+
* @returns {Thread<StreamChatGenerics>} Returns the thread.
|
|
10473
|
+
*/
|
|
10474
|
+
|
|
10475
|
+
}, {
|
|
10476
|
+
key: "getThread",
|
|
10477
|
+
value: function () {
|
|
10478
|
+
var _getThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(messageId) {
|
|
10479
|
+
var options,
|
|
10480
|
+
opts,
|
|
10481
|
+
res,
|
|
10482
|
+
_args60 = arguments;
|
|
10483
|
+
return _regeneratorRuntime.wrap(function _callee60$(_context60) {
|
|
10484
|
+
while (1) {
|
|
10485
|
+
switch (_context60.prev = _context60.next) {
|
|
10486
|
+
case 0:
|
|
10487
|
+
options = _args60.length > 1 && _args60[1] !== undefined ? _args60[1] : {};
|
|
10488
|
+
|
|
10489
|
+
if (messageId) {
|
|
10490
|
+
_context60.next = 3;
|
|
10491
|
+
break;
|
|
10492
|
+
}
|
|
10493
|
+
|
|
10494
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10495
|
+
|
|
10496
|
+
case 3:
|
|
10497
|
+
opts = _objectSpread({
|
|
10498
|
+
participant_limit: 100,
|
|
10499
|
+
reply_limit: 3,
|
|
10500
|
+
watch: true
|
|
10501
|
+
}, options);
|
|
10502
|
+
_context60.next = 6;
|
|
10503
|
+
return this.get(this.baseURL + "/threads/".concat(messageId), opts);
|
|
10504
|
+
|
|
10505
|
+
case 6:
|
|
10506
|
+
res = _context60.sent;
|
|
10507
|
+
return _context60.abrupt("return", new Thread(this, res.thread));
|
|
10508
|
+
|
|
10509
|
+
case 8:
|
|
10510
|
+
case "end":
|
|
10511
|
+
return _context60.stop();
|
|
10512
|
+
}
|
|
10513
|
+
}
|
|
10514
|
+
}, _callee60, this);
|
|
10515
|
+
}));
|
|
10516
|
+
|
|
10517
|
+
function getThread(_x79) {
|
|
10518
|
+
return _getThread.apply(this, arguments);
|
|
10519
|
+
}
|
|
10520
|
+
|
|
10521
|
+
return getThread;
|
|
10522
|
+
}()
|
|
10523
|
+
/**
|
|
10524
|
+
* partialUpdateThread - updates the given thread
|
|
10525
|
+
*
|
|
10526
|
+
* @param {string} messageId The id of the thread message which needs to be updated.
|
|
10527
|
+
* @param {PartialThreadUpdate} partialThreadObject should contain "set" or "unset" params for any of the thread's non-reserved fields.
|
|
10528
|
+
*
|
|
10529
|
+
* @returns {GetThreadAPIResponse<StreamChatGenerics>} Returns the updated thread.
|
|
10530
|
+
*/
|
|
10531
|
+
|
|
10532
|
+
}, {
|
|
10533
|
+
key: "partialUpdateThread",
|
|
10534
|
+
value: function () {
|
|
10535
|
+
var _partialUpdateThread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(messageId, partialThreadObject) {
|
|
10536
|
+
var reservedThreadFields, _key5;
|
|
10537
|
+
|
|
10538
|
+
return _regeneratorRuntime.wrap(function _callee61$(_context61) {
|
|
10539
|
+
while (1) {
|
|
10540
|
+
switch (_context61.prev = _context61.next) {
|
|
10541
|
+
case 0:
|
|
10542
|
+
if (messageId) {
|
|
10543
|
+
_context61.next = 2;
|
|
10544
|
+
break;
|
|
10545
|
+
}
|
|
10546
|
+
|
|
10547
|
+
throw Error('Please specify the message id when calling partialUpdateThread');
|
|
10548
|
+
|
|
10549
|
+
case 2:
|
|
10550
|
+
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
10551
|
+
// Throw error if any of the reserved field is found.
|
|
10552
|
+
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel'];
|
|
10553
|
+
_context61.t0 = _regeneratorRuntime.keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
10554
|
+
|
|
10555
|
+
case 4:
|
|
10556
|
+
if ((_context61.t1 = _context61.t0()).done) {
|
|
10557
|
+
_context61.next = 10;
|
|
10558
|
+
break;
|
|
10559
|
+
}
|
|
10560
|
+
|
|
10561
|
+
_key5 = _context61.t1.value;
|
|
10562
|
+
|
|
10563
|
+
if (!reservedThreadFields.includes(_key5)) {
|
|
10564
|
+
_context61.next = 8;
|
|
10565
|
+
break;
|
|
10566
|
+
}
|
|
10567
|
+
|
|
10568
|
+
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."));
|
|
10569
|
+
|
|
10570
|
+
case 8:
|
|
10571
|
+
_context61.next = 4;
|
|
10572
|
+
break;
|
|
10573
|
+
|
|
10574
|
+
case 10:
|
|
10575
|
+
_context61.next = 12;
|
|
10576
|
+
return this.patch(this.baseURL + "/threads/".concat(messageId), partialThreadObject);
|
|
10577
|
+
|
|
10578
|
+
case 12:
|
|
10579
|
+
return _context61.abrupt("return", _context61.sent);
|
|
10580
|
+
|
|
10581
|
+
case 13:
|
|
10582
|
+
case "end":
|
|
10583
|
+
return _context61.stop();
|
|
10584
|
+
}
|
|
10585
|
+
}
|
|
10586
|
+
}, _callee61, this);
|
|
10587
|
+
}));
|
|
10588
|
+
|
|
10589
|
+
function partialUpdateThread(_x80, _x81) {
|
|
10590
|
+
return _partialUpdateThread.apply(this, arguments);
|
|
10591
|
+
}
|
|
10592
|
+
|
|
10593
|
+
return partialUpdateThread;
|
|
10594
|
+
}()
|
|
10246
10595
|
}, {
|
|
10247
10596
|
key: "getUserAgent",
|
|
10248
10597
|
value: function getUserAgent() {
|
|
10249
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
10598
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
|
|
10250
10599
|
}
|
|
10251
10600
|
}, {
|
|
10252
10601
|
key: "setUserAgent",
|
|
@@ -10465,28 +10814,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10465
10814
|
}, {
|
|
10466
10815
|
key: "sendUserCustomEvent",
|
|
10467
10816
|
value: function () {
|
|
10468
|
-
var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10469
|
-
return _regeneratorRuntime.wrap(function
|
|
10817
|
+
var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(targetUserID, event) {
|
|
10818
|
+
return _regeneratorRuntime.wrap(function _callee62$(_context62) {
|
|
10470
10819
|
while (1) {
|
|
10471
|
-
switch (
|
|
10820
|
+
switch (_context62.prev = _context62.next) {
|
|
10472
10821
|
case 0:
|
|
10473
|
-
|
|
10822
|
+
_context62.next = 2;
|
|
10474
10823
|
return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
|
|
10475
10824
|
event: event
|
|
10476
10825
|
});
|
|
10477
10826
|
|
|
10478
10827
|
case 2:
|
|
10479
|
-
return
|
|
10828
|
+
return _context62.abrupt("return", _context62.sent);
|
|
10480
10829
|
|
|
10481
10830
|
case 3:
|
|
10482
10831
|
case "end":
|
|
10483
|
-
return
|
|
10832
|
+
return _context62.stop();
|
|
10484
10833
|
}
|
|
10485
10834
|
}
|
|
10486
|
-
},
|
|
10835
|
+
}, _callee62, this);
|
|
10487
10836
|
}));
|
|
10488
10837
|
|
|
10489
|
-
function sendUserCustomEvent(
|
|
10838
|
+
function sendUserCustomEvent(_x82, _x83) {
|
|
10490
10839
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
10491
10840
|
}
|
|
10492
10841
|
|
|
@@ -10558,12 +10907,12 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10558
10907
|
}, {
|
|
10559
10908
|
key: "createSegment",
|
|
10560
10909
|
value: function () {
|
|
10561
|
-
var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10910
|
+
var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(type, id, name, data) {
|
|
10562
10911
|
var body, _yield$this$post, segment;
|
|
10563
10912
|
|
|
10564
|
-
return _regeneratorRuntime.wrap(function
|
|
10913
|
+
return _regeneratorRuntime.wrap(function _callee63$(_context63) {
|
|
10565
10914
|
while (1) {
|
|
10566
|
-
switch (
|
|
10915
|
+
switch (_context63.prev = _context63.next) {
|
|
10567
10916
|
case 0:
|
|
10568
10917
|
body = {
|
|
10569
10918
|
id: id,
|
|
@@ -10571,23 +10920,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10571
10920
|
name: name,
|
|
10572
10921
|
data: data
|
|
10573
10922
|
};
|
|
10574
|
-
|
|
10923
|
+
_context63.next = 3;
|
|
10575
10924
|
return this.post(this.baseURL + "/segments", body);
|
|
10576
10925
|
|
|
10577
10926
|
case 3:
|
|
10578
|
-
_yield$this$post =
|
|
10927
|
+
_yield$this$post = _context63.sent;
|
|
10579
10928
|
segment = _yield$this$post.segment;
|
|
10580
|
-
return
|
|
10929
|
+
return _context63.abrupt("return", segment);
|
|
10581
10930
|
|
|
10582
10931
|
case 6:
|
|
10583
10932
|
case "end":
|
|
10584
|
-
return
|
|
10933
|
+
return _context63.stop();
|
|
10585
10934
|
}
|
|
10586
10935
|
}
|
|
10587
|
-
},
|
|
10936
|
+
}, _callee63, this);
|
|
10588
10937
|
}));
|
|
10589
10938
|
|
|
10590
|
-
function createSegment(
|
|
10939
|
+
function createSegment(_x84, _x85, _x86, _x87) {
|
|
10591
10940
|
return _createSegment.apply(this, arguments);
|
|
10592
10941
|
}
|
|
10593
10942
|
|
|
@@ -10606,26 +10955,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10606
10955
|
}, {
|
|
10607
10956
|
key: "createUserSegment",
|
|
10608
10957
|
value: function () {
|
|
10609
|
-
var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10610
|
-
return _regeneratorRuntime.wrap(function
|
|
10958
|
+
var _createUserSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id, name, data) {
|
|
10959
|
+
return _regeneratorRuntime.wrap(function _callee64$(_context64) {
|
|
10611
10960
|
while (1) {
|
|
10612
|
-
switch (
|
|
10961
|
+
switch (_context64.prev = _context64.next) {
|
|
10613
10962
|
case 0:
|
|
10614
|
-
|
|
10963
|
+
_context64.next = 2;
|
|
10615
10964
|
return this.createSegment('user', id, name, data);
|
|
10616
10965
|
|
|
10617
10966
|
case 2:
|
|
10618
|
-
return
|
|
10967
|
+
return _context64.abrupt("return", _context64.sent);
|
|
10619
10968
|
|
|
10620
10969
|
case 3:
|
|
10621
10970
|
case "end":
|
|
10622
|
-
return
|
|
10971
|
+
return _context64.stop();
|
|
10623
10972
|
}
|
|
10624
10973
|
}
|
|
10625
|
-
},
|
|
10974
|
+
}, _callee64, this);
|
|
10626
10975
|
}));
|
|
10627
10976
|
|
|
10628
|
-
function createUserSegment(
|
|
10977
|
+
function createUserSegment(_x88, _x89, _x90) {
|
|
10629
10978
|
return _createUserSegment.apply(this, arguments);
|
|
10630
10979
|
}
|
|
10631
10980
|
|
|
@@ -10644,26 +10993,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10644
10993
|
}, {
|
|
10645
10994
|
key: "createChannelSegment",
|
|
10646
10995
|
value: function () {
|
|
10647
|
-
var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10648
|
-
return _regeneratorRuntime.wrap(function
|
|
10996
|
+
var _createChannelSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, name, data) {
|
|
10997
|
+
return _regeneratorRuntime.wrap(function _callee65$(_context65) {
|
|
10649
10998
|
while (1) {
|
|
10650
|
-
switch (
|
|
10999
|
+
switch (_context65.prev = _context65.next) {
|
|
10651
11000
|
case 0:
|
|
10652
|
-
|
|
11001
|
+
_context65.next = 2;
|
|
10653
11002
|
return this.createSegment('channel', id, name, data);
|
|
10654
11003
|
|
|
10655
11004
|
case 2:
|
|
10656
|
-
return
|
|
11005
|
+
return _context65.abrupt("return", _context65.sent);
|
|
10657
11006
|
|
|
10658
11007
|
case 3:
|
|
10659
11008
|
case "end":
|
|
10660
|
-
return
|
|
11009
|
+
return _context65.stop();
|
|
10661
11010
|
}
|
|
10662
11011
|
}
|
|
10663
|
-
},
|
|
11012
|
+
}, _callee65, this);
|
|
10664
11013
|
}));
|
|
10665
11014
|
|
|
10666
|
-
function createChannelSegment(
|
|
11015
|
+
function createChannelSegment(_x91, _x92, _x93) {
|
|
10667
11016
|
return _createChannelSegment.apply(this, arguments);
|
|
10668
11017
|
}
|
|
10669
11018
|
|
|
@@ -10681,30 +11030,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10681
11030
|
}, {
|
|
10682
11031
|
key: "updateSegment",
|
|
10683
11032
|
value: function () {
|
|
10684
|
-
var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11033
|
+
var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id, data) {
|
|
10685
11034
|
var _yield$this$put, segment;
|
|
10686
11035
|
|
|
10687
|
-
return _regeneratorRuntime.wrap(function
|
|
11036
|
+
return _regeneratorRuntime.wrap(function _callee66$(_context66) {
|
|
10688
11037
|
while (1) {
|
|
10689
|
-
switch (
|
|
11038
|
+
switch (_context66.prev = _context66.next) {
|
|
10690
11039
|
case 0:
|
|
10691
|
-
|
|
11040
|
+
_context66.next = 2;
|
|
10692
11041
|
return this.put(this.baseURL + "/segments/".concat(id), data);
|
|
10693
11042
|
|
|
10694
11043
|
case 2:
|
|
10695
|
-
_yield$this$put =
|
|
11044
|
+
_yield$this$put = _context66.sent;
|
|
10696
11045
|
segment = _yield$this$put.segment;
|
|
10697
|
-
return
|
|
11046
|
+
return _context66.abrupt("return", segment);
|
|
10698
11047
|
|
|
10699
11048
|
case 5:
|
|
10700
11049
|
case "end":
|
|
10701
|
-
return
|
|
11050
|
+
return _context66.stop();
|
|
10702
11051
|
}
|
|
10703
11052
|
}
|
|
10704
|
-
},
|
|
11053
|
+
}, _callee66, this);
|
|
10705
11054
|
}));
|
|
10706
11055
|
|
|
10707
|
-
function updateSegment(
|
|
11056
|
+
function updateSegment(_x94, _x95) {
|
|
10708
11057
|
return _updateSegment.apply(this, arguments);
|
|
10709
11058
|
}
|
|
10710
11059
|
|
|
@@ -10722,30 +11071,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10722
11071
|
}, {
|
|
10723
11072
|
key: "addSegmentTargets",
|
|
10724
11073
|
value: function () {
|
|
10725
|
-
var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11074
|
+
var _addSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, targets) {
|
|
10726
11075
|
var body;
|
|
10727
|
-
return _regeneratorRuntime.wrap(function
|
|
11076
|
+
return _regeneratorRuntime.wrap(function _callee67$(_context67) {
|
|
10728
11077
|
while (1) {
|
|
10729
|
-
switch (
|
|
11078
|
+
switch (_context67.prev = _context67.next) {
|
|
10730
11079
|
case 0:
|
|
10731
11080
|
body = {
|
|
10732
11081
|
targets: targets
|
|
10733
11082
|
};
|
|
10734
|
-
|
|
11083
|
+
_context67.next = 3;
|
|
10735
11084
|
return this.post(this.baseURL + "/segments/".concat(id, "/addtargets"), body);
|
|
10736
11085
|
|
|
10737
11086
|
case 3:
|
|
10738
|
-
return
|
|
11087
|
+
return _context67.abrupt("return", _context67.sent);
|
|
10739
11088
|
|
|
10740
11089
|
case 4:
|
|
10741
11090
|
case "end":
|
|
10742
|
-
return
|
|
11091
|
+
return _context67.stop();
|
|
10743
11092
|
}
|
|
10744
11093
|
}
|
|
10745
|
-
},
|
|
11094
|
+
}, _callee67, this);
|
|
10746
11095
|
}));
|
|
10747
11096
|
|
|
10748
|
-
function addSegmentTargets(
|
|
11097
|
+
function addSegmentTargets(_x96, _x97) {
|
|
10749
11098
|
return _addSegmentTargets.apply(this, arguments);
|
|
10750
11099
|
}
|
|
10751
11100
|
|
|
@@ -10763,30 +11112,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10763
11112
|
}, {
|
|
10764
11113
|
key: "deleteSegmentTargets",
|
|
10765
11114
|
value: function () {
|
|
10766
|
-
var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11115
|
+
var _deleteSegmentTargets = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id, targets) {
|
|
10767
11116
|
var body;
|
|
10768
|
-
return _regeneratorRuntime.wrap(function
|
|
11117
|
+
return _regeneratorRuntime.wrap(function _callee68$(_context68) {
|
|
10769
11118
|
while (1) {
|
|
10770
|
-
switch (
|
|
11119
|
+
switch (_context68.prev = _context68.next) {
|
|
10771
11120
|
case 0:
|
|
10772
11121
|
body = {
|
|
10773
11122
|
targets: targets
|
|
10774
11123
|
};
|
|
10775
|
-
|
|
11124
|
+
_context68.next = 3;
|
|
10776
11125
|
return this.post(this.baseURL + "/segments/".concat(id, "/deletetargets"), body);
|
|
10777
11126
|
|
|
10778
11127
|
case 3:
|
|
10779
|
-
return
|
|
11128
|
+
return _context68.abrupt("return", _context68.sent);
|
|
10780
11129
|
|
|
10781
11130
|
case 4:
|
|
10782
11131
|
case "end":
|
|
10783
|
-
return
|
|
11132
|
+
return _context68.stop();
|
|
10784
11133
|
}
|
|
10785
11134
|
}
|
|
10786
|
-
},
|
|
11135
|
+
}, _callee68, this);
|
|
10787
11136
|
}));
|
|
10788
11137
|
|
|
10789
|
-
function deleteSegmentTargets(
|
|
11138
|
+
function deleteSegmentTargets(_x98, _x99) {
|
|
10790
11139
|
return _deleteSegmentTargets.apply(this, arguments);
|
|
10791
11140
|
}
|
|
10792
11141
|
|
|
@@ -10804,15 +11153,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10804
11153
|
}, {
|
|
10805
11154
|
key: "querySegments",
|
|
10806
11155
|
value: function () {
|
|
10807
|
-
var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11156
|
+
var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(filter) {
|
|
10808
11157
|
var options,
|
|
10809
|
-
|
|
10810
|
-
return _regeneratorRuntime.wrap(function
|
|
11158
|
+
_args69 = arguments;
|
|
11159
|
+
return _regeneratorRuntime.wrap(function _callee69$(_context69) {
|
|
10811
11160
|
while (1) {
|
|
10812
|
-
switch (
|
|
11161
|
+
switch (_context69.prev = _context69.next) {
|
|
10813
11162
|
case 0:
|
|
10814
|
-
options =
|
|
10815
|
-
|
|
11163
|
+
options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
|
|
11164
|
+
_context69.next = 3;
|
|
10816
11165
|
return this.get(this.baseURL + "/segments", {
|
|
10817
11166
|
payload: _objectSpread({
|
|
10818
11167
|
filter: filter
|
|
@@ -10820,17 +11169,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10820
11169
|
});
|
|
10821
11170
|
|
|
10822
11171
|
case 3:
|
|
10823
|
-
return
|
|
11172
|
+
return _context69.abrupt("return", _context69.sent);
|
|
10824
11173
|
|
|
10825
11174
|
case 4:
|
|
10826
11175
|
case "end":
|
|
10827
|
-
return
|
|
11176
|
+
return _context69.stop();
|
|
10828
11177
|
}
|
|
10829
11178
|
}
|
|
10830
|
-
},
|
|
11179
|
+
}, _callee69, this);
|
|
10831
11180
|
}));
|
|
10832
11181
|
|
|
10833
|
-
function querySegments(
|
|
11182
|
+
function querySegments(_x100) {
|
|
10834
11183
|
return _querySegments.apply(this, arguments);
|
|
10835
11184
|
}
|
|
10836
11185
|
|
|
@@ -10847,26 +11196,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10847
11196
|
}, {
|
|
10848
11197
|
key: "deleteSegment",
|
|
10849
11198
|
value: function () {
|
|
10850
|
-
var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10851
|
-
return _regeneratorRuntime.wrap(function
|
|
11199
|
+
var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(id) {
|
|
11200
|
+
return _regeneratorRuntime.wrap(function _callee70$(_context70) {
|
|
10852
11201
|
while (1) {
|
|
10853
|
-
switch (
|
|
11202
|
+
switch (_context70.prev = _context70.next) {
|
|
10854
11203
|
case 0:
|
|
10855
|
-
|
|
11204
|
+
_context70.next = 2;
|
|
10856
11205
|
return this.delete(this.baseURL + "/segments/".concat(id));
|
|
10857
11206
|
|
|
10858
11207
|
case 2:
|
|
10859
|
-
return
|
|
11208
|
+
return _context70.abrupt("return", _context70.sent);
|
|
10860
11209
|
|
|
10861
11210
|
case 3:
|
|
10862
11211
|
case "end":
|
|
10863
|
-
return
|
|
11212
|
+
return _context70.stop();
|
|
10864
11213
|
}
|
|
10865
11214
|
}
|
|
10866
|
-
},
|
|
11215
|
+
}, _callee70, this);
|
|
10867
11216
|
}));
|
|
10868
11217
|
|
|
10869
|
-
function deleteSegment(
|
|
11218
|
+
function deleteSegment(_x101) {
|
|
10870
11219
|
return _deleteSegment.apply(this, arguments);
|
|
10871
11220
|
}
|
|
10872
11221
|
|
|
@@ -10884,26 +11233,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10884
11233
|
}, {
|
|
10885
11234
|
key: "segmentTargetExists",
|
|
10886
11235
|
value: function () {
|
|
10887
|
-
var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
10888
|
-
return _regeneratorRuntime.wrap(function
|
|
11236
|
+
var _segmentTargetExists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(segmentId, targetId) {
|
|
11237
|
+
return _regeneratorRuntime.wrap(function _callee71$(_context71) {
|
|
10889
11238
|
while (1) {
|
|
10890
|
-
switch (
|
|
11239
|
+
switch (_context71.prev = _context71.next) {
|
|
10891
11240
|
case 0:
|
|
10892
|
-
|
|
11241
|
+
_context71.next = 2;
|
|
10893
11242
|
return this.get(this.baseURL + "/segments/".concat(segmentId, "/target/").concat(targetId));
|
|
10894
11243
|
|
|
10895
11244
|
case 2:
|
|
10896
|
-
return
|
|
11245
|
+
return _context71.abrupt("return", _context71.sent);
|
|
10897
11246
|
|
|
10898
11247
|
case 3:
|
|
10899
11248
|
case "end":
|
|
10900
|
-
return
|
|
11249
|
+
return _context71.stop();
|
|
10901
11250
|
}
|
|
10902
11251
|
}
|
|
10903
|
-
},
|
|
11252
|
+
}, _callee71, this);
|
|
10904
11253
|
}));
|
|
10905
11254
|
|
|
10906
|
-
function segmentTargetExists(
|
|
11255
|
+
function segmentTargetExists(_x102, _x103) {
|
|
10907
11256
|
return _segmentTargetExists.apply(this, arguments);
|
|
10908
11257
|
}
|
|
10909
11258
|
|
|
@@ -10920,32 +11269,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10920
11269
|
}, {
|
|
10921
11270
|
key: "createCampaign",
|
|
10922
11271
|
value: function () {
|
|
10923
|
-
var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11272
|
+
var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(params) {
|
|
10924
11273
|
var _yield$this$post2, campaign;
|
|
10925
11274
|
|
|
10926
|
-
return _regeneratorRuntime.wrap(function
|
|
11275
|
+
return _regeneratorRuntime.wrap(function _callee72$(_context72) {
|
|
10927
11276
|
while (1) {
|
|
10928
|
-
switch (
|
|
11277
|
+
switch (_context72.prev = _context72.next) {
|
|
10929
11278
|
case 0:
|
|
10930
|
-
|
|
11279
|
+
_context72.next = 2;
|
|
10931
11280
|
return this.post(this.baseURL + "/campaigns", {
|
|
10932
11281
|
campaign: params
|
|
10933
11282
|
});
|
|
10934
11283
|
|
|
10935
11284
|
case 2:
|
|
10936
|
-
_yield$this$post2 =
|
|
11285
|
+
_yield$this$post2 = _context72.sent;
|
|
10937
11286
|
campaign = _yield$this$post2.campaign;
|
|
10938
|
-
return
|
|
11287
|
+
return _context72.abrupt("return", campaign);
|
|
10939
11288
|
|
|
10940
11289
|
case 5:
|
|
10941
11290
|
case "end":
|
|
10942
|
-
return
|
|
11291
|
+
return _context72.stop();
|
|
10943
11292
|
}
|
|
10944
11293
|
}
|
|
10945
|
-
},
|
|
11294
|
+
}, _callee72, this);
|
|
10946
11295
|
}));
|
|
10947
11296
|
|
|
10948
|
-
function createCampaign(
|
|
11297
|
+
function createCampaign(_x104) {
|
|
10949
11298
|
return _createCampaign.apply(this, arguments);
|
|
10950
11299
|
}
|
|
10951
11300
|
|
|
@@ -10961,15 +11310,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10961
11310
|
}, {
|
|
10962
11311
|
key: "queryCampaigns",
|
|
10963
11312
|
value: function () {
|
|
10964
|
-
var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11313
|
+
var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(filters) {
|
|
10965
11314
|
var options,
|
|
10966
|
-
|
|
10967
|
-
return _regeneratorRuntime.wrap(function
|
|
11315
|
+
_args73 = arguments;
|
|
11316
|
+
return _regeneratorRuntime.wrap(function _callee73$(_context73) {
|
|
10968
11317
|
while (1) {
|
|
10969
|
-
switch (
|
|
11318
|
+
switch (_context73.prev = _context73.next) {
|
|
10970
11319
|
case 0:
|
|
10971
|
-
options =
|
|
10972
|
-
|
|
11320
|
+
options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {};
|
|
11321
|
+
_context73.next = 3;
|
|
10973
11322
|
return this.get(this.baseURL + "/campaigns", {
|
|
10974
11323
|
payload: _objectSpread({
|
|
10975
11324
|
filter_conditions: filters
|
|
@@ -10977,17 +11326,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10977
11326
|
});
|
|
10978
11327
|
|
|
10979
11328
|
case 3:
|
|
10980
|
-
return
|
|
11329
|
+
return _context73.abrupt("return", _context73.sent);
|
|
10981
11330
|
|
|
10982
11331
|
case 4:
|
|
10983
11332
|
case "end":
|
|
10984
|
-
return
|
|
11333
|
+
return _context73.stop();
|
|
10985
11334
|
}
|
|
10986
11335
|
}
|
|
10987
|
-
},
|
|
11336
|
+
}, _callee73, this);
|
|
10988
11337
|
}));
|
|
10989
11338
|
|
|
10990
|
-
function queryCampaigns(
|
|
11339
|
+
function queryCampaigns(_x105) {
|
|
10991
11340
|
return _queryCampaigns.apply(this, arguments);
|
|
10992
11341
|
}
|
|
10993
11342
|
|
|
@@ -11005,32 +11354,32 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11005
11354
|
}, {
|
|
11006
11355
|
key: "updateCampaign",
|
|
11007
11356
|
value: function () {
|
|
11008
|
-
var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11357
|
+
var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id, params) {
|
|
11009
11358
|
var _yield$this$put2, campaign;
|
|
11010
11359
|
|
|
11011
|
-
return _regeneratorRuntime.wrap(function
|
|
11360
|
+
return _regeneratorRuntime.wrap(function _callee74$(_context74) {
|
|
11012
11361
|
while (1) {
|
|
11013
|
-
switch (
|
|
11362
|
+
switch (_context74.prev = _context74.next) {
|
|
11014
11363
|
case 0:
|
|
11015
|
-
|
|
11364
|
+
_context74.next = 2;
|
|
11016
11365
|
return this.put(this.baseURL + "/campaigns/".concat(id), {
|
|
11017
11366
|
campaign: params
|
|
11018
11367
|
});
|
|
11019
11368
|
|
|
11020
11369
|
case 2:
|
|
11021
|
-
_yield$this$put2 =
|
|
11370
|
+
_yield$this$put2 = _context74.sent;
|
|
11022
11371
|
campaign = _yield$this$put2.campaign;
|
|
11023
|
-
return
|
|
11372
|
+
return _context74.abrupt("return", campaign);
|
|
11024
11373
|
|
|
11025
11374
|
case 5:
|
|
11026
11375
|
case "end":
|
|
11027
|
-
return
|
|
11376
|
+
return _context74.stop();
|
|
11028
11377
|
}
|
|
11029
11378
|
}
|
|
11030
|
-
},
|
|
11379
|
+
}, _callee74, this);
|
|
11031
11380
|
}));
|
|
11032
11381
|
|
|
11033
|
-
function updateCampaign(
|
|
11382
|
+
function updateCampaign(_x106, _x107) {
|
|
11034
11383
|
return _updateCampaign.apply(this, arguments);
|
|
11035
11384
|
}
|
|
11036
11385
|
|
|
@@ -11047,25 +11396,25 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11047
11396
|
}, {
|
|
11048
11397
|
key: "deleteCampaign",
|
|
11049
11398
|
value: function () {
|
|
11050
|
-
var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11399
|
+
var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(id) {
|
|
11051
11400
|
var params,
|
|
11052
|
-
|
|
11053
|
-
return _regeneratorRuntime.wrap(function
|
|
11401
|
+
_args75 = arguments;
|
|
11402
|
+
return _regeneratorRuntime.wrap(function _callee75$(_context75) {
|
|
11054
11403
|
while (1) {
|
|
11055
|
-
switch (
|
|
11404
|
+
switch (_context75.prev = _context75.next) {
|
|
11056
11405
|
case 0:
|
|
11057
|
-
params =
|
|
11058
|
-
return
|
|
11406
|
+
params = _args75.length > 1 && _args75[1] !== undefined ? _args75[1] : {};
|
|
11407
|
+
return _context75.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
|
|
11059
11408
|
|
|
11060
11409
|
case 2:
|
|
11061
11410
|
case "end":
|
|
11062
|
-
return
|
|
11411
|
+
return _context75.stop();
|
|
11063
11412
|
}
|
|
11064
11413
|
}
|
|
11065
|
-
},
|
|
11414
|
+
}, _callee75, this);
|
|
11066
11415
|
}));
|
|
11067
11416
|
|
|
11068
|
-
function deleteCampaign(
|
|
11417
|
+
function deleteCampaign(_x108) {
|
|
11069
11418
|
return _deleteCampaign.apply(this, arguments);
|
|
11070
11419
|
}
|
|
11071
11420
|
|
|
@@ -11083,33 +11432,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11083
11432
|
}, {
|
|
11084
11433
|
key: "scheduleCampaign",
|
|
11085
11434
|
value: function () {
|
|
11086
|
-
var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11435
|
+
var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(id, params) {
|
|
11087
11436
|
var scheduledFor, _yield$this$patch, campaign;
|
|
11088
11437
|
|
|
11089
|
-
return _regeneratorRuntime.wrap(function
|
|
11438
|
+
return _regeneratorRuntime.wrap(function _callee76$(_context76) {
|
|
11090
11439
|
while (1) {
|
|
11091
|
-
switch (
|
|
11440
|
+
switch (_context76.prev = _context76.next) {
|
|
11092
11441
|
case 0:
|
|
11093
11442
|
scheduledFor = params.scheduledFor;
|
|
11094
|
-
|
|
11443
|
+
_context76.next = 3;
|
|
11095
11444
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
|
|
11096
11445
|
scheduled_for: scheduledFor
|
|
11097
11446
|
});
|
|
11098
11447
|
|
|
11099
11448
|
case 3:
|
|
11100
|
-
_yield$this$patch =
|
|
11449
|
+
_yield$this$patch = _context76.sent;
|
|
11101
11450
|
campaign = _yield$this$patch.campaign;
|
|
11102
|
-
return
|
|
11451
|
+
return _context76.abrupt("return", campaign);
|
|
11103
11452
|
|
|
11104
11453
|
case 6:
|
|
11105
11454
|
case "end":
|
|
11106
|
-
return
|
|
11455
|
+
return _context76.stop();
|
|
11107
11456
|
}
|
|
11108
11457
|
}
|
|
11109
|
-
},
|
|
11458
|
+
}, _callee76, this);
|
|
11110
11459
|
}));
|
|
11111
11460
|
|
|
11112
|
-
function scheduleCampaign(
|
|
11461
|
+
function scheduleCampaign(_x109, _x110) {
|
|
11113
11462
|
return _scheduleCampaign.apply(this, arguments);
|
|
11114
11463
|
}
|
|
11115
11464
|
|
|
@@ -11126,30 +11475,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11126
11475
|
}, {
|
|
11127
11476
|
key: "stopCampaign",
|
|
11128
11477
|
value: function () {
|
|
11129
|
-
var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11478
|
+
var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(id) {
|
|
11130
11479
|
var _yield$this$patch2, campaign;
|
|
11131
11480
|
|
|
11132
|
-
return _regeneratorRuntime.wrap(function
|
|
11481
|
+
return _regeneratorRuntime.wrap(function _callee77$(_context77) {
|
|
11133
11482
|
while (1) {
|
|
11134
|
-
switch (
|
|
11483
|
+
switch (_context77.prev = _context77.next) {
|
|
11135
11484
|
case 0:
|
|
11136
|
-
|
|
11485
|
+
_context77.next = 2;
|
|
11137
11486
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
|
|
11138
11487
|
|
|
11139
11488
|
case 2:
|
|
11140
|
-
_yield$this$patch2 =
|
|
11489
|
+
_yield$this$patch2 = _context77.sent;
|
|
11141
11490
|
campaign = _yield$this$patch2.campaign;
|
|
11142
|
-
return
|
|
11491
|
+
return _context77.abrupt("return", campaign);
|
|
11143
11492
|
|
|
11144
11493
|
case 5:
|
|
11145
11494
|
case "end":
|
|
11146
|
-
return
|
|
11495
|
+
return _context77.stop();
|
|
11147
11496
|
}
|
|
11148
11497
|
}
|
|
11149
|
-
},
|
|
11498
|
+
}, _callee77, this);
|
|
11150
11499
|
}));
|
|
11151
11500
|
|
|
11152
|
-
function stopCampaign(
|
|
11501
|
+
function stopCampaign(_x111) {
|
|
11153
11502
|
return _stopCampaign.apply(this, arguments);
|
|
11154
11503
|
}
|
|
11155
11504
|
|
|
@@ -11166,30 +11515,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11166
11515
|
}, {
|
|
11167
11516
|
key: "resumeCampaign",
|
|
11168
11517
|
value: function () {
|
|
11169
|
-
var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11518
|
+
var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(id) {
|
|
11170
11519
|
var _yield$this$patch3, campaign;
|
|
11171
11520
|
|
|
11172
|
-
return _regeneratorRuntime.wrap(function
|
|
11521
|
+
return _regeneratorRuntime.wrap(function _callee78$(_context78) {
|
|
11173
11522
|
while (1) {
|
|
11174
|
-
switch (
|
|
11523
|
+
switch (_context78.prev = _context78.next) {
|
|
11175
11524
|
case 0:
|
|
11176
|
-
|
|
11525
|
+
_context78.next = 2;
|
|
11177
11526
|
return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
|
|
11178
11527
|
|
|
11179
11528
|
case 2:
|
|
11180
|
-
_yield$this$patch3 =
|
|
11529
|
+
_yield$this$patch3 = _context78.sent;
|
|
11181
11530
|
campaign = _yield$this$patch3.campaign;
|
|
11182
|
-
return
|
|
11531
|
+
return _context78.abrupt("return", campaign);
|
|
11183
11532
|
|
|
11184
11533
|
case 5:
|
|
11185
11534
|
case "end":
|
|
11186
|
-
return
|
|
11535
|
+
return _context78.stop();
|
|
11187
11536
|
}
|
|
11188
11537
|
}
|
|
11189
|
-
},
|
|
11538
|
+
}, _callee78, this);
|
|
11190
11539
|
}));
|
|
11191
11540
|
|
|
11192
|
-
function resumeCampaign(
|
|
11541
|
+
function resumeCampaign(_x112) {
|
|
11193
11542
|
return _resumeCampaign.apply(this, arguments);
|
|
11194
11543
|
}
|
|
11195
11544
|
|
|
@@ -11207,30 +11556,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11207
11556
|
}, {
|
|
11208
11557
|
key: "testCampaign",
|
|
11209
11558
|
value: function () {
|
|
11210
|
-
var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11559
|
+
var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(id, params) {
|
|
11211
11560
|
var users;
|
|
11212
|
-
return _regeneratorRuntime.wrap(function
|
|
11561
|
+
return _regeneratorRuntime.wrap(function _callee79$(_context79) {
|
|
11213
11562
|
while (1) {
|
|
11214
|
-
switch (
|
|
11563
|
+
switch (_context79.prev = _context79.next) {
|
|
11215
11564
|
case 0:
|
|
11216
11565
|
users = params.users;
|
|
11217
|
-
|
|
11566
|
+
_context79.next = 3;
|
|
11218
11567
|
return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
|
|
11219
11568
|
users: users
|
|
11220
11569
|
});
|
|
11221
11570
|
|
|
11222
11571
|
case 3:
|
|
11223
|
-
return
|
|
11572
|
+
return _context79.abrupt("return", _context79.sent);
|
|
11224
11573
|
|
|
11225
11574
|
case 4:
|
|
11226
11575
|
case "end":
|
|
11227
|
-
return
|
|
11576
|
+
return _context79.stop();
|
|
11228
11577
|
}
|
|
11229
11578
|
}
|
|
11230
|
-
},
|
|
11579
|
+
}, _callee79, this);
|
|
11231
11580
|
}));
|
|
11232
11581
|
|
|
11233
|
-
function testCampaign(
|
|
11582
|
+
function testCampaign(_x113, _x114) {
|
|
11234
11583
|
return _testCampaign.apply(this, arguments);
|
|
11235
11584
|
}
|
|
11236
11585
|
|
|
@@ -11246,24 +11595,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11246
11595
|
}, {
|
|
11247
11596
|
key: "enrichURL",
|
|
11248
11597
|
value: function () {
|
|
11249
|
-
var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11250
|
-
return _regeneratorRuntime.wrap(function
|
|
11598
|
+
var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(url) {
|
|
11599
|
+
return _regeneratorRuntime.wrap(function _callee80$(_context80) {
|
|
11251
11600
|
while (1) {
|
|
11252
|
-
switch (
|
|
11601
|
+
switch (_context80.prev = _context80.next) {
|
|
11253
11602
|
case 0:
|
|
11254
|
-
return
|
|
11603
|
+
return _context80.abrupt("return", this.get(this.baseURL + "/og", {
|
|
11255
11604
|
url: url
|
|
11256
11605
|
}));
|
|
11257
11606
|
|
|
11258
11607
|
case 1:
|
|
11259
11608
|
case "end":
|
|
11260
|
-
return
|
|
11609
|
+
return _context80.stop();
|
|
11261
11610
|
}
|
|
11262
11611
|
}
|
|
11263
|
-
},
|
|
11612
|
+
}, _callee80, this);
|
|
11264
11613
|
}));
|
|
11265
11614
|
|
|
11266
|
-
function enrichURL(
|
|
11615
|
+
function enrichURL(_x115) {
|
|
11267
11616
|
return _enrichURL.apply(this, arguments);
|
|
11268
11617
|
}
|
|
11269
11618
|
|
|
@@ -11280,22 +11629,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11280
11629
|
}, {
|
|
11281
11630
|
key: "getTask",
|
|
11282
11631
|
value: function () {
|
|
11283
|
-
var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11284
|
-
return _regeneratorRuntime.wrap(function
|
|
11632
|
+
var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
|
|
11633
|
+
return _regeneratorRuntime.wrap(function _callee81$(_context81) {
|
|
11285
11634
|
while (1) {
|
|
11286
|
-
switch (
|
|
11635
|
+
switch (_context81.prev = _context81.next) {
|
|
11287
11636
|
case 0:
|
|
11288
|
-
return
|
|
11637
|
+
return _context81.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
|
|
11289
11638
|
|
|
11290
11639
|
case 1:
|
|
11291
11640
|
case "end":
|
|
11292
|
-
return
|
|
11641
|
+
return _context81.stop();
|
|
11293
11642
|
}
|
|
11294
11643
|
}
|
|
11295
|
-
},
|
|
11644
|
+
}, _callee81, this);
|
|
11296
11645
|
}));
|
|
11297
11646
|
|
|
11298
|
-
function getTask(
|
|
11647
|
+
function getTask(_x116) {
|
|
11299
11648
|
return _getTask.apply(this, arguments);
|
|
11300
11649
|
}
|
|
11301
11650
|
|
|
@@ -11313,31 +11662,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11313
11662
|
}, {
|
|
11314
11663
|
key: "deleteChannels",
|
|
11315
11664
|
value: function () {
|
|
11316
|
-
var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11665
|
+
var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee82(cids) {
|
|
11317
11666
|
var options,
|
|
11318
|
-
|
|
11319
|
-
return _regeneratorRuntime.wrap(function
|
|
11667
|
+
_args82 = arguments;
|
|
11668
|
+
return _regeneratorRuntime.wrap(function _callee82$(_context82) {
|
|
11320
11669
|
while (1) {
|
|
11321
|
-
switch (
|
|
11670
|
+
switch (_context82.prev = _context82.next) {
|
|
11322
11671
|
case 0:
|
|
11323
|
-
options =
|
|
11324
|
-
|
|
11672
|
+
options = _args82.length > 1 && _args82[1] !== undefined ? _args82[1] : {};
|
|
11673
|
+
_context82.next = 3;
|
|
11325
11674
|
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
11326
11675
|
cids: cids
|
|
11327
11676
|
}, options));
|
|
11328
11677
|
|
|
11329
11678
|
case 3:
|
|
11330
|
-
return
|
|
11679
|
+
return _context82.abrupt("return", _context82.sent);
|
|
11331
11680
|
|
|
11332
11681
|
case 4:
|
|
11333
11682
|
case "end":
|
|
11334
|
-
return
|
|
11683
|
+
return _context82.stop();
|
|
11335
11684
|
}
|
|
11336
11685
|
}
|
|
11337
|
-
},
|
|
11686
|
+
}, _callee82, this);
|
|
11338
11687
|
}));
|
|
11339
11688
|
|
|
11340
|
-
function deleteChannels(
|
|
11689
|
+
function deleteChannels(_x117) {
|
|
11341
11690
|
return _deleteChannels.apply(this, arguments);
|
|
11342
11691
|
}
|
|
11343
11692
|
|
|
@@ -11355,17 +11704,17 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11355
11704
|
}, {
|
|
11356
11705
|
key: "deleteUsers",
|
|
11357
11706
|
value: function () {
|
|
11358
|
-
var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11707
|
+
var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee83(user_ids) {
|
|
11359
11708
|
var options,
|
|
11360
|
-
|
|
11361
|
-
return _regeneratorRuntime.wrap(function
|
|
11709
|
+
_args83 = arguments;
|
|
11710
|
+
return _regeneratorRuntime.wrap(function _callee83$(_context83) {
|
|
11362
11711
|
while (1) {
|
|
11363
|
-
switch (
|
|
11712
|
+
switch (_context83.prev = _context83.next) {
|
|
11364
11713
|
case 0:
|
|
11365
|
-
options =
|
|
11714
|
+
options = _args83.length > 1 && _args83[1] !== undefined ? _args83[1] : {};
|
|
11366
11715
|
|
|
11367
11716
|
if (!(typeof options.user !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.user))) {
|
|
11368
|
-
|
|
11717
|
+
_context83.next = 3;
|
|
11369
11718
|
break;
|
|
11370
11719
|
}
|
|
11371
11720
|
|
|
@@ -11373,7 +11722,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11373
11722
|
|
|
11374
11723
|
case 3:
|
|
11375
11724
|
if (!(typeof options.conversations !== 'undefined' && !['soft', 'hard'].includes(options.conversations))) {
|
|
11376
|
-
|
|
11725
|
+
_context83.next = 5;
|
|
11377
11726
|
break;
|
|
11378
11727
|
}
|
|
11379
11728
|
|
|
@@ -11381,30 +11730,30 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11381
11730
|
|
|
11382
11731
|
case 5:
|
|
11383
11732
|
if (!(typeof options.messages !== 'undefined' && !['soft', 'hard', 'pruning'].includes(options.messages))) {
|
|
11384
|
-
|
|
11733
|
+
_context83.next = 7;
|
|
11385
11734
|
break;
|
|
11386
11735
|
}
|
|
11387
11736
|
|
|
11388
11737
|
throw new Error('Invalid delete user options. messages must be one of [soft hard pruning]');
|
|
11389
11738
|
|
|
11390
11739
|
case 7:
|
|
11391
|
-
|
|
11740
|
+
_context83.next = 9;
|
|
11392
11741
|
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
11393
11742
|
user_ids: user_ids
|
|
11394
11743
|
}, options));
|
|
11395
11744
|
|
|
11396
11745
|
case 9:
|
|
11397
|
-
return
|
|
11746
|
+
return _context83.abrupt("return", _context83.sent);
|
|
11398
11747
|
|
|
11399
11748
|
case 10:
|
|
11400
11749
|
case "end":
|
|
11401
|
-
return
|
|
11750
|
+
return _context83.stop();
|
|
11402
11751
|
}
|
|
11403
11752
|
}
|
|
11404
|
-
},
|
|
11753
|
+
}, _callee83, this);
|
|
11405
11754
|
}));
|
|
11406
11755
|
|
|
11407
|
-
function deleteUsers(
|
|
11756
|
+
function deleteUsers(_x118) {
|
|
11408
11757
|
return _deleteUsers.apply(this, arguments);
|
|
11409
11758
|
}
|
|
11410
11759
|
|
|
@@ -11425,28 +11774,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11425
11774
|
}, {
|
|
11426
11775
|
key: "_createImportURL",
|
|
11427
11776
|
value: function () {
|
|
11428
|
-
var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11429
|
-
return _regeneratorRuntime.wrap(function
|
|
11777
|
+
var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee84(filename) {
|
|
11778
|
+
return _regeneratorRuntime.wrap(function _callee84$(_context84) {
|
|
11430
11779
|
while (1) {
|
|
11431
|
-
switch (
|
|
11780
|
+
switch (_context84.prev = _context84.next) {
|
|
11432
11781
|
case 0:
|
|
11433
|
-
|
|
11782
|
+
_context84.next = 2;
|
|
11434
11783
|
return this.post(this.baseURL + "/import_urls", {
|
|
11435
11784
|
filename: filename
|
|
11436
11785
|
});
|
|
11437
11786
|
|
|
11438
11787
|
case 2:
|
|
11439
|
-
return
|
|
11788
|
+
return _context84.abrupt("return", _context84.sent);
|
|
11440
11789
|
|
|
11441
11790
|
case 3:
|
|
11442
11791
|
case "end":
|
|
11443
|
-
return
|
|
11792
|
+
return _context84.stop();
|
|
11444
11793
|
}
|
|
11445
11794
|
}
|
|
11446
|
-
},
|
|
11795
|
+
}, _callee84, this);
|
|
11447
11796
|
}));
|
|
11448
11797
|
|
|
11449
|
-
function _createImportURL(
|
|
11798
|
+
function _createImportURL(_x119) {
|
|
11450
11799
|
return _createImportURL2.apply(this, arguments);
|
|
11451
11800
|
}
|
|
11452
11801
|
|
|
@@ -11468,33 +11817,33 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11468
11817
|
}, {
|
|
11469
11818
|
key: "_createImport",
|
|
11470
11819
|
value: function () {
|
|
11471
|
-
var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11820
|
+
var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee85(path) {
|
|
11472
11821
|
var options,
|
|
11473
|
-
|
|
11474
|
-
return _regeneratorRuntime.wrap(function
|
|
11822
|
+
_args85 = arguments;
|
|
11823
|
+
return _regeneratorRuntime.wrap(function _callee85$(_context85) {
|
|
11475
11824
|
while (1) {
|
|
11476
|
-
switch (
|
|
11825
|
+
switch (_context85.prev = _context85.next) {
|
|
11477
11826
|
case 0:
|
|
11478
|
-
options =
|
|
11827
|
+
options = _args85.length > 1 && _args85[1] !== undefined ? _args85[1] : {
|
|
11479
11828
|
mode: 'upsert'
|
|
11480
11829
|
};
|
|
11481
|
-
|
|
11830
|
+
_context85.next = 3;
|
|
11482
11831
|
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
11483
11832
|
path: path
|
|
11484
11833
|
}, options));
|
|
11485
11834
|
|
|
11486
11835
|
case 3:
|
|
11487
|
-
return
|
|
11836
|
+
return _context85.abrupt("return", _context85.sent);
|
|
11488
11837
|
|
|
11489
11838
|
case 4:
|
|
11490
11839
|
case "end":
|
|
11491
|
-
return
|
|
11840
|
+
return _context85.stop();
|
|
11492
11841
|
}
|
|
11493
11842
|
}
|
|
11494
|
-
},
|
|
11843
|
+
}, _callee85, this);
|
|
11495
11844
|
}));
|
|
11496
11845
|
|
|
11497
|
-
function _createImport(
|
|
11846
|
+
function _createImport(_x120) {
|
|
11498
11847
|
return _createImport2.apply(this, arguments);
|
|
11499
11848
|
}
|
|
11500
11849
|
|
|
@@ -11516,26 +11865,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11516
11865
|
}, {
|
|
11517
11866
|
key: "_getImport",
|
|
11518
11867
|
value: function () {
|
|
11519
|
-
var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11520
|
-
return _regeneratorRuntime.wrap(function
|
|
11868
|
+
var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee86(id) {
|
|
11869
|
+
return _regeneratorRuntime.wrap(function _callee86$(_context86) {
|
|
11521
11870
|
while (1) {
|
|
11522
|
-
switch (
|
|
11871
|
+
switch (_context86.prev = _context86.next) {
|
|
11523
11872
|
case 0:
|
|
11524
|
-
|
|
11873
|
+
_context86.next = 2;
|
|
11525
11874
|
return this.get(this.baseURL + "/imports/".concat(id));
|
|
11526
11875
|
|
|
11527
11876
|
case 2:
|
|
11528
|
-
return
|
|
11877
|
+
return _context86.abrupt("return", _context86.sent);
|
|
11529
11878
|
|
|
11530
11879
|
case 3:
|
|
11531
11880
|
case "end":
|
|
11532
|
-
return
|
|
11881
|
+
return _context86.stop();
|
|
11533
11882
|
}
|
|
11534
11883
|
}
|
|
11535
|
-
},
|
|
11884
|
+
}, _callee86, this);
|
|
11536
11885
|
}));
|
|
11537
11886
|
|
|
11538
|
-
function _getImport(
|
|
11887
|
+
function _getImport(_x121) {
|
|
11539
11888
|
return _getImport2.apply(this, arguments);
|
|
11540
11889
|
}
|
|
11541
11890
|
|
|
@@ -11557,26 +11906,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11557
11906
|
}, {
|
|
11558
11907
|
key: "_listImports",
|
|
11559
11908
|
value: function () {
|
|
11560
|
-
var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11561
|
-
return _regeneratorRuntime.wrap(function
|
|
11909
|
+
var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee87(options) {
|
|
11910
|
+
return _regeneratorRuntime.wrap(function _callee87$(_context87) {
|
|
11562
11911
|
while (1) {
|
|
11563
|
-
switch (
|
|
11912
|
+
switch (_context87.prev = _context87.next) {
|
|
11564
11913
|
case 0:
|
|
11565
|
-
|
|
11914
|
+
_context87.next = 2;
|
|
11566
11915
|
return this.get(this.baseURL + "/imports", options);
|
|
11567
11916
|
|
|
11568
11917
|
case 2:
|
|
11569
|
-
return
|
|
11918
|
+
return _context87.abrupt("return", _context87.sent);
|
|
11570
11919
|
|
|
11571
11920
|
case 3:
|
|
11572
11921
|
case "end":
|
|
11573
|
-
return
|
|
11922
|
+
return _context87.stop();
|
|
11574
11923
|
}
|
|
11575
11924
|
}
|
|
11576
|
-
},
|
|
11925
|
+
}, _callee87, this);
|
|
11577
11926
|
}));
|
|
11578
11927
|
|
|
11579
|
-
function _listImports(
|
|
11928
|
+
function _listImports(_x122) {
|
|
11580
11929
|
return _listImports2.apply(this, arguments);
|
|
11581
11930
|
}
|
|
11582
11931
|
|
|
@@ -11595,28 +11944,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11595
11944
|
}, {
|
|
11596
11945
|
key: "upsertPushProvider",
|
|
11597
11946
|
value: function () {
|
|
11598
|
-
var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11599
|
-
return _regeneratorRuntime.wrap(function
|
|
11947
|
+
var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee88(pushProvider) {
|
|
11948
|
+
return _regeneratorRuntime.wrap(function _callee88$(_context88) {
|
|
11600
11949
|
while (1) {
|
|
11601
|
-
switch (
|
|
11950
|
+
switch (_context88.prev = _context88.next) {
|
|
11602
11951
|
case 0:
|
|
11603
|
-
|
|
11952
|
+
_context88.next = 2;
|
|
11604
11953
|
return this.post(this.baseURL + "/push_providers", {
|
|
11605
11954
|
push_provider: pushProvider
|
|
11606
11955
|
});
|
|
11607
11956
|
|
|
11608
11957
|
case 2:
|
|
11609
|
-
return
|
|
11958
|
+
return _context88.abrupt("return", _context88.sent);
|
|
11610
11959
|
|
|
11611
11960
|
case 3:
|
|
11612
11961
|
case "end":
|
|
11613
|
-
return
|
|
11962
|
+
return _context88.stop();
|
|
11614
11963
|
}
|
|
11615
11964
|
}
|
|
11616
|
-
},
|
|
11965
|
+
}, _callee88, this);
|
|
11617
11966
|
}));
|
|
11618
11967
|
|
|
11619
|
-
function upsertPushProvider(
|
|
11968
|
+
function upsertPushProvider(_x123) {
|
|
11620
11969
|
return _upsertPushProvider.apply(this, arguments);
|
|
11621
11970
|
}
|
|
11622
11971
|
|
|
@@ -11635,28 +11984,28 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11635
11984
|
}, {
|
|
11636
11985
|
key: "deletePushProvider",
|
|
11637
11986
|
value: function () {
|
|
11638
|
-
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11987
|
+
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee89(_ref10) {
|
|
11639
11988
|
var type, name;
|
|
11640
|
-
return _regeneratorRuntime.wrap(function
|
|
11989
|
+
return _regeneratorRuntime.wrap(function _callee89$(_context89) {
|
|
11641
11990
|
while (1) {
|
|
11642
|
-
switch (
|
|
11991
|
+
switch (_context89.prev = _context89.next) {
|
|
11643
11992
|
case 0:
|
|
11644
11993
|
type = _ref10.type, name = _ref10.name;
|
|
11645
|
-
|
|
11994
|
+
_context89.next = 3;
|
|
11646
11995
|
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
11647
11996
|
|
|
11648
11997
|
case 3:
|
|
11649
|
-
return
|
|
11998
|
+
return _context89.abrupt("return", _context89.sent);
|
|
11650
11999
|
|
|
11651
12000
|
case 4:
|
|
11652
12001
|
case "end":
|
|
11653
|
-
return
|
|
12002
|
+
return _context89.stop();
|
|
11654
12003
|
}
|
|
11655
12004
|
}
|
|
11656
|
-
},
|
|
12005
|
+
}, _callee89, this);
|
|
11657
12006
|
}));
|
|
11658
12007
|
|
|
11659
|
-
function deletePushProvider(
|
|
12008
|
+
function deletePushProvider(_x124) {
|
|
11660
12009
|
return _deletePushProvider.apply(this, arguments);
|
|
11661
12010
|
}
|
|
11662
12011
|
|
|
@@ -11673,23 +12022,23 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11673
12022
|
}, {
|
|
11674
12023
|
key: "listPushProviders",
|
|
11675
12024
|
value: function () {
|
|
11676
|
-
var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11677
|
-
return _regeneratorRuntime.wrap(function
|
|
12025
|
+
var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee90() {
|
|
12026
|
+
return _regeneratorRuntime.wrap(function _callee90$(_context90) {
|
|
11678
12027
|
while (1) {
|
|
11679
|
-
switch (
|
|
12028
|
+
switch (_context90.prev = _context90.next) {
|
|
11680
12029
|
case 0:
|
|
11681
|
-
|
|
12030
|
+
_context90.next = 2;
|
|
11682
12031
|
return this.get(this.baseURL + "/push_providers");
|
|
11683
12032
|
|
|
11684
12033
|
case 2:
|
|
11685
|
-
return
|
|
12034
|
+
return _context90.abrupt("return", _context90.sent);
|
|
11686
12035
|
|
|
11687
12036
|
case 3:
|
|
11688
12037
|
case "end":
|
|
11689
|
-
return
|
|
12038
|
+
return _context90.stop();
|
|
11690
12039
|
}
|
|
11691
12040
|
}
|
|
11692
|
-
},
|
|
12041
|
+
}, _callee90, this);
|
|
11693
12042
|
}));
|
|
11694
12043
|
|
|
11695
12044
|
function listPushProviders() {
|
|
@@ -11717,26 +12066,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11717
12066
|
}, {
|
|
11718
12067
|
key: "commitMessage",
|
|
11719
12068
|
value: function () {
|
|
11720
|
-
var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
11721
|
-
return _regeneratorRuntime.wrap(function
|
|
12069
|
+
var _commitMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee91(id) {
|
|
12070
|
+
return _regeneratorRuntime.wrap(function _callee91$(_context91) {
|
|
11722
12071
|
while (1) {
|
|
11723
|
-
switch (
|
|
12072
|
+
switch (_context91.prev = _context91.next) {
|
|
11724
12073
|
case 0:
|
|
11725
|
-
|
|
12074
|
+
_context91.next = 2;
|
|
11726
12075
|
return this.post(this.baseURL + "/messages/".concat(id, "/commit"));
|
|
11727
12076
|
|
|
11728
12077
|
case 2:
|
|
11729
|
-
return
|
|
12078
|
+
return _context91.abrupt("return", _context91.sent);
|
|
11730
12079
|
|
|
11731
12080
|
case 3:
|
|
11732
12081
|
case "end":
|
|
11733
|
-
return
|
|
12082
|
+
return _context91.stop();
|
|
11734
12083
|
}
|
|
11735
12084
|
}
|
|
11736
|
-
},
|
|
12085
|
+
}, _callee91, this);
|
|
11737
12086
|
}));
|
|
11738
12087
|
|
|
11739
|
-
function commitMessage(
|
|
12088
|
+
function commitMessage(_x125) {
|
|
11740
12089
|
return _commitMessage.apply(this, arguments);
|
|
11741
12090
|
}
|
|
11742
12091
|
|
|
@@ -11792,6 +12141,7 @@ var EVENT_MAP = {
|
|
|
11792
12141
|
'notification.message_new': true,
|
|
11793
12142
|
'notification.mutes_updated': true,
|
|
11794
12143
|
'notification.removed_from_channel': true,
|
|
12144
|
+
'notification.thread_message_new': true,
|
|
11795
12145
|
'reaction.deleted': true,
|
|
11796
12146
|
'reaction.new': true,
|
|
11797
12147
|
'reaction.updated': true,
|
|
@@ -11887,5 +12237,5 @@ var BuiltinPermissions = {
|
|
|
11887
12237
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
11888
12238
|
};
|
|
11889
12239
|
|
|
11890
|
-
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
|
|
12240
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
|
|
11891
12241
|
//# sourceMappingURL=index.es.js.map
|