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