stream-chat 6.2.0 → 6.5.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 +662 -196
- 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 +662 -196
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +662 -196
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +662 -196
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +6 -5
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_state.d.ts +36 -5
- package/dist/types/channel_state.d.ts.map +1 -1
- package/dist/types/client.d.ts +77 -46
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/token_manager.d.ts.map +1 -1
- package/dist/types/types.d.ts +73 -5
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/channel.ts +24 -16
- package/src/channel_state.ts +240 -48
- package/src/client.ts +99 -48
- package/src/token_manager.ts +6 -2
- package/src/types.ts +128 -9
package/dist/browser.js
CHANGED
|
@@ -122,6 +122,13 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
122
122
|
* When false, any new message (received by websocket event - message.new) will not
|
|
123
123
|
* be pushed on to message list.
|
|
124
124
|
*/
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Disjoint lists of messages
|
|
128
|
+
* Users can jump in the message list (with searching) and this can result in disjoint lists of messages
|
|
129
|
+
* The state manages these lists and merges them when lists overlap
|
|
130
|
+
* The messages array contains the currently active set
|
|
131
|
+
*/
|
|
125
132
|
function ChannelState(channel) {
|
|
126
133
|
var _this = this,
|
|
127
134
|
_channel$state;
|
|
@@ -136,8 +143,6 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
136
143
|
|
|
137
144
|
_defineProperty__default['default'](this, "read", void 0);
|
|
138
145
|
|
|
139
|
-
_defineProperty__default['default'](this, "messages", void 0);
|
|
140
|
-
|
|
141
146
|
_defineProperty__default['default'](this, "pinnedMessages", void 0);
|
|
142
147
|
|
|
143
148
|
_defineProperty__default['default'](this, "threads", void 0);
|
|
@@ -156,6 +161,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
156
161
|
|
|
157
162
|
_defineProperty__default['default'](this, "isUpToDate", void 0);
|
|
158
163
|
|
|
164
|
+
_defineProperty__default['default'](this, "messageSets", []);
|
|
165
|
+
|
|
159
166
|
_defineProperty__default['default'](this, "setIsUpToDate", function (isUpToDate) {
|
|
160
167
|
_this.isUpToDate = isUpToDate;
|
|
161
168
|
});
|
|
@@ -185,7 +192,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
185
192
|
}
|
|
186
193
|
};
|
|
187
194
|
|
|
188
|
-
|
|
195
|
+
_this.messageSets.forEach(function (set) {
|
|
196
|
+
return _updateUserMessages(set.messages, user);
|
|
197
|
+
});
|
|
189
198
|
|
|
190
199
|
for (var parentId in _this.threads) {
|
|
191
200
|
_updateUserMessages(_this.threads[parentId], user);
|
|
@@ -239,7 +248,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
239
248
|
}
|
|
240
249
|
};
|
|
241
250
|
|
|
242
|
-
|
|
251
|
+
_this.messageSets.forEach(function (set) {
|
|
252
|
+
return _deleteUserMessages(set.messages, user, hardDelete);
|
|
253
|
+
});
|
|
243
254
|
|
|
244
255
|
for (var parentId in _this.threads) {
|
|
245
256
|
_deleteUserMessages(_this.threads[parentId], user, hardDelete);
|
|
@@ -252,7 +263,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
252
263
|
this.watcher_count = 0;
|
|
253
264
|
this.typing = {};
|
|
254
265
|
this.read = {};
|
|
255
|
-
this.
|
|
266
|
+
this.initMessages();
|
|
256
267
|
this.pinnedMessages = [];
|
|
257
268
|
this.threads = {}; // a list of users to hide messages from
|
|
258
269
|
|
|
@@ -271,22 +282,58 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
271
282
|
this.isUpToDate = true;
|
|
272
283
|
this.last_message_at = (channel === null || channel === void 0 ? void 0 : (_channel$state = channel.state) === null || _channel$state === void 0 ? void 0 : _channel$state.last_message_at) != null ? new Date(channel.state.last_message_at) : null;
|
|
273
284
|
}
|
|
274
|
-
/**
|
|
275
|
-
* addMessageSorted - Add a message to the state
|
|
276
|
-
*
|
|
277
|
-
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
278
|
-
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
279
|
-
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
280
|
-
*
|
|
281
|
-
*/
|
|
282
|
-
|
|
283
285
|
|
|
284
286
|
_createClass__default['default'](ChannelState, [{
|
|
287
|
+
key: "messages",
|
|
288
|
+
get: function get() {
|
|
289
|
+
var _this$messageSets$fin;
|
|
290
|
+
|
|
291
|
+
return ((_this$messageSets$fin = this.messageSets.find(function (s) {
|
|
292
|
+
return s.isCurrent;
|
|
293
|
+
})) === null || _this$messageSets$fin === void 0 ? void 0 : _this$messageSets$fin.messages) || [];
|
|
294
|
+
},
|
|
295
|
+
set: function set(messages) {
|
|
296
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
297
|
+
return s.isCurrent;
|
|
298
|
+
});
|
|
299
|
+
this.messageSets[index].messages = messages;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The list of latest messages
|
|
303
|
+
* The messages array not always contains the latest messages (for example if a user searched for an earlier message, that is in a different message set)
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
}, {
|
|
307
|
+
key: "latestMessages",
|
|
308
|
+
get: function get() {
|
|
309
|
+
var _this$messageSets$fin2;
|
|
310
|
+
|
|
311
|
+
return ((_this$messageSets$fin2 = this.messageSets.find(function (s) {
|
|
312
|
+
return s.isLatest;
|
|
313
|
+
})) === null || _this$messageSets$fin2 === void 0 ? void 0 : _this$messageSets$fin2.messages) || [];
|
|
314
|
+
},
|
|
315
|
+
set: function set(messages) {
|
|
316
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
317
|
+
return s.isLatest;
|
|
318
|
+
});
|
|
319
|
+
this.messageSets[index].messages = messages;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* addMessageSorted - Add a message to the state
|
|
323
|
+
*
|
|
324
|
+
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
325
|
+
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
326
|
+
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
327
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if message is not in the list (only used if addIfDoesNotExist is true)
|
|
328
|
+
*/
|
|
329
|
+
|
|
330
|
+
}, {
|
|
285
331
|
key: "addMessageSorted",
|
|
286
332
|
value: function addMessageSorted(newMessage) {
|
|
287
333
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
288
334
|
var addIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
289
|
-
|
|
335
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'latest';
|
|
336
|
+
return this.addMessagesSorted([newMessage], timestampChanged, false, addIfDoesNotExist, messageSetToAddToIfDoesNotExist);
|
|
290
337
|
}
|
|
291
338
|
/**
|
|
292
339
|
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
@@ -318,6 +365,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
318
365
|
* @param {boolean} timestampChanged Whether updating messages with changed created_at value.
|
|
319
366
|
* @param {boolean} initializing Whether channel is being initialized.
|
|
320
367
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
368
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if messages are not in the list (only used if addIfDoesNotExist is true)
|
|
321
369
|
*
|
|
322
370
|
*/
|
|
323
371
|
|
|
@@ -327,48 +375,63 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
327
375
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
328
376
|
var initializing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
329
377
|
var addIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
378
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'current';
|
|
330
379
|
|
|
331
|
-
|
|
332
|
-
|
|
380
|
+
var _this$findTargetMessa = this.findTargetMessageSet(newMessages, addIfDoesNotExist, messageSetToAddToIfDoesNotExist),
|
|
381
|
+
messagesToAdd = _this$findTargetMessa.messagesToAdd,
|
|
382
|
+
targetMessageSetIndex = _this$findTargetMessa.targetMessageSetIndex;
|
|
333
383
|
|
|
334
|
-
|
|
384
|
+
for (var i = 0; i < messagesToAdd.length; i += 1) {
|
|
385
|
+
var isFromShadowBannedUser = messagesToAdd[i].shadowed;
|
|
335
386
|
|
|
336
387
|
if (isFromShadowBannedUser) {
|
|
337
388
|
continue;
|
|
338
|
-
}
|
|
389
|
+
} // If message is already formatted we can skip the tasks below
|
|
390
|
+
// This will be true for messages that are already present at the state -> this happens when we perform merging of message sets
|
|
391
|
+
// This will be also true for message previews used by some SDKs
|
|
339
392
|
|
|
340
|
-
var message = this.formatMessage(newMessages[i]);
|
|
341
393
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
* Store the reference to user for this channel, so that when we have to
|
|
345
|
-
* handle updates to user, we can use the reference map, to determine which
|
|
346
|
-
* channels need to be updated with updated user object.
|
|
347
|
-
*/
|
|
348
|
-
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
349
|
-
}
|
|
394
|
+
var isMessageFormatted = messagesToAdd[i].created_at instanceof Date;
|
|
395
|
+
var message = void 0;
|
|
350
396
|
|
|
351
|
-
if (
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
// and consumer can refetch the replies.
|
|
356
|
-
delete this.threads[message.id];
|
|
357
|
-
}
|
|
397
|
+
if (isMessageFormatted) {
|
|
398
|
+
message = messagesToAdd[i];
|
|
399
|
+
} else {
|
|
400
|
+
var _this$_channel;
|
|
358
401
|
|
|
359
|
-
|
|
360
|
-
this.last_message_at = new Date(message.created_at.getTime());
|
|
361
|
-
}
|
|
402
|
+
message = this.formatMessage(messagesToAdd[i]);
|
|
362
403
|
|
|
363
|
-
|
|
364
|
-
|
|
404
|
+
if (message.user && (_this$_channel = this._channel) !== null && _this$_channel !== void 0 && _this$_channel.cid) {
|
|
405
|
+
/**
|
|
406
|
+
* Store the reference to user for this channel, so that when we have to
|
|
407
|
+
* handle updates to user, we can use the reference map, to determine which
|
|
408
|
+
* channels need to be updated with updated user object.
|
|
409
|
+
*/
|
|
410
|
+
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (initializing && message.id && this.threads[message.id]) {
|
|
414
|
+
// If we are initializing the state of channel (e.g., in case of connection recovery),
|
|
415
|
+
// then in that case we remove thread related to this message from threads object.
|
|
416
|
+
// This way we can ensure that we don't have any stale data in thread object
|
|
417
|
+
// and consumer can refetch the replies.
|
|
418
|
+
delete this.threads[message.id];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (!this.last_message_at) {
|
|
422
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (message.created_at.getTime() > this.last_message_at.getTime()) {
|
|
426
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
427
|
+
}
|
|
365
428
|
} // update or append the messages...
|
|
366
429
|
|
|
367
430
|
|
|
368
|
-
var parentID = message.parent_id; // add to the
|
|
431
|
+
var parentID = message.parent_id; // add to the given message set
|
|
369
432
|
|
|
370
|
-
if (!parentID || message.show_in_channel) {
|
|
371
|
-
this.messages = this._addToMessageList(this.messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
433
|
+
if ((!parentID || message.show_in_channel) && targetMessageSetIndex !== -1) {
|
|
434
|
+
this.messageSets[targetMessageSetIndex].messages = this._addToMessageList(this.messageSets[targetMessageSetIndex].messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
372
435
|
}
|
|
373
436
|
/**
|
|
374
437
|
* Add message to thread if applicable and the message
|
|
@@ -492,6 +555,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
492
555
|
}, {
|
|
493
556
|
key: "removeQuotedMessageReferences",
|
|
494
557
|
value: function removeQuotedMessageReferences(message) {
|
|
558
|
+
var _this4 = this;
|
|
559
|
+
|
|
495
560
|
var parseMessage = function parseMessage(m) {
|
|
496
561
|
var _m$pinned_at, _m$updated_at;
|
|
497
562
|
|
|
@@ -502,16 +567,19 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
502
567
|
});
|
|
503
568
|
};
|
|
504
569
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
570
|
+
this.messageSets.forEach(function (set) {
|
|
571
|
+
var updatedMessages = set.messages.filter(function (msg) {
|
|
572
|
+
return msg.quoted_message_id === message.id;
|
|
573
|
+
}).map(parseMessage).map(function (msg) {
|
|
574
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
575
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
576
|
+
attachments: []
|
|
577
|
+
})
|
|
578
|
+
});
|
|
512
579
|
});
|
|
580
|
+
|
|
581
|
+
_this4.addMessagesSorted(updatedMessages, true);
|
|
513
582
|
});
|
|
514
|
-
this.addMessagesSorted(updatedMessages, true);
|
|
515
583
|
}
|
|
516
584
|
/**
|
|
517
585
|
* Updates all instances of given message in channel state
|
|
@@ -539,12 +607,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
539
607
|
}
|
|
540
608
|
|
|
541
609
|
if (!show_in_channel && !parent_id || show_in_channel) {
|
|
542
|
-
var
|
|
543
|
-
|
|
544
|
-
|
|
610
|
+
var messageSetIndex = this.findMessageSetIndex(message);
|
|
611
|
+
|
|
612
|
+
if (messageSetIndex !== -1) {
|
|
613
|
+
var _msgIndex = this.messageSets[messageSetIndex].messages.findIndex(function (msg) {
|
|
614
|
+
return msg.id === message.id;
|
|
615
|
+
});
|
|
545
616
|
|
|
546
|
-
|
|
547
|
-
|
|
617
|
+
if (_msgIndex !== -1) {
|
|
618
|
+
this.messageSets[messageSetIndex].messages[_msgIndex] = updateFunc(this.messageSets[messageSetIndex].messages[_msgIndex]);
|
|
619
|
+
}
|
|
548
620
|
}
|
|
549
621
|
}
|
|
550
622
|
|
|
@@ -663,12 +735,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
663
735
|
this.threads[messageToRemove.parent_id] = threadMessages;
|
|
664
736
|
isRemoved = removed;
|
|
665
737
|
} else {
|
|
666
|
-
var
|
|
667
|
-
_removed = _this$removeMessageFr3.removed,
|
|
668
|
-
messages = _this$removeMessageFr3.result;
|
|
738
|
+
var messageSetIndex = this.findMessageSetIndex(messageToRemove);
|
|
669
739
|
|
|
670
|
-
|
|
671
|
-
|
|
740
|
+
if (messageSetIndex !== -1) {
|
|
741
|
+
var _this$removeMessageFr3 = this.removeMessageFromArray(this.messageSets[messageSetIndex].messages, messageToRemove),
|
|
742
|
+
_removed = _this$removeMessageFr3.removed,
|
|
743
|
+
messages = _this$removeMessageFr3.result;
|
|
744
|
+
|
|
745
|
+
this.messageSets[messageSetIndex].messages = messages;
|
|
746
|
+
isRemoved = _removed;
|
|
747
|
+
}
|
|
672
748
|
}
|
|
673
749
|
|
|
674
750
|
return isRemoved;
|
|
@@ -681,10 +757,10 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
681
757
|
*
|
|
682
758
|
*/
|
|
683
759
|
function filterErrorMessages() {
|
|
684
|
-
var filteredMessages = this.
|
|
760
|
+
var filteredMessages = this.latestMessages.filter(function (message) {
|
|
685
761
|
return message.type !== 'error';
|
|
686
762
|
});
|
|
687
|
-
this.
|
|
763
|
+
this.latestMessages = filteredMessages;
|
|
688
764
|
}
|
|
689
765
|
/**
|
|
690
766
|
* clean - Remove stale data such as users that stayed in typing state for more than 5 seconds
|
|
@@ -718,9 +794,250 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
718
794
|
}, {
|
|
719
795
|
key: "clearMessages",
|
|
720
796
|
value: function clearMessages() {
|
|
721
|
-
this.
|
|
797
|
+
this.initMessages();
|
|
722
798
|
this.pinnedMessages = [];
|
|
723
799
|
}
|
|
800
|
+
}, {
|
|
801
|
+
key: "initMessages",
|
|
802
|
+
value: function initMessages() {
|
|
803
|
+
this.messageSets = [{
|
|
804
|
+
messages: [],
|
|
805
|
+
isLatest: true,
|
|
806
|
+
isCurrent: true
|
|
807
|
+
}];
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* loadMessageIntoState - Loads a given message (and messages around it) into the state
|
|
811
|
+
*
|
|
812
|
+
* @param {string} messageId The id of the message, or 'latest' to indicate switching to the latest messages
|
|
813
|
+
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply
|
|
814
|
+
*/
|
|
815
|
+
|
|
816
|
+
}, {
|
|
817
|
+
key: "loadMessageIntoState",
|
|
818
|
+
value: function () {
|
|
819
|
+
var _loadMessageIntoState = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(messageId, parentMessageId) {
|
|
820
|
+
var _this$threads$parentM;
|
|
821
|
+
|
|
822
|
+
var messageSetIndex, switchedToMessageSet, loadedMessageThread, messageIdToFind;
|
|
823
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
824
|
+
while (1) {
|
|
825
|
+
switch (_context.prev = _context.next) {
|
|
826
|
+
case 0:
|
|
827
|
+
switchedToMessageSet = false;
|
|
828
|
+
loadedMessageThread = false;
|
|
829
|
+
messageIdToFind = parentMessageId || messageId;
|
|
830
|
+
|
|
831
|
+
if (!(messageId === 'latest')) {
|
|
832
|
+
_context.next = 9;
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (!(this.messages === this.latestMessages)) {
|
|
837
|
+
_context.next = 6;
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return _context.abrupt("return");
|
|
842
|
+
|
|
843
|
+
case 6:
|
|
844
|
+
messageSetIndex = this.messageSets.findIndex(function (s) {
|
|
845
|
+
return s.isLatest;
|
|
846
|
+
});
|
|
847
|
+
_context.next = 10;
|
|
848
|
+
break;
|
|
849
|
+
|
|
850
|
+
case 9:
|
|
851
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
852
|
+
id: messageIdToFind
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
case 10:
|
|
856
|
+
if (messageSetIndex !== -1) {
|
|
857
|
+
this.switchToMessageSet(messageSetIndex);
|
|
858
|
+
switchedToMessageSet = true;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
loadedMessageThread = !parentMessageId || !!((_this$threads$parentM = this.threads[parentMessageId]) !== null && _this$threads$parentM !== void 0 && _this$threads$parentM.find(function (m) {
|
|
862
|
+
return m.id === messageId;
|
|
863
|
+
}));
|
|
864
|
+
|
|
865
|
+
if (!(switchedToMessageSet && loadedMessageThread)) {
|
|
866
|
+
_context.next = 14;
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
return _context.abrupt("return");
|
|
871
|
+
|
|
872
|
+
case 14:
|
|
873
|
+
if (switchedToMessageSet) {
|
|
874
|
+
_context.next = 17;
|
|
875
|
+
break;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
_context.next = 17;
|
|
879
|
+
return this._channel.query({
|
|
880
|
+
messages: {
|
|
881
|
+
id_around: messageIdToFind,
|
|
882
|
+
limit: 25
|
|
883
|
+
}
|
|
884
|
+
}, 'new');
|
|
885
|
+
|
|
886
|
+
case 17:
|
|
887
|
+
if (!(!loadedMessageThread && parentMessageId)) {
|
|
888
|
+
_context.next = 20;
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
_context.next = 20;
|
|
893
|
+
return this._channel.getReplies(parentMessageId, {
|
|
894
|
+
id_around: messageId,
|
|
895
|
+
limit: 25
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
case 20:
|
|
899
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
900
|
+
id: messageIdToFind
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
if (messageSetIndex !== -1) {
|
|
904
|
+
this.switchToMessageSet(messageSetIndex);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
case 22:
|
|
908
|
+
case "end":
|
|
909
|
+
return _context.stop();
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}, _callee, this);
|
|
913
|
+
}));
|
|
914
|
+
|
|
915
|
+
function loadMessageIntoState(_x, _x2) {
|
|
916
|
+
return _loadMessageIntoState.apply(this, arguments);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
return loadMessageIntoState;
|
|
920
|
+
}()
|
|
921
|
+
}, {
|
|
922
|
+
key: "switchToMessageSet",
|
|
923
|
+
value: function switchToMessageSet(index) {
|
|
924
|
+
var currentMessages = this.messageSets.find(function (s) {
|
|
925
|
+
return s.isCurrent;
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
if (!currentMessages) {
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
currentMessages.isCurrent = false;
|
|
933
|
+
this.messageSets[index].isCurrent = true;
|
|
934
|
+
}
|
|
935
|
+
}, {
|
|
936
|
+
key: "areMessageSetsOverlap",
|
|
937
|
+
value: function areMessageSetsOverlap(messages1, messages2) {
|
|
938
|
+
return messages1.some(function (m1) {
|
|
939
|
+
return messages2.find(function (m2) {
|
|
940
|
+
return m1.id === m2.id;
|
|
941
|
+
});
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}, {
|
|
945
|
+
key: "findMessageSetIndex",
|
|
946
|
+
value: function findMessageSetIndex(message) {
|
|
947
|
+
return this.messageSets.findIndex(function (set) {
|
|
948
|
+
return !!set.messages.find(function (m) {
|
|
949
|
+
return m.id === message.id;
|
|
950
|
+
});
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
}, {
|
|
954
|
+
key: "findTargetMessageSet",
|
|
955
|
+
value: function findTargetMessageSet(newMessages) {
|
|
956
|
+
var _this5 = this;
|
|
957
|
+
|
|
958
|
+
var addIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
959
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'current';
|
|
960
|
+
var messagesToAdd = newMessages;
|
|
961
|
+
var targetMessageSetIndex;
|
|
962
|
+
|
|
963
|
+
if (addIfDoesNotExist) {
|
|
964
|
+
var overlappingMessageSetIndices = this.messageSets.map(function (_, i) {
|
|
965
|
+
return i;
|
|
966
|
+
}).filter(function (i) {
|
|
967
|
+
return _this5.areMessageSetsOverlap(_this5.messageSets[i].messages, newMessages);
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
switch (messageSetToAddToIfDoesNotExist) {
|
|
971
|
+
case 'new':
|
|
972
|
+
if (overlappingMessageSetIndices.length > 0) {
|
|
973
|
+
targetMessageSetIndex = overlappingMessageSetIndices[0]; // No new message set is created if newMessages only contains thread replies
|
|
974
|
+
} else if (newMessages.some(function (m) {
|
|
975
|
+
return !m.parent_id;
|
|
976
|
+
})) {
|
|
977
|
+
this.messageSets.push({
|
|
978
|
+
messages: [],
|
|
979
|
+
isCurrent: false,
|
|
980
|
+
isLatest: false
|
|
981
|
+
});
|
|
982
|
+
targetMessageSetIndex = this.messageSets.length - 1;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
break;
|
|
986
|
+
|
|
987
|
+
case 'current':
|
|
988
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
989
|
+
return s.isCurrent;
|
|
990
|
+
});
|
|
991
|
+
break;
|
|
992
|
+
|
|
993
|
+
case 'latest':
|
|
994
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
995
|
+
return s.isLatest;
|
|
996
|
+
});
|
|
997
|
+
break;
|
|
998
|
+
|
|
999
|
+
default:
|
|
1000
|
+
targetMessageSetIndex = -1;
|
|
1001
|
+
} // when merging the target set will be the first one from the overlapping message sets
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1005
|
+
|
|
1006
|
+
var mergeSourceMessageSetIndices = _toConsumableArray__default['default'](overlappingMessageSetIndices);
|
|
1007
|
+
|
|
1008
|
+
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1009
|
+
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1010
|
+
} // merge message sets
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1014
|
+
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1015
|
+
var sources = this.messageSets.filter(function (_, i) {
|
|
1016
|
+
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1017
|
+
});
|
|
1018
|
+
sources.forEach(function (messageSet) {
|
|
1019
|
+
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1020
|
+
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1021
|
+
messagesToAdd = [].concat(_toConsumableArray__default['default'](messagesToAdd), _toConsumableArray__default['default'](messageSet.messages));
|
|
1022
|
+
});
|
|
1023
|
+
sources.forEach(function (s) {
|
|
1024
|
+
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1025
|
+
});
|
|
1026
|
+
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1027
|
+
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1028
|
+
});
|
|
1029
|
+
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1030
|
+
}
|
|
1031
|
+
} else {
|
|
1032
|
+
// assumes that all new messages belong to the same set
|
|
1033
|
+
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
return {
|
|
1037
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1038
|
+
messagesToAdd: messagesToAdd
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
724
1041
|
}]);
|
|
725
1042
|
|
|
726
1043
|
return ChannelState;
|
|
@@ -1083,7 +1400,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1083
1400
|
presence: false
|
|
1084
1401
|
};
|
|
1085
1402
|
_context.next = 3;
|
|
1086
|
-
return _this.query(options);
|
|
1403
|
+
return _this.query(options, 'latest');
|
|
1087
1404
|
|
|
1088
1405
|
case 3:
|
|
1089
1406
|
return _context.abrupt("return", _context.sent);
|
|
@@ -2381,14 +2698,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2381
2698
|
value: function lastMessage() {
|
|
2382
2699
|
// get last 5 messages, sort, return the latest
|
|
2383
2700
|
// get a slice of the last 5
|
|
2384
|
-
var min = this.state.
|
|
2701
|
+
var min = this.state.latestMessages.length - 5;
|
|
2385
2702
|
|
|
2386
2703
|
if (min < 0) {
|
|
2387
2704
|
min = 0;
|
|
2388
2705
|
}
|
|
2389
2706
|
|
|
2390
|
-
var max = this.state.
|
|
2391
|
-
var messageSlice = this.state.
|
|
2707
|
+
var max = this.state.latestMessages.length + 1;
|
|
2708
|
+
var messageSlice = this.state.latestMessages.slice(min, max); // sort by pk desc
|
|
2392
2709
|
|
|
2393
2710
|
messageSlice.sort(function (a, b) {
|
|
2394
2711
|
return b.created_at.getTime() - a.created_at.getTime();
|
|
@@ -2497,7 +2814,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2497
2814
|
|
|
2498
2815
|
combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
|
|
2499
2816
|
_context27.next = 7;
|
|
2500
|
-
return this.query(combined);
|
|
2817
|
+
return this.query(combined, 'latest');
|
|
2501
2818
|
|
|
2502
2819
|
case 7:
|
|
2503
2820
|
state = _context27.sent;
|
|
@@ -2571,7 +2888,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2571
2888
|
* getReplies - List the message replies for a parent message
|
|
2572
2889
|
*
|
|
2573
2890
|
* @param {string} parent_id The message parent id, ie the top of the thread
|
|
2574
|
-
* @param {
|
|
2891
|
+
* @param {MessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2575
2892
|
*
|
|
2576
2893
|
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2577
2894
|
*/
|
|
@@ -2732,8 +3049,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2732
3049
|
if (!lastRead) return this.state.unreadCount;
|
|
2733
3050
|
var count = 0;
|
|
2734
3051
|
|
|
2735
|
-
for (var i = 0; i < this.state.
|
|
2736
|
-
var message = this.state.
|
|
3052
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
3053
|
+
var message = this.state.latestMessages[i];
|
|
2737
3054
|
|
|
2738
3055
|
if (message.created_at > lastRead && this._countMessageAsUnread(message)) {
|
|
2739
3056
|
count++;
|
|
@@ -2743,7 +3060,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2743
3060
|
return count;
|
|
2744
3061
|
}
|
|
2745
3062
|
/**
|
|
2746
|
-
*
|
|
3063
|
+
* countUnreadMentions - Count the number of unread messages mentioning the current user
|
|
2747
3064
|
*
|
|
2748
3065
|
* @return {number} Unread mentions count
|
|
2749
3066
|
*/
|
|
@@ -2755,10 +3072,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2755
3072
|
var userID = this.getClient().userID;
|
|
2756
3073
|
var count = 0;
|
|
2757
3074
|
|
|
2758
|
-
for (var i = 0; i < this.state.
|
|
3075
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
2759
3076
|
var _message$mentioned_us;
|
|
2760
3077
|
|
|
2761
|
-
var message = this.state.
|
|
3078
|
+
var message = this.state.latestMessages[i];
|
|
2762
3079
|
|
|
2763
3080
|
if (this._countMessageAsUnread(message) && (!lastRead || message.created_at > lastRead) && (_message$mentioned_us = message.mentioned_users) !== null && _message$mentioned_us !== void 0 && _message$mentioned_us.some(function (user) {
|
|
2764
3081
|
return user.id === userID;
|
|
@@ -2782,33 +3099,40 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2782
3099
|
* query - Query the API, get messages, members or other channel fields
|
|
2783
3100
|
*
|
|
2784
3101
|
* @param {ChannelQueryOptions<StreamChatGenerics>} options The query options
|
|
3102
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist It's possible to load disjunct sets of a channel's messages into state, use `current` to load the initial channel state or if you want to extend the currently displayed messages, use `latest` if you want to load/extend the latest messages, `new` is used for loading a specific message and it's surroundings
|
|
2785
3103
|
*
|
|
2786
3104
|
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} Returns a query response
|
|
2787
3105
|
*/
|
|
2788
3106
|
function () {
|
|
2789
3107
|
var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee31(options) {
|
|
2790
|
-
var
|
|
3108
|
+
var messageSetToAddToIfDoesNotExist,
|
|
3109
|
+
queryURL,
|
|
3110
|
+
state,
|
|
3111
|
+
membersStr,
|
|
3112
|
+
tempChannelCid,
|
|
3113
|
+
_args31 = arguments;
|
|
2791
3114
|
return _regeneratorRuntime__default['default'].wrap(function _callee31$(_context31) {
|
|
2792
3115
|
while (1) {
|
|
2793
3116
|
switch (_context31.prev = _context31.next) {
|
|
2794
3117
|
case 0:
|
|
2795
|
-
|
|
3118
|
+
messageSetToAddToIfDoesNotExist = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : 'current';
|
|
3119
|
+
_context31.next = 3;
|
|
2796
3120
|
return this.getClient().wsPromise;
|
|
2797
3121
|
|
|
2798
|
-
case
|
|
3122
|
+
case 3:
|
|
2799
3123
|
queryURL = "".concat(this.getClient().baseURL, "/channels/").concat(this.type);
|
|
2800
3124
|
|
|
2801
3125
|
if (this.id) {
|
|
2802
3126
|
queryURL += "/".concat(this.id);
|
|
2803
3127
|
}
|
|
2804
3128
|
|
|
2805
|
-
_context31.next =
|
|
3129
|
+
_context31.next = 7;
|
|
2806
3130
|
return this.getClient().post(queryURL + '/query', _objectSpread$5({
|
|
2807
3131
|
data: this._data,
|
|
2808
3132
|
state: true
|
|
2809
3133
|
}, options));
|
|
2810
3134
|
|
|
2811
|
-
case
|
|
3135
|
+
case 7:
|
|
2812
3136
|
state = _context31.sent;
|
|
2813
3137
|
|
|
2814
3138
|
// update the channel id if it was missing
|
|
@@ -2837,11 +3161,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2837
3161
|
this.getClient()._addChannelConfig(state); // add any messages to our channel state
|
|
2838
3162
|
|
|
2839
3163
|
|
|
2840
|
-
this._initializeState(state);
|
|
3164
|
+
this._initializeState(state, messageSetToAddToIfDoesNotExist);
|
|
2841
3165
|
|
|
2842
3166
|
return _context31.abrupt("return", state);
|
|
2843
3167
|
|
|
2844
|
-
case
|
|
3168
|
+
case 12:
|
|
2845
3169
|
case "end":
|
|
2846
3170
|
return _context31.stop();
|
|
2847
3171
|
}
|
|
@@ -3391,6 +3715,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3391
3715
|
}, {
|
|
3392
3716
|
key: "_initializeState",
|
|
3393
3717
|
value: function _initializeState(state) {
|
|
3718
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'latest';
|
|
3719
|
+
|
|
3394
3720
|
var _this$getClient2 = this.getClient(),
|
|
3395
3721
|
clientState = _this$getClient2.state,
|
|
3396
3722
|
user = _this$getClient2.user,
|
|
@@ -3420,10 +3746,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3420
3746
|
var messages = state.messages || [];
|
|
3421
3747
|
|
|
3422
3748
|
if (!this.state.messages) {
|
|
3423
|
-
this.state.
|
|
3749
|
+
this.state.initMessages();
|
|
3424
3750
|
}
|
|
3425
3751
|
|
|
3426
|
-
this.state.addMessagesSorted(messages, false, true);
|
|
3752
|
+
this.state.addMessagesSorted(messages, false, true, true, messageSetToAddToIfDoesNotExist);
|
|
3427
3753
|
|
|
3428
3754
|
if (!this.state.pinnedMessages) {
|
|
3429
3755
|
this.state.pinnedMessages = [];
|
|
@@ -4843,7 +5169,7 @@ function TokenManager(secret) {
|
|
|
4843
5169
|
_defineProperty__default['default'](this, "loadToken", function () {
|
|
4844
5170
|
// eslint-disable-next-line no-async-promise-executor
|
|
4845
5171
|
_this.loadTokenPromise = new Promise( /*#__PURE__*/function () {
|
|
4846
|
-
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(resolve) {
|
|
5172
|
+
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(resolve, reject) {
|
|
4847
5173
|
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
4848
5174
|
while (1) {
|
|
4849
5175
|
switch (_context2.prev = _context2.next) {
|
|
@@ -4857,26 +5183,36 @@ function TokenManager(secret) {
|
|
|
4857
5183
|
|
|
4858
5184
|
case 2:
|
|
4859
5185
|
if (!(_this.tokenProvider && typeof _this.tokenProvider !== 'string')) {
|
|
4860
|
-
_context2.next =
|
|
5186
|
+
_context2.next = 13;
|
|
4861
5187
|
break;
|
|
4862
5188
|
}
|
|
4863
5189
|
|
|
4864
|
-
_context2.
|
|
5190
|
+
_context2.prev = 3;
|
|
5191
|
+
_context2.next = 6;
|
|
4865
5192
|
return _this.tokenProvider();
|
|
4866
5193
|
|
|
4867
|
-
case
|
|
5194
|
+
case 6:
|
|
4868
5195
|
_this.token = _context2.sent;
|
|
5196
|
+
_context2.next = 12;
|
|
5197
|
+
break;
|
|
5198
|
+
|
|
5199
|
+
case 9:
|
|
5200
|
+
_context2.prev = 9;
|
|
5201
|
+
_context2.t0 = _context2["catch"](3);
|
|
5202
|
+
return _context2.abrupt("return", reject(new Error("Call to tokenProvider failed with message: ".concat(_context2.t0))));
|
|
5203
|
+
|
|
5204
|
+
case 12:
|
|
4869
5205
|
resolve(_this.token);
|
|
4870
5206
|
|
|
4871
|
-
case
|
|
5207
|
+
case 13:
|
|
4872
5208
|
case "end":
|
|
4873
5209
|
return _context2.stop();
|
|
4874
5210
|
}
|
|
4875
5211
|
}
|
|
4876
|
-
}, _callee2);
|
|
5212
|
+
}, _callee2, null, [[3, 9]]);
|
|
4877
5213
|
}));
|
|
4878
5214
|
|
|
4879
|
-
return function (_x3) {
|
|
5215
|
+
return function (_x3, _x4) {
|
|
4880
5216
|
return _ref2.apply(this, arguments);
|
|
4881
5217
|
};
|
|
4882
5218
|
}());
|
|
@@ -6386,30 +6722,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6386
6722
|
key: "updateAppSettings",
|
|
6387
6723
|
value:
|
|
6388
6724
|
/**
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6725
|
+
* updateAppSettings - updates application settings
|
|
6726
|
+
*
|
|
6727
|
+
* @param {AppSettings} options App settings.
|
|
6728
|
+
* IE: {
|
|
6729
|
+
'apn_config': {
|
|
6730
|
+
'auth_type': 'token',
|
|
6731
|
+
'auth_key": fs.readFileSync(
|
|
6732
|
+
'./apn-push-auth-key.p8',
|
|
6733
|
+
'utf-8',
|
|
6734
|
+
),
|
|
6735
|
+
'key_id': 'keyid',
|
|
6736
|
+
'team_id': 'teamid',
|
|
6737
|
+
'notification_template": 'notification handlebars template',
|
|
6738
|
+
'bundle_id': 'com.apple.your.app',
|
|
6739
|
+
'development': true
|
|
6740
|
+
},
|
|
6741
|
+
'firebase_config': {
|
|
6742
|
+
'server_key': 'server key from fcm',
|
|
6743
|
+
'notification_template': 'notification handlebars template',
|
|
6744
|
+
'data_template': 'data handlebars template',
|
|
6745
|
+
'apn_template': 'apn notification handlebars template under v2'
|
|
6746
|
+
},
|
|
6747
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
6748
|
+
}
|
|
6749
|
+
*/
|
|
6413
6750
|
function () {
|
|
6414
6751
|
var _updateAppSettings = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7(options) {
|
|
6415
6752
|
var _options$apn_config;
|
|
@@ -6600,17 +6937,19 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6600
6937
|
return getAppSettings;
|
|
6601
6938
|
}()
|
|
6602
6939
|
/**
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6940
|
+
* testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
|
|
6941
|
+
*
|
|
6942
|
+
* @param {string} userID User ID. If user has no devices, it will error
|
|
6943
|
+
* @param {TestPushDataInput} [data] Overrides for push templates/message used
|
|
6944
|
+
* IE: {
|
|
6945
|
+
messageID: 'id-of-message', // will error if message does not exist
|
|
6946
|
+
apnTemplate: '{}', // if app doesn't have apn configured it will error
|
|
6947
|
+
firebaseTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6948
|
+
firebaseDataTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6949
|
+
skipDevices: true, // skip config/device checks and sending to real devices
|
|
6950
|
+
pushProviderName: 'staging' // one of your configured push providers
|
|
6951
|
+
pushProviderType: 'apn' // one of supported provider types
|
|
6952
|
+
}
|
|
6614
6953
|
*/
|
|
6615
6954
|
|
|
6616
6955
|
}, {
|
|
@@ -6625,7 +6964,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6625
6964
|
case 0:
|
|
6626
6965
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
6627
6966
|
_context12.next = 3;
|
|
6628
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6967
|
+
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6629
6968
|
user_id: userID
|
|
6630
6969
|
}, data.messageID ? {
|
|
6631
6970
|
message_id: data.messageID
|
|
@@ -6637,6 +6976,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6637
6976
|
firebase_data_template: data.firebaseDataTemplate
|
|
6638
6977
|
} : {}), data.skipDevices ? {
|
|
6639
6978
|
skip_devices: true
|
|
6979
|
+
} : {}), data.pushProviderName ? {
|
|
6980
|
+
push_provider_name: data.pushProviderName
|
|
6981
|
+
} : {}), data.pushProviderType ? {
|
|
6982
|
+
push_provider_type: data.pushProviderType
|
|
6640
6983
|
} : {}));
|
|
6641
6984
|
|
|
6642
6985
|
case 3:
|
|
@@ -6660,11 +7003,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6660
7003
|
* testSQSSettings - Tests that the given or configured SQS configuration is valid
|
|
6661
7004
|
*
|
|
6662
7005
|
* @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
|
|
6663
|
-
*
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
7006
|
+
* IE: {
|
|
7007
|
+
sqs_key: 'auth_key',
|
|
7008
|
+
sqs_secret: 'auth_secret',
|
|
7009
|
+
sqs_url: 'url_to_queue',
|
|
7010
|
+
}
|
|
6668
7011
|
*/
|
|
6669
7012
|
|
|
6670
7013
|
}, {
|
|
@@ -7019,7 +7362,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7019
7362
|
this.mutedUsers = event.me.mutes;
|
|
7020
7363
|
}
|
|
7021
7364
|
|
|
7022
|
-
if (event.type === 'notification.mark_read') {
|
|
7365
|
+
if (event.type === 'notification.mark_read' && event.unread_channels === 0) {
|
|
7023
7366
|
var activeChannelKeys = Object.keys(this.activeChannels);
|
|
7024
7367
|
activeChannelKeys.forEach(function (activeChannelKey) {
|
|
7025
7368
|
return _this3.activeChannels[activeChannelKey].state.unreadCount = 0;
|
|
@@ -7461,11 +7804,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7461
7804
|
c.initialized = true;
|
|
7462
7805
|
|
|
7463
7806
|
if (skipInitialization === undefined) {
|
|
7464
|
-
c._initializeState(_channelState);
|
|
7807
|
+
c._initializeState(_channelState, 'latest');
|
|
7465
7808
|
} else if (!skipInitialization.includes(_channelState.channel.id)) {
|
|
7466
7809
|
c.state.clearMessages();
|
|
7467
7810
|
|
|
7468
|
-
c._initializeState(_channelState);
|
|
7811
|
+
c._initializeState(_channelState, 'latest');
|
|
7469
7812
|
}
|
|
7470
7813
|
|
|
7471
7814
|
channels.push(c);
|
|
@@ -7602,23 +7945,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7602
7945
|
* @param {string} id the device id
|
|
7603
7946
|
* @param {PushProvider} push_provider the push provider
|
|
7604
7947
|
* @param {string} [userID] the user id (defaults to current user)
|
|
7948
|
+
* @param {string} [push_provider_name] user provided push provider name for multi bundle support
|
|
7605
7949
|
*
|
|
7606
7950
|
*/
|
|
7607
7951
|
|
|
7608
7952
|
}, {
|
|
7609
7953
|
key: "addDevice",
|
|
7610
7954
|
value: function () {
|
|
7611
|
-
var _addDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee21(id, push_provider, userID) {
|
|
7955
|
+
var _addDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee21(id, push_provider, userID, push_provider_name) {
|
|
7612
7956
|
return _regeneratorRuntime__default['default'].wrap(function _callee21$(_context21) {
|
|
7613
7957
|
while (1) {
|
|
7614
7958
|
switch (_context21.prev = _context21.next) {
|
|
7615
7959
|
case 0:
|
|
7616
7960
|
_context21.next = 2;
|
|
7617
|
-
return this.post(this.baseURL + '/devices', _objectSpread({
|
|
7961
|
+
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
7618
7962
|
id: id,
|
|
7619
7963
|
push_provider: push_provider
|
|
7620
7964
|
}, userID != null ? {
|
|
7621
7965
|
user_id: userID
|
|
7966
|
+
} : {}), push_provider_name != null ? {
|
|
7967
|
+
push_provider_name: push_provider_name
|
|
7622
7968
|
} : {}));
|
|
7623
7969
|
|
|
7624
7970
|
case 2:
|
|
@@ -7632,7 +7978,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7632
7978
|
}, _callee21, this);
|
|
7633
7979
|
}));
|
|
7634
7980
|
|
|
7635
|
-
function addDevice(_x20, _x21, _x22) {
|
|
7981
|
+
function addDevice(_x20, _x21, _x22, _x23) {
|
|
7636
7982
|
return _addDevice.apply(this, arguments);
|
|
7637
7983
|
}
|
|
7638
7984
|
|
|
@@ -7670,7 +8016,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7670
8016
|
}, _callee22, this);
|
|
7671
8017
|
}));
|
|
7672
8018
|
|
|
7673
|
-
function getDevices(
|
|
8019
|
+
function getDevices(_x24) {
|
|
7674
8020
|
return _getDevices.apply(this, arguments);
|
|
7675
8021
|
}
|
|
7676
8022
|
|
|
@@ -7710,7 +8056,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7710
8056
|
}, _callee23, this);
|
|
7711
8057
|
}));
|
|
7712
8058
|
|
|
7713
|
-
function removeDevice(
|
|
8059
|
+
function removeDevice(_x25, _x26) {
|
|
7714
8060
|
return _removeDevice.apply(this, arguments);
|
|
7715
8061
|
}
|
|
7716
8062
|
|
|
@@ -7751,7 +8097,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7751
8097
|
}, _callee24, this);
|
|
7752
8098
|
}));
|
|
7753
8099
|
|
|
7754
|
-
function getRateLimits(
|
|
8100
|
+
function getRateLimits(_x27) {
|
|
7755
8101
|
return _getRateLimits.apply(this, arguments);
|
|
7756
8102
|
}
|
|
7757
8103
|
|
|
@@ -7852,7 +8198,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7852
8198
|
}, _callee25, this);
|
|
7853
8199
|
}));
|
|
7854
8200
|
|
|
7855
|
-
function partialUpdateUser(
|
|
8201
|
+
function partialUpdateUser(_x28) {
|
|
7856
8202
|
return _partialUpdateUser.apply(this, arguments);
|
|
7857
8203
|
}
|
|
7858
8204
|
|
|
@@ -7938,7 +8284,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7938
8284
|
}, _callee26, this, [[2, 13, 16, 19]]);
|
|
7939
8285
|
}));
|
|
7940
8286
|
|
|
7941
|
-
function upsertUsers(
|
|
8287
|
+
function upsertUsers(_x29) {
|
|
7942
8288
|
return _upsertUsers.apply(this, arguments);
|
|
7943
8289
|
}
|
|
7944
8290
|
|
|
@@ -8051,7 +8397,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8051
8397
|
}, _callee27, this, [[1, 11, 14, 17]]);
|
|
8052
8398
|
}));
|
|
8053
8399
|
|
|
8054
|
-
function partialUpdateUsers(
|
|
8400
|
+
function partialUpdateUsers(_x30) {
|
|
8055
8401
|
return _partialUpdateUsers.apply(this, arguments);
|
|
8056
8402
|
}
|
|
8057
8403
|
|
|
@@ -8079,7 +8425,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8079
8425
|
}, _callee28, this);
|
|
8080
8426
|
}));
|
|
8081
8427
|
|
|
8082
|
-
function deleteUser(
|
|
8428
|
+
function deleteUser(_x31, _x32) {
|
|
8083
8429
|
return _deleteUser.apply(this, arguments);
|
|
8084
8430
|
}
|
|
8085
8431
|
|
|
@@ -8107,7 +8453,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8107
8453
|
}, _callee29, this);
|
|
8108
8454
|
}));
|
|
8109
8455
|
|
|
8110
|
-
function reactivateUser(
|
|
8456
|
+
function reactivateUser(_x33, _x34) {
|
|
8111
8457
|
return _reactivateUser.apply(this, arguments);
|
|
8112
8458
|
}
|
|
8113
8459
|
|
|
@@ -8135,7 +8481,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8135
8481
|
}, _callee30, this);
|
|
8136
8482
|
}));
|
|
8137
8483
|
|
|
8138
|
-
function deactivateUser(
|
|
8484
|
+
function deactivateUser(_x35, _x36) {
|
|
8139
8485
|
return _deactivateUser.apply(this, arguments);
|
|
8140
8486
|
}
|
|
8141
8487
|
|
|
@@ -8163,7 +8509,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8163
8509
|
}, _callee31, this);
|
|
8164
8510
|
}));
|
|
8165
8511
|
|
|
8166
|
-
function exportUser(
|
|
8512
|
+
function exportUser(_x37, _x38) {
|
|
8167
8513
|
return _exportUser.apply(this, arguments);
|
|
8168
8514
|
}
|
|
8169
8515
|
|
|
@@ -8200,7 +8546,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8200
8546
|
}, _callee32, this);
|
|
8201
8547
|
}));
|
|
8202
8548
|
|
|
8203
|
-
function banUser(
|
|
8549
|
+
function banUser(_x39, _x40) {
|
|
8204
8550
|
return _banUser.apply(this, arguments);
|
|
8205
8551
|
}
|
|
8206
8552
|
|
|
@@ -8237,7 +8583,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8237
8583
|
}, _callee33, this);
|
|
8238
8584
|
}));
|
|
8239
8585
|
|
|
8240
|
-
function unbanUser(
|
|
8586
|
+
function unbanUser(_x41, _x42) {
|
|
8241
8587
|
return _unbanUser.apply(this, arguments);
|
|
8242
8588
|
}
|
|
8243
8589
|
|
|
@@ -8274,7 +8620,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8274
8620
|
}, _callee34, this);
|
|
8275
8621
|
}));
|
|
8276
8622
|
|
|
8277
|
-
function shadowBan(
|
|
8623
|
+
function shadowBan(_x43, _x44) {
|
|
8278
8624
|
return _shadowBan.apply(this, arguments);
|
|
8279
8625
|
}
|
|
8280
8626
|
|
|
@@ -8311,7 +8657,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8311
8657
|
}, _callee35, this);
|
|
8312
8658
|
}));
|
|
8313
8659
|
|
|
8314
|
-
function removeShadowBan(
|
|
8660
|
+
function removeShadowBan(_x45, _x46) {
|
|
8315
8661
|
return _removeShadowBan.apply(this, arguments);
|
|
8316
8662
|
}
|
|
8317
8663
|
|
|
@@ -8354,7 +8700,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8354
8700
|
}, _callee36, this);
|
|
8355
8701
|
}));
|
|
8356
8702
|
|
|
8357
|
-
function muteUser(
|
|
8703
|
+
function muteUser(_x47, _x48) {
|
|
8358
8704
|
return _muteUser.apply(this, arguments);
|
|
8359
8705
|
}
|
|
8360
8706
|
|
|
@@ -8393,7 +8739,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8393
8739
|
}, _callee37, this);
|
|
8394
8740
|
}));
|
|
8395
8741
|
|
|
8396
|
-
function unmuteUser(
|
|
8742
|
+
function unmuteUser(_x49, _x50) {
|
|
8397
8743
|
return _unmuteUser.apply(this, arguments);
|
|
8398
8744
|
}
|
|
8399
8745
|
|
|
@@ -8452,7 +8798,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8452
8798
|
}, _callee38, this);
|
|
8453
8799
|
}));
|
|
8454
8800
|
|
|
8455
|
-
function flagMessage(
|
|
8801
|
+
function flagMessage(_x51) {
|
|
8456
8802
|
return _flagMessage.apply(this, arguments);
|
|
8457
8803
|
}
|
|
8458
8804
|
|
|
@@ -8492,7 +8838,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8492
8838
|
}, _callee39, this);
|
|
8493
8839
|
}));
|
|
8494
8840
|
|
|
8495
|
-
function flagUser(
|
|
8841
|
+
function flagUser(_x52) {
|
|
8496
8842
|
return _flagUser.apply(this, arguments);
|
|
8497
8843
|
}
|
|
8498
8844
|
|
|
@@ -8532,7 +8878,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8532
8878
|
}, _callee40, this);
|
|
8533
8879
|
}));
|
|
8534
8880
|
|
|
8535
|
-
function unflagMessage(
|
|
8881
|
+
function unflagMessage(_x53) {
|
|
8536
8882
|
return _unflagMessage.apply(this, arguments);
|
|
8537
8883
|
}
|
|
8538
8884
|
|
|
@@ -8572,7 +8918,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8572
8918
|
}, _callee41, this);
|
|
8573
8919
|
}));
|
|
8574
8920
|
|
|
8575
|
-
function unflagUser(
|
|
8921
|
+
function unflagUser(_x54) {
|
|
8576
8922
|
return _unflagUser.apply(this, arguments);
|
|
8577
8923
|
}
|
|
8578
8924
|
|
|
@@ -8718,7 +9064,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8718
9064
|
}, _callee44, this);
|
|
8719
9065
|
}));
|
|
8720
9066
|
|
|
8721
|
-
function _reviewFlagReport(
|
|
9067
|
+
function _reviewFlagReport(_x55, _x56) {
|
|
8722
9068
|
return _reviewFlagReport2.apply(this, arguments);
|
|
8723
9069
|
}
|
|
8724
9070
|
|
|
@@ -8764,7 +9110,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8764
9110
|
}, _callee45, this);
|
|
8765
9111
|
}));
|
|
8766
9112
|
|
|
8767
|
-
function _unblockMessage(
|
|
9113
|
+
function _unblockMessage(_x57) {
|
|
8768
9114
|
return _unblockMessage2.apply(this, arguments);
|
|
8769
9115
|
}
|
|
8770
9116
|
|
|
@@ -8903,7 +9249,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8903
9249
|
}, _callee47, this);
|
|
8904
9250
|
}));
|
|
8905
9251
|
|
|
8906
|
-
function translateMessage(
|
|
9252
|
+
function translateMessage(_x58, _x59) {
|
|
8907
9253
|
return _translateMessage.apply(this, arguments);
|
|
8908
9254
|
}
|
|
8909
9255
|
|
|
@@ -9065,7 +9411,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9065
9411
|
}, _callee48, this);
|
|
9066
9412
|
}));
|
|
9067
9413
|
|
|
9068
|
-
function updateMessage(
|
|
9414
|
+
function updateMessage(_x60, _x61, _x62) {
|
|
9069
9415
|
return _updateMessage.apply(this, arguments);
|
|
9070
9416
|
}
|
|
9071
9417
|
|
|
@@ -9126,7 +9472,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9126
9472
|
}, _callee49, this);
|
|
9127
9473
|
}));
|
|
9128
9474
|
|
|
9129
|
-
function partialUpdateMessage(
|
|
9475
|
+
function partialUpdateMessage(_x63, _x64, _x65, _x66) {
|
|
9130
9476
|
return _partialUpdateMessage.apply(this, arguments);
|
|
9131
9477
|
}
|
|
9132
9478
|
|
|
@@ -9163,7 +9509,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9163
9509
|
}, _callee50, this);
|
|
9164
9510
|
}));
|
|
9165
9511
|
|
|
9166
|
-
function deleteMessage(
|
|
9512
|
+
function deleteMessage(_x67, _x68) {
|
|
9167
9513
|
return _deleteMessage.apply(this, arguments);
|
|
9168
9514
|
}
|
|
9169
9515
|
|
|
@@ -9191,7 +9537,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9191
9537
|
}, _callee51, this);
|
|
9192
9538
|
}));
|
|
9193
9539
|
|
|
9194
|
-
function getMessage(
|
|
9540
|
+
function getMessage(_x69) {
|
|
9195
9541
|
return _getMessage.apply(this, arguments);
|
|
9196
9542
|
}
|
|
9197
9543
|
|
|
@@ -9200,7 +9546,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9200
9546
|
}, {
|
|
9201
9547
|
key: "getUserAgent",
|
|
9202
9548
|
value: function getUserAgent() {
|
|
9203
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.
|
|
9549
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.5.0");
|
|
9204
9550
|
}
|
|
9205
9551
|
}, {
|
|
9206
9552
|
key: "setUserAgent",
|
|
@@ -9416,7 +9762,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9416
9762
|
}, _callee52, this);
|
|
9417
9763
|
}));
|
|
9418
9764
|
|
|
9419
|
-
function sendUserCustomEvent(
|
|
9765
|
+
function sendUserCustomEvent(_x70, _x71) {
|
|
9420
9766
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
9421
9767
|
}
|
|
9422
9768
|
|
|
@@ -9509,7 +9855,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9509
9855
|
}, _callee53, this);
|
|
9510
9856
|
}));
|
|
9511
9857
|
|
|
9512
|
-
function createSegment(
|
|
9858
|
+
function createSegment(_x72) {
|
|
9513
9859
|
return _createSegment.apply(this, arguments);
|
|
9514
9860
|
}
|
|
9515
9861
|
|
|
@@ -9549,7 +9895,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9549
9895
|
}, _callee54, this);
|
|
9550
9896
|
}));
|
|
9551
9897
|
|
|
9552
|
-
function getSegment(
|
|
9898
|
+
function getSegment(_x73) {
|
|
9553
9899
|
return _getSegment.apply(this, arguments);
|
|
9554
9900
|
}
|
|
9555
9901
|
|
|
@@ -9588,7 +9934,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9588
9934
|
}, _callee55, this);
|
|
9589
9935
|
}));
|
|
9590
9936
|
|
|
9591
|
-
function listSegments(
|
|
9937
|
+
function listSegments(_x74) {
|
|
9592
9938
|
return _listSegments.apply(this, arguments);
|
|
9593
9939
|
}
|
|
9594
9940
|
|
|
@@ -9631,7 +9977,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9631
9977
|
}, _callee56, this);
|
|
9632
9978
|
}));
|
|
9633
9979
|
|
|
9634
|
-
function updateSegment(
|
|
9980
|
+
function updateSegment(_x75, _x76) {
|
|
9635
9981
|
return _updateSegment.apply(this, arguments);
|
|
9636
9982
|
}
|
|
9637
9983
|
|
|
@@ -9663,7 +10009,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9663
10009
|
}, _callee57, this);
|
|
9664
10010
|
}));
|
|
9665
10011
|
|
|
9666
|
-
function deleteSegment(
|
|
10012
|
+
function deleteSegment(_x77) {
|
|
9667
10013
|
return _deleteSegment.apply(this, arguments);
|
|
9668
10014
|
}
|
|
9669
10015
|
|
|
@@ -9705,7 +10051,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9705
10051
|
}, _callee58, this);
|
|
9706
10052
|
}));
|
|
9707
10053
|
|
|
9708
|
-
function createCampaign(
|
|
10054
|
+
function createCampaign(_x78) {
|
|
9709
10055
|
return _createCampaign.apply(this, arguments);
|
|
9710
10056
|
}
|
|
9711
10057
|
|
|
@@ -9745,7 +10091,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9745
10091
|
}, _callee59, this);
|
|
9746
10092
|
}));
|
|
9747
10093
|
|
|
9748
|
-
function getCampaign(
|
|
10094
|
+
function getCampaign(_x79) {
|
|
9749
10095
|
return _getCampaign.apply(this, arguments);
|
|
9750
10096
|
}
|
|
9751
10097
|
|
|
@@ -9784,7 +10130,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9784
10130
|
}, _callee60, this);
|
|
9785
10131
|
}));
|
|
9786
10132
|
|
|
9787
|
-
function listCampaigns(
|
|
10133
|
+
function listCampaigns(_x80) {
|
|
9788
10134
|
return _listCampaigns.apply(this, arguments);
|
|
9789
10135
|
}
|
|
9790
10136
|
|
|
@@ -9827,7 +10173,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9827
10173
|
}, _callee61, this);
|
|
9828
10174
|
}));
|
|
9829
10175
|
|
|
9830
|
-
function updateCampaign(
|
|
10176
|
+
function updateCampaign(_x81, _x82) {
|
|
9831
10177
|
return _updateCampaign.apply(this, arguments);
|
|
9832
10178
|
}
|
|
9833
10179
|
|
|
@@ -9859,7 +10205,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9859
10205
|
}, _callee62, this);
|
|
9860
10206
|
}));
|
|
9861
10207
|
|
|
9862
|
-
function deleteCampaign(
|
|
10208
|
+
function deleteCampaign(_x83) {
|
|
9863
10209
|
return _deleteCampaign.apply(this, arguments);
|
|
9864
10210
|
}
|
|
9865
10211
|
|
|
@@ -9903,7 +10249,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9903
10249
|
}, _callee63, this);
|
|
9904
10250
|
}));
|
|
9905
10251
|
|
|
9906
|
-
function scheduleCampaign(
|
|
10252
|
+
function scheduleCampaign(_x84, _x85) {
|
|
9907
10253
|
return _scheduleCampaign.apply(this, arguments);
|
|
9908
10254
|
}
|
|
9909
10255
|
|
|
@@ -9943,7 +10289,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9943
10289
|
}, _callee64, this);
|
|
9944
10290
|
}));
|
|
9945
10291
|
|
|
9946
|
-
function stopCampaign(
|
|
10292
|
+
function stopCampaign(_x86) {
|
|
9947
10293
|
return _stopCampaign.apply(this, arguments);
|
|
9948
10294
|
}
|
|
9949
10295
|
|
|
@@ -9983,7 +10329,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9983
10329
|
}, _callee65, this);
|
|
9984
10330
|
}));
|
|
9985
10331
|
|
|
9986
|
-
function resumeCampaign(
|
|
10332
|
+
function resumeCampaign(_x87) {
|
|
9987
10333
|
return _resumeCampaign.apply(this, arguments);
|
|
9988
10334
|
}
|
|
9989
10335
|
|
|
@@ -10026,7 +10372,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10026
10372
|
}, _callee66, this);
|
|
10027
10373
|
}));
|
|
10028
10374
|
|
|
10029
|
-
function testCampaign(
|
|
10375
|
+
function testCampaign(_x88, _x89) {
|
|
10030
10376
|
return _testCampaign.apply(this, arguments);
|
|
10031
10377
|
}
|
|
10032
10378
|
|
|
@@ -10059,7 +10405,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10059
10405
|
}, _callee67, this);
|
|
10060
10406
|
}));
|
|
10061
10407
|
|
|
10062
|
-
function enrichURL(
|
|
10408
|
+
function enrichURL(_x90) {
|
|
10063
10409
|
return _enrichURL.apply(this, arguments);
|
|
10064
10410
|
}
|
|
10065
10411
|
|
|
@@ -10091,7 +10437,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10091
10437
|
}, _callee68, this);
|
|
10092
10438
|
}));
|
|
10093
10439
|
|
|
10094
|
-
function getTask(
|
|
10440
|
+
function getTask(_x91) {
|
|
10095
10441
|
return _getTask.apply(this, arguments);
|
|
10096
10442
|
}
|
|
10097
10443
|
|
|
@@ -10133,7 +10479,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10133
10479
|
}, _callee69, this);
|
|
10134
10480
|
}));
|
|
10135
10481
|
|
|
10136
|
-
function deleteChannels(
|
|
10482
|
+
function deleteChannels(_x92) {
|
|
10137
10483
|
return _deleteChannels.apply(this, arguments);
|
|
10138
10484
|
}
|
|
10139
10485
|
|
|
@@ -10196,7 +10542,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10196
10542
|
}, _callee70, this);
|
|
10197
10543
|
}));
|
|
10198
10544
|
|
|
10199
|
-
function deleteUsers(
|
|
10545
|
+
function deleteUsers(_x93, _x94) {
|
|
10200
10546
|
return _deleteUsers.apply(this, arguments);
|
|
10201
10547
|
}
|
|
10202
10548
|
|
|
@@ -10211,7 +10557,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10211
10557
|
*
|
|
10212
10558
|
* @private
|
|
10213
10559
|
* @param {string} filename filename of uploaded data
|
|
10214
|
-
*
|
|
10215
10560
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10216
10561
|
*/
|
|
10217
10562
|
|
|
@@ -10239,7 +10584,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10239
10584
|
}, _callee71, this);
|
|
10240
10585
|
}));
|
|
10241
10586
|
|
|
10242
|
-
function _createImportURL(
|
|
10587
|
+
function _createImportURL(_x95) {
|
|
10243
10588
|
return _createImportURL2.apply(this, arguments);
|
|
10244
10589
|
}
|
|
10245
10590
|
|
|
@@ -10254,7 +10599,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10254
10599
|
*
|
|
10255
10600
|
* @private
|
|
10256
10601
|
* @param {string} path path of uploaded data
|
|
10257
|
-
*
|
|
10602
|
+
* @param {CreateImportOptions} options import options
|
|
10258
10603
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10259
10604
|
*/
|
|
10260
10605
|
|
|
@@ -10262,19 +10607,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10262
10607
|
key: "_createImport",
|
|
10263
10608
|
value: function () {
|
|
10264
10609
|
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(path) {
|
|
10610
|
+
var options,
|
|
10611
|
+
_args72 = arguments;
|
|
10265
10612
|
return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
|
|
10266
10613
|
while (1) {
|
|
10267
10614
|
switch (_context72.prev = _context72.next) {
|
|
10268
10615
|
case 0:
|
|
10269
|
-
|
|
10270
|
-
|
|
10616
|
+
options = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {
|
|
10617
|
+
mode: 'upsert'
|
|
10618
|
+
};
|
|
10619
|
+
_context72.next = 3;
|
|
10620
|
+
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
10271
10621
|
path: path
|
|
10272
|
-
});
|
|
10622
|
+
}, options));
|
|
10273
10623
|
|
|
10274
|
-
case
|
|
10624
|
+
case 3:
|
|
10275
10625
|
return _context72.abrupt("return", _context72.sent);
|
|
10276
10626
|
|
|
10277
|
-
case
|
|
10627
|
+
case 4:
|
|
10278
10628
|
case "end":
|
|
10279
10629
|
return _context72.stop();
|
|
10280
10630
|
}
|
|
@@ -10282,7 +10632,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10282
10632
|
}, _callee72, this);
|
|
10283
10633
|
}));
|
|
10284
10634
|
|
|
10285
|
-
function _createImport(
|
|
10635
|
+
function _createImport(_x96) {
|
|
10286
10636
|
return _createImport2.apply(this, arguments);
|
|
10287
10637
|
}
|
|
10288
10638
|
|
|
@@ -10323,7 +10673,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10323
10673
|
}, _callee73, this);
|
|
10324
10674
|
}));
|
|
10325
10675
|
|
|
10326
|
-
function _getImport(
|
|
10676
|
+
function _getImport(_x97) {
|
|
10327
10677
|
return _getImport2.apply(this, arguments);
|
|
10328
10678
|
}
|
|
10329
10679
|
|
|
@@ -10364,12 +10714,128 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10364
10714
|
}, _callee74, this);
|
|
10365
10715
|
}));
|
|
10366
10716
|
|
|
10367
|
-
function _listImports(
|
|
10717
|
+
function _listImports(_x98) {
|
|
10368
10718
|
return _listImports2.apply(this, arguments);
|
|
10369
10719
|
}
|
|
10370
10720
|
|
|
10371
10721
|
return _listImports;
|
|
10372
10722
|
}()
|
|
10723
|
+
/**
|
|
10724
|
+
* upsertPushProvider - Create or Update a push provider
|
|
10725
|
+
*
|
|
10726
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10727
|
+
*
|
|
10728
|
+
* @param {PushProviderConfig} configuration of the provider you want to create or update
|
|
10729
|
+
*
|
|
10730
|
+
* @return {APIResponse & PushProviderUpsertResponse} A push provider
|
|
10731
|
+
*/
|
|
10732
|
+
|
|
10733
|
+
}, {
|
|
10734
|
+
key: "upsertPushProvider",
|
|
10735
|
+
value: function () {
|
|
10736
|
+
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(pushProvider) {
|
|
10737
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
|
|
10738
|
+
while (1) {
|
|
10739
|
+
switch (_context75.prev = _context75.next) {
|
|
10740
|
+
case 0:
|
|
10741
|
+
_context75.next = 2;
|
|
10742
|
+
return this.post(this.baseURL + "/push_providers", {
|
|
10743
|
+
push_provider: pushProvider
|
|
10744
|
+
});
|
|
10745
|
+
|
|
10746
|
+
case 2:
|
|
10747
|
+
return _context75.abrupt("return", _context75.sent);
|
|
10748
|
+
|
|
10749
|
+
case 3:
|
|
10750
|
+
case "end":
|
|
10751
|
+
return _context75.stop();
|
|
10752
|
+
}
|
|
10753
|
+
}
|
|
10754
|
+
}, _callee75, this);
|
|
10755
|
+
}));
|
|
10756
|
+
|
|
10757
|
+
function upsertPushProvider(_x99) {
|
|
10758
|
+
return _upsertPushProvider.apply(this, arguments);
|
|
10759
|
+
}
|
|
10760
|
+
|
|
10761
|
+
return upsertPushProvider;
|
|
10762
|
+
}()
|
|
10763
|
+
/**
|
|
10764
|
+
* deletePushProvider - Delete a push provider
|
|
10765
|
+
*
|
|
10766
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10767
|
+
*
|
|
10768
|
+
* @param {PushProviderID} type and foreign id of the push provider to be deleted
|
|
10769
|
+
*
|
|
10770
|
+
* @return {APIResponse} An API response
|
|
10771
|
+
*/
|
|
10772
|
+
|
|
10773
|
+
}, {
|
|
10774
|
+
key: "deletePushProvider",
|
|
10775
|
+
value: function () {
|
|
10776
|
+
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(_ref8) {
|
|
10777
|
+
var type, name;
|
|
10778
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
|
|
10779
|
+
while (1) {
|
|
10780
|
+
switch (_context76.prev = _context76.next) {
|
|
10781
|
+
case 0:
|
|
10782
|
+
type = _ref8.type, name = _ref8.name;
|
|
10783
|
+
_context76.next = 3;
|
|
10784
|
+
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
10785
|
+
|
|
10786
|
+
case 3:
|
|
10787
|
+
return _context76.abrupt("return", _context76.sent);
|
|
10788
|
+
|
|
10789
|
+
case 4:
|
|
10790
|
+
case "end":
|
|
10791
|
+
return _context76.stop();
|
|
10792
|
+
}
|
|
10793
|
+
}
|
|
10794
|
+
}, _callee76, this);
|
|
10795
|
+
}));
|
|
10796
|
+
|
|
10797
|
+
function deletePushProvider(_x100) {
|
|
10798
|
+
return _deletePushProvider.apply(this, arguments);
|
|
10799
|
+
}
|
|
10800
|
+
|
|
10801
|
+
return deletePushProvider;
|
|
10802
|
+
}()
|
|
10803
|
+
/**
|
|
10804
|
+
* listPushProviders - Get all push providers in the app
|
|
10805
|
+
*
|
|
10806
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10807
|
+
*
|
|
10808
|
+
* @return {APIResponse & PushProviderListResponse} A push provider
|
|
10809
|
+
*/
|
|
10810
|
+
|
|
10811
|
+
}, {
|
|
10812
|
+
key: "listPushProviders",
|
|
10813
|
+
value: function () {
|
|
10814
|
+
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77() {
|
|
10815
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
|
|
10816
|
+
while (1) {
|
|
10817
|
+
switch (_context77.prev = _context77.next) {
|
|
10818
|
+
case 0:
|
|
10819
|
+
_context77.next = 2;
|
|
10820
|
+
return this.get(this.baseURL + "/push_providers");
|
|
10821
|
+
|
|
10822
|
+
case 2:
|
|
10823
|
+
return _context77.abrupt("return", _context77.sent);
|
|
10824
|
+
|
|
10825
|
+
case 3:
|
|
10826
|
+
case "end":
|
|
10827
|
+
return _context77.stop();
|
|
10828
|
+
}
|
|
10829
|
+
}
|
|
10830
|
+
}, _callee77, this);
|
|
10831
|
+
}));
|
|
10832
|
+
|
|
10833
|
+
function listPushProviders() {
|
|
10834
|
+
return _listPushProviders.apply(this, arguments);
|
|
10835
|
+
}
|
|
10836
|
+
|
|
10837
|
+
return listPushProviders;
|
|
10838
|
+
}()
|
|
10373
10839
|
}], [{
|
|
10374
10840
|
key: "getInstance",
|
|
10375
10841
|
value: function getInstance(key, secretOrOptions, options) {
|