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.es.js
CHANGED
|
@@ -102,6 +102,13 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
102
102
|
* When false, any new message (received by websocket event - message.new) will not
|
|
103
103
|
* be pushed on to message list.
|
|
104
104
|
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Disjoint lists of messages
|
|
108
|
+
* Users can jump in the message list (with searching) and this can result in disjoint lists of messages
|
|
109
|
+
* The state manages these lists and merges them when lists overlap
|
|
110
|
+
* The messages array contains the currently active set
|
|
111
|
+
*/
|
|
105
112
|
function ChannelState(channel) {
|
|
106
113
|
var _this = this,
|
|
107
114
|
_channel$state;
|
|
@@ -116,8 +123,6 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
116
123
|
|
|
117
124
|
_defineProperty(this, "read", void 0);
|
|
118
125
|
|
|
119
|
-
_defineProperty(this, "messages", void 0);
|
|
120
|
-
|
|
121
126
|
_defineProperty(this, "pinnedMessages", void 0);
|
|
122
127
|
|
|
123
128
|
_defineProperty(this, "threads", void 0);
|
|
@@ -136,6 +141,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
136
141
|
|
|
137
142
|
_defineProperty(this, "isUpToDate", void 0);
|
|
138
143
|
|
|
144
|
+
_defineProperty(this, "messageSets", []);
|
|
145
|
+
|
|
139
146
|
_defineProperty(this, "setIsUpToDate", function (isUpToDate) {
|
|
140
147
|
_this.isUpToDate = isUpToDate;
|
|
141
148
|
});
|
|
@@ -165,7 +172,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
165
172
|
}
|
|
166
173
|
};
|
|
167
174
|
|
|
168
|
-
|
|
175
|
+
_this.messageSets.forEach(function (set) {
|
|
176
|
+
return _updateUserMessages(set.messages, user);
|
|
177
|
+
});
|
|
169
178
|
|
|
170
179
|
for (var parentId in _this.threads) {
|
|
171
180
|
_updateUserMessages(_this.threads[parentId], user);
|
|
@@ -219,7 +228,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
219
228
|
}
|
|
220
229
|
};
|
|
221
230
|
|
|
222
|
-
|
|
231
|
+
_this.messageSets.forEach(function (set) {
|
|
232
|
+
return _deleteUserMessages(set.messages, user, hardDelete);
|
|
233
|
+
});
|
|
223
234
|
|
|
224
235
|
for (var parentId in _this.threads) {
|
|
225
236
|
_deleteUserMessages(_this.threads[parentId], user, hardDelete);
|
|
@@ -232,7 +243,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
232
243
|
this.watcher_count = 0;
|
|
233
244
|
this.typing = {};
|
|
234
245
|
this.read = {};
|
|
235
|
-
this.
|
|
246
|
+
this.initMessages();
|
|
236
247
|
this.pinnedMessages = [];
|
|
237
248
|
this.threads = {}; // a list of users to hide messages from
|
|
238
249
|
|
|
@@ -251,22 +262,58 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
251
262
|
this.isUpToDate = true;
|
|
252
263
|
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;
|
|
253
264
|
}
|
|
254
|
-
/**
|
|
255
|
-
* addMessageSorted - Add a message to the state
|
|
256
|
-
*
|
|
257
|
-
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
258
|
-
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
259
|
-
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
260
|
-
*
|
|
261
|
-
*/
|
|
262
|
-
|
|
263
265
|
|
|
264
266
|
_createClass(ChannelState, [{
|
|
267
|
+
key: "messages",
|
|
268
|
+
get: function get() {
|
|
269
|
+
var _this$messageSets$fin;
|
|
270
|
+
|
|
271
|
+
return ((_this$messageSets$fin = this.messageSets.find(function (s) {
|
|
272
|
+
return s.isCurrent;
|
|
273
|
+
})) === null || _this$messageSets$fin === void 0 ? void 0 : _this$messageSets$fin.messages) || [];
|
|
274
|
+
},
|
|
275
|
+
set: function set(messages) {
|
|
276
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
277
|
+
return s.isCurrent;
|
|
278
|
+
});
|
|
279
|
+
this.messageSets[index].messages = messages;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The list of latest messages
|
|
283
|
+
* 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)
|
|
284
|
+
*/
|
|
285
|
+
|
|
286
|
+
}, {
|
|
287
|
+
key: "latestMessages",
|
|
288
|
+
get: function get() {
|
|
289
|
+
var _this$messageSets$fin2;
|
|
290
|
+
|
|
291
|
+
return ((_this$messageSets$fin2 = this.messageSets.find(function (s) {
|
|
292
|
+
return s.isLatest;
|
|
293
|
+
})) === null || _this$messageSets$fin2 === void 0 ? void 0 : _this$messageSets$fin2.messages) || [];
|
|
294
|
+
},
|
|
295
|
+
set: function set(messages) {
|
|
296
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
297
|
+
return s.isLatest;
|
|
298
|
+
});
|
|
299
|
+
this.messageSets[index].messages = messages;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* addMessageSorted - Add a message to the state
|
|
303
|
+
*
|
|
304
|
+
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
305
|
+
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
306
|
+
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
307
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if message is not in the list (only used if addIfDoesNotExist is true)
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
}, {
|
|
265
311
|
key: "addMessageSorted",
|
|
266
312
|
value: function addMessageSorted(newMessage) {
|
|
267
313
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
268
314
|
var addIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
269
|
-
|
|
315
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'latest';
|
|
316
|
+
return this.addMessagesSorted([newMessage], timestampChanged, false, addIfDoesNotExist, messageSetToAddToIfDoesNotExist);
|
|
270
317
|
}
|
|
271
318
|
/**
|
|
272
319
|
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
@@ -298,6 +345,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
298
345
|
* @param {boolean} timestampChanged Whether updating messages with changed created_at value.
|
|
299
346
|
* @param {boolean} initializing Whether channel is being initialized.
|
|
300
347
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
348
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if messages are not in the list (only used if addIfDoesNotExist is true)
|
|
301
349
|
*
|
|
302
350
|
*/
|
|
303
351
|
|
|
@@ -307,48 +355,63 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
307
355
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
308
356
|
var initializing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
309
357
|
var addIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
358
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'current';
|
|
310
359
|
|
|
311
|
-
|
|
312
|
-
|
|
360
|
+
var _this$findTargetMessa = this.findTargetMessageSet(newMessages, addIfDoesNotExist, messageSetToAddToIfDoesNotExist),
|
|
361
|
+
messagesToAdd = _this$findTargetMessa.messagesToAdd,
|
|
362
|
+
targetMessageSetIndex = _this$findTargetMessa.targetMessageSetIndex;
|
|
313
363
|
|
|
314
|
-
|
|
364
|
+
for (var i = 0; i < messagesToAdd.length; i += 1) {
|
|
365
|
+
var isFromShadowBannedUser = messagesToAdd[i].shadowed;
|
|
315
366
|
|
|
316
367
|
if (isFromShadowBannedUser) {
|
|
317
368
|
continue;
|
|
318
|
-
}
|
|
369
|
+
} // If message is already formatted we can skip the tasks below
|
|
370
|
+
// This will be true for messages that are already present at the state -> this happens when we perform merging of message sets
|
|
371
|
+
// This will be also true for message previews used by some SDKs
|
|
319
372
|
|
|
320
|
-
var message = this.formatMessage(newMessages[i]);
|
|
321
373
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
* Store the reference to user for this channel, so that when we have to
|
|
325
|
-
* handle updates to user, we can use the reference map, to determine which
|
|
326
|
-
* channels need to be updated with updated user object.
|
|
327
|
-
*/
|
|
328
|
-
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
329
|
-
}
|
|
374
|
+
var isMessageFormatted = messagesToAdd[i].created_at instanceof Date;
|
|
375
|
+
var message = void 0;
|
|
330
376
|
|
|
331
|
-
if (
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
// and consumer can refetch the replies.
|
|
336
|
-
delete this.threads[message.id];
|
|
337
|
-
}
|
|
377
|
+
if (isMessageFormatted) {
|
|
378
|
+
message = messagesToAdd[i];
|
|
379
|
+
} else {
|
|
380
|
+
var _this$_channel;
|
|
338
381
|
|
|
339
|
-
|
|
340
|
-
this.last_message_at = new Date(message.created_at.getTime());
|
|
341
|
-
}
|
|
382
|
+
message = this.formatMessage(messagesToAdd[i]);
|
|
342
383
|
|
|
343
|
-
|
|
344
|
-
|
|
384
|
+
if (message.user && (_this$_channel = this._channel) !== null && _this$_channel !== void 0 && _this$_channel.cid) {
|
|
385
|
+
/**
|
|
386
|
+
* Store the reference to user for this channel, so that when we have to
|
|
387
|
+
* handle updates to user, we can use the reference map, to determine which
|
|
388
|
+
* channels need to be updated with updated user object.
|
|
389
|
+
*/
|
|
390
|
+
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (initializing && message.id && this.threads[message.id]) {
|
|
394
|
+
// If we are initializing the state of channel (e.g., in case of connection recovery),
|
|
395
|
+
// then in that case we remove thread related to this message from threads object.
|
|
396
|
+
// This way we can ensure that we don't have any stale data in thread object
|
|
397
|
+
// and consumer can refetch the replies.
|
|
398
|
+
delete this.threads[message.id];
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (!this.last_message_at) {
|
|
402
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (message.created_at.getTime() > this.last_message_at.getTime()) {
|
|
406
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
407
|
+
}
|
|
345
408
|
} // update or append the messages...
|
|
346
409
|
|
|
347
410
|
|
|
348
|
-
var parentID = message.parent_id; // add to the
|
|
411
|
+
var parentID = message.parent_id; // add to the given message set
|
|
349
412
|
|
|
350
|
-
if (!parentID || message.show_in_channel) {
|
|
351
|
-
this.messages = this._addToMessageList(this.messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
413
|
+
if ((!parentID || message.show_in_channel) && targetMessageSetIndex !== -1) {
|
|
414
|
+
this.messageSets[targetMessageSetIndex].messages = this._addToMessageList(this.messageSets[targetMessageSetIndex].messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
352
415
|
}
|
|
353
416
|
/**
|
|
354
417
|
* Add message to thread if applicable and the message
|
|
@@ -472,6 +535,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
472
535
|
}, {
|
|
473
536
|
key: "removeQuotedMessageReferences",
|
|
474
537
|
value: function removeQuotedMessageReferences(message) {
|
|
538
|
+
var _this4 = this;
|
|
539
|
+
|
|
475
540
|
var parseMessage = function parseMessage(m) {
|
|
476
541
|
var _m$pinned_at, _m$updated_at;
|
|
477
542
|
|
|
@@ -482,16 +547,19 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
482
547
|
});
|
|
483
548
|
};
|
|
484
549
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
550
|
+
this.messageSets.forEach(function (set) {
|
|
551
|
+
var updatedMessages = set.messages.filter(function (msg) {
|
|
552
|
+
return msg.quoted_message_id === message.id;
|
|
553
|
+
}).map(parseMessage).map(function (msg) {
|
|
554
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
555
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
556
|
+
attachments: []
|
|
557
|
+
})
|
|
558
|
+
});
|
|
492
559
|
});
|
|
560
|
+
|
|
561
|
+
_this4.addMessagesSorted(updatedMessages, true);
|
|
493
562
|
});
|
|
494
|
-
this.addMessagesSorted(updatedMessages, true);
|
|
495
563
|
}
|
|
496
564
|
/**
|
|
497
565
|
* Updates all instances of given message in channel state
|
|
@@ -519,12 +587,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
519
587
|
}
|
|
520
588
|
|
|
521
589
|
if (!show_in_channel && !parent_id || show_in_channel) {
|
|
522
|
-
var
|
|
523
|
-
|
|
524
|
-
|
|
590
|
+
var messageSetIndex = this.findMessageSetIndex(message);
|
|
591
|
+
|
|
592
|
+
if (messageSetIndex !== -1) {
|
|
593
|
+
var _msgIndex = this.messageSets[messageSetIndex].messages.findIndex(function (msg) {
|
|
594
|
+
return msg.id === message.id;
|
|
595
|
+
});
|
|
525
596
|
|
|
526
|
-
|
|
527
|
-
|
|
597
|
+
if (_msgIndex !== -1) {
|
|
598
|
+
this.messageSets[messageSetIndex].messages[_msgIndex] = updateFunc(this.messageSets[messageSetIndex].messages[_msgIndex]);
|
|
599
|
+
}
|
|
528
600
|
}
|
|
529
601
|
}
|
|
530
602
|
|
|
@@ -643,12 +715,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
643
715
|
this.threads[messageToRemove.parent_id] = threadMessages;
|
|
644
716
|
isRemoved = removed;
|
|
645
717
|
} else {
|
|
646
|
-
var
|
|
647
|
-
_removed = _this$removeMessageFr3.removed,
|
|
648
|
-
messages = _this$removeMessageFr3.result;
|
|
718
|
+
var messageSetIndex = this.findMessageSetIndex(messageToRemove);
|
|
649
719
|
|
|
650
|
-
|
|
651
|
-
|
|
720
|
+
if (messageSetIndex !== -1) {
|
|
721
|
+
var _this$removeMessageFr3 = this.removeMessageFromArray(this.messageSets[messageSetIndex].messages, messageToRemove),
|
|
722
|
+
_removed = _this$removeMessageFr3.removed,
|
|
723
|
+
messages = _this$removeMessageFr3.result;
|
|
724
|
+
|
|
725
|
+
this.messageSets[messageSetIndex].messages = messages;
|
|
726
|
+
isRemoved = _removed;
|
|
727
|
+
}
|
|
652
728
|
}
|
|
653
729
|
|
|
654
730
|
return isRemoved;
|
|
@@ -661,10 +737,10 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
661
737
|
*
|
|
662
738
|
*/
|
|
663
739
|
function filterErrorMessages() {
|
|
664
|
-
var filteredMessages = this.
|
|
740
|
+
var filteredMessages = this.latestMessages.filter(function (message) {
|
|
665
741
|
return message.type !== 'error';
|
|
666
742
|
});
|
|
667
|
-
this.
|
|
743
|
+
this.latestMessages = filteredMessages;
|
|
668
744
|
}
|
|
669
745
|
/**
|
|
670
746
|
* clean - Remove stale data such as users that stayed in typing state for more than 5 seconds
|
|
@@ -698,9 +774,250 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
698
774
|
}, {
|
|
699
775
|
key: "clearMessages",
|
|
700
776
|
value: function clearMessages() {
|
|
701
|
-
this.
|
|
777
|
+
this.initMessages();
|
|
702
778
|
this.pinnedMessages = [];
|
|
703
779
|
}
|
|
780
|
+
}, {
|
|
781
|
+
key: "initMessages",
|
|
782
|
+
value: function initMessages() {
|
|
783
|
+
this.messageSets = [{
|
|
784
|
+
messages: [],
|
|
785
|
+
isLatest: true,
|
|
786
|
+
isCurrent: true
|
|
787
|
+
}];
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* loadMessageIntoState - Loads a given message (and messages around it) into the state
|
|
791
|
+
*
|
|
792
|
+
* @param {string} messageId The id of the message, or 'latest' to indicate switching to the latest messages
|
|
793
|
+
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply
|
|
794
|
+
*/
|
|
795
|
+
|
|
796
|
+
}, {
|
|
797
|
+
key: "loadMessageIntoState",
|
|
798
|
+
value: function () {
|
|
799
|
+
var _loadMessageIntoState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(messageId, parentMessageId) {
|
|
800
|
+
var _this$threads$parentM;
|
|
801
|
+
|
|
802
|
+
var messageSetIndex, switchedToMessageSet, loadedMessageThread, messageIdToFind;
|
|
803
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
804
|
+
while (1) {
|
|
805
|
+
switch (_context.prev = _context.next) {
|
|
806
|
+
case 0:
|
|
807
|
+
switchedToMessageSet = false;
|
|
808
|
+
loadedMessageThread = false;
|
|
809
|
+
messageIdToFind = parentMessageId || messageId;
|
|
810
|
+
|
|
811
|
+
if (!(messageId === 'latest')) {
|
|
812
|
+
_context.next = 9;
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
if (!(this.messages === this.latestMessages)) {
|
|
817
|
+
_context.next = 6;
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
return _context.abrupt("return");
|
|
822
|
+
|
|
823
|
+
case 6:
|
|
824
|
+
messageSetIndex = this.messageSets.findIndex(function (s) {
|
|
825
|
+
return s.isLatest;
|
|
826
|
+
});
|
|
827
|
+
_context.next = 10;
|
|
828
|
+
break;
|
|
829
|
+
|
|
830
|
+
case 9:
|
|
831
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
832
|
+
id: messageIdToFind
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
case 10:
|
|
836
|
+
if (messageSetIndex !== -1) {
|
|
837
|
+
this.switchToMessageSet(messageSetIndex);
|
|
838
|
+
switchedToMessageSet = true;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
loadedMessageThread = !parentMessageId || !!((_this$threads$parentM = this.threads[parentMessageId]) !== null && _this$threads$parentM !== void 0 && _this$threads$parentM.find(function (m) {
|
|
842
|
+
return m.id === messageId;
|
|
843
|
+
}));
|
|
844
|
+
|
|
845
|
+
if (!(switchedToMessageSet && loadedMessageThread)) {
|
|
846
|
+
_context.next = 14;
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
return _context.abrupt("return");
|
|
851
|
+
|
|
852
|
+
case 14:
|
|
853
|
+
if (switchedToMessageSet) {
|
|
854
|
+
_context.next = 17;
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
_context.next = 17;
|
|
859
|
+
return this._channel.query({
|
|
860
|
+
messages: {
|
|
861
|
+
id_around: messageIdToFind,
|
|
862
|
+
limit: 25
|
|
863
|
+
}
|
|
864
|
+
}, 'new');
|
|
865
|
+
|
|
866
|
+
case 17:
|
|
867
|
+
if (!(!loadedMessageThread && parentMessageId)) {
|
|
868
|
+
_context.next = 20;
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
_context.next = 20;
|
|
873
|
+
return this._channel.getReplies(parentMessageId, {
|
|
874
|
+
id_around: messageId,
|
|
875
|
+
limit: 25
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
case 20:
|
|
879
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
880
|
+
id: messageIdToFind
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
if (messageSetIndex !== -1) {
|
|
884
|
+
this.switchToMessageSet(messageSetIndex);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
case 22:
|
|
888
|
+
case "end":
|
|
889
|
+
return _context.stop();
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}, _callee, this);
|
|
893
|
+
}));
|
|
894
|
+
|
|
895
|
+
function loadMessageIntoState(_x, _x2) {
|
|
896
|
+
return _loadMessageIntoState.apply(this, arguments);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
return loadMessageIntoState;
|
|
900
|
+
}()
|
|
901
|
+
}, {
|
|
902
|
+
key: "switchToMessageSet",
|
|
903
|
+
value: function switchToMessageSet(index) {
|
|
904
|
+
var currentMessages = this.messageSets.find(function (s) {
|
|
905
|
+
return s.isCurrent;
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
if (!currentMessages) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
currentMessages.isCurrent = false;
|
|
913
|
+
this.messageSets[index].isCurrent = true;
|
|
914
|
+
}
|
|
915
|
+
}, {
|
|
916
|
+
key: "areMessageSetsOverlap",
|
|
917
|
+
value: function areMessageSetsOverlap(messages1, messages2) {
|
|
918
|
+
return messages1.some(function (m1) {
|
|
919
|
+
return messages2.find(function (m2) {
|
|
920
|
+
return m1.id === m2.id;
|
|
921
|
+
});
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
}, {
|
|
925
|
+
key: "findMessageSetIndex",
|
|
926
|
+
value: function findMessageSetIndex(message) {
|
|
927
|
+
return this.messageSets.findIndex(function (set) {
|
|
928
|
+
return !!set.messages.find(function (m) {
|
|
929
|
+
return m.id === message.id;
|
|
930
|
+
});
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
}, {
|
|
934
|
+
key: "findTargetMessageSet",
|
|
935
|
+
value: function findTargetMessageSet(newMessages) {
|
|
936
|
+
var _this5 = this;
|
|
937
|
+
|
|
938
|
+
var addIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
939
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'current';
|
|
940
|
+
var messagesToAdd = newMessages;
|
|
941
|
+
var targetMessageSetIndex;
|
|
942
|
+
|
|
943
|
+
if (addIfDoesNotExist) {
|
|
944
|
+
var overlappingMessageSetIndices = this.messageSets.map(function (_, i) {
|
|
945
|
+
return i;
|
|
946
|
+
}).filter(function (i) {
|
|
947
|
+
return _this5.areMessageSetsOverlap(_this5.messageSets[i].messages, newMessages);
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
switch (messageSetToAddToIfDoesNotExist) {
|
|
951
|
+
case 'new':
|
|
952
|
+
if (overlappingMessageSetIndices.length > 0) {
|
|
953
|
+
targetMessageSetIndex = overlappingMessageSetIndices[0]; // No new message set is created if newMessages only contains thread replies
|
|
954
|
+
} else if (newMessages.some(function (m) {
|
|
955
|
+
return !m.parent_id;
|
|
956
|
+
})) {
|
|
957
|
+
this.messageSets.push({
|
|
958
|
+
messages: [],
|
|
959
|
+
isCurrent: false,
|
|
960
|
+
isLatest: false
|
|
961
|
+
});
|
|
962
|
+
targetMessageSetIndex = this.messageSets.length - 1;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
break;
|
|
966
|
+
|
|
967
|
+
case 'current':
|
|
968
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
969
|
+
return s.isCurrent;
|
|
970
|
+
});
|
|
971
|
+
break;
|
|
972
|
+
|
|
973
|
+
case 'latest':
|
|
974
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
975
|
+
return s.isLatest;
|
|
976
|
+
});
|
|
977
|
+
break;
|
|
978
|
+
|
|
979
|
+
default:
|
|
980
|
+
targetMessageSetIndex = -1;
|
|
981
|
+
} // when merging the target set will be the first one from the overlapping message sets
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
985
|
+
|
|
986
|
+
var mergeSourceMessageSetIndices = _toConsumableArray(overlappingMessageSetIndices);
|
|
987
|
+
|
|
988
|
+
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
989
|
+
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
990
|
+
} // merge message sets
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
if (mergeSourceMessageSetIndices.length > 0) {
|
|
994
|
+
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
995
|
+
var sources = this.messageSets.filter(function (_, i) {
|
|
996
|
+
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
997
|
+
});
|
|
998
|
+
sources.forEach(function (messageSet) {
|
|
999
|
+
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1000
|
+
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1001
|
+
messagesToAdd = [].concat(_toConsumableArray(messagesToAdd), _toConsumableArray(messageSet.messages));
|
|
1002
|
+
});
|
|
1003
|
+
sources.forEach(function (s) {
|
|
1004
|
+
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1005
|
+
});
|
|
1006
|
+
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1007
|
+
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1008
|
+
});
|
|
1009
|
+
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1010
|
+
}
|
|
1011
|
+
} else {
|
|
1012
|
+
// assumes that all new messages belong to the same set
|
|
1013
|
+
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
return {
|
|
1017
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1018
|
+
messagesToAdd: messagesToAdd
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
704
1021
|
}]);
|
|
705
1022
|
|
|
706
1023
|
return ChannelState;
|
|
@@ -1063,7 +1380,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1063
1380
|
presence: false
|
|
1064
1381
|
};
|
|
1065
1382
|
_context.next = 3;
|
|
1066
|
-
return _this.query(options);
|
|
1383
|
+
return _this.query(options, 'latest');
|
|
1067
1384
|
|
|
1068
1385
|
case 3:
|
|
1069
1386
|
return _context.abrupt("return", _context.sent);
|
|
@@ -2361,14 +2678,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2361
2678
|
value: function lastMessage() {
|
|
2362
2679
|
// get last 5 messages, sort, return the latest
|
|
2363
2680
|
// get a slice of the last 5
|
|
2364
|
-
var min = this.state.
|
|
2681
|
+
var min = this.state.latestMessages.length - 5;
|
|
2365
2682
|
|
|
2366
2683
|
if (min < 0) {
|
|
2367
2684
|
min = 0;
|
|
2368
2685
|
}
|
|
2369
2686
|
|
|
2370
|
-
var max = this.state.
|
|
2371
|
-
var messageSlice = this.state.
|
|
2687
|
+
var max = this.state.latestMessages.length + 1;
|
|
2688
|
+
var messageSlice = this.state.latestMessages.slice(min, max); // sort by pk desc
|
|
2372
2689
|
|
|
2373
2690
|
messageSlice.sort(function (a, b) {
|
|
2374
2691
|
return b.created_at.getTime() - a.created_at.getTime();
|
|
@@ -2477,7 +2794,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2477
2794
|
|
|
2478
2795
|
combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
|
|
2479
2796
|
_context27.next = 7;
|
|
2480
|
-
return this.query(combined);
|
|
2797
|
+
return this.query(combined, 'latest');
|
|
2481
2798
|
|
|
2482
2799
|
case 7:
|
|
2483
2800
|
state = _context27.sent;
|
|
@@ -2551,7 +2868,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2551
2868
|
* getReplies - List the message replies for a parent message
|
|
2552
2869
|
*
|
|
2553
2870
|
* @param {string} parent_id The message parent id, ie the top of the thread
|
|
2554
|
-
* @param {
|
|
2871
|
+
* @param {MessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2555
2872
|
*
|
|
2556
2873
|
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2557
2874
|
*/
|
|
@@ -2712,8 +3029,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2712
3029
|
if (!lastRead) return this.state.unreadCount;
|
|
2713
3030
|
var count = 0;
|
|
2714
3031
|
|
|
2715
|
-
for (var i = 0; i < this.state.
|
|
2716
|
-
var message = this.state.
|
|
3032
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
3033
|
+
var message = this.state.latestMessages[i];
|
|
2717
3034
|
|
|
2718
3035
|
if (message.created_at > lastRead && this._countMessageAsUnread(message)) {
|
|
2719
3036
|
count++;
|
|
@@ -2723,7 +3040,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2723
3040
|
return count;
|
|
2724
3041
|
}
|
|
2725
3042
|
/**
|
|
2726
|
-
*
|
|
3043
|
+
* countUnreadMentions - Count the number of unread messages mentioning the current user
|
|
2727
3044
|
*
|
|
2728
3045
|
* @return {number} Unread mentions count
|
|
2729
3046
|
*/
|
|
@@ -2735,10 +3052,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2735
3052
|
var userID = this.getClient().userID;
|
|
2736
3053
|
var count = 0;
|
|
2737
3054
|
|
|
2738
|
-
for (var i = 0; i < this.state.
|
|
3055
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
2739
3056
|
var _message$mentioned_us;
|
|
2740
3057
|
|
|
2741
|
-
var message = this.state.
|
|
3058
|
+
var message = this.state.latestMessages[i];
|
|
2742
3059
|
|
|
2743
3060
|
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) {
|
|
2744
3061
|
return user.id === userID;
|
|
@@ -2762,33 +3079,40 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2762
3079
|
* query - Query the API, get messages, members or other channel fields
|
|
2763
3080
|
*
|
|
2764
3081
|
* @param {ChannelQueryOptions<StreamChatGenerics>} options The query options
|
|
3082
|
+
* @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
|
|
2765
3083
|
*
|
|
2766
3084
|
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} Returns a query response
|
|
2767
3085
|
*/
|
|
2768
3086
|
function () {
|
|
2769
3087
|
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(options) {
|
|
2770
|
-
var
|
|
3088
|
+
var messageSetToAddToIfDoesNotExist,
|
|
3089
|
+
queryURL,
|
|
3090
|
+
state,
|
|
3091
|
+
membersStr,
|
|
3092
|
+
tempChannelCid,
|
|
3093
|
+
_args31 = arguments;
|
|
2771
3094
|
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
2772
3095
|
while (1) {
|
|
2773
3096
|
switch (_context31.prev = _context31.next) {
|
|
2774
3097
|
case 0:
|
|
2775
|
-
|
|
3098
|
+
messageSetToAddToIfDoesNotExist = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : 'current';
|
|
3099
|
+
_context31.next = 3;
|
|
2776
3100
|
return this.getClient().wsPromise;
|
|
2777
3101
|
|
|
2778
|
-
case
|
|
3102
|
+
case 3:
|
|
2779
3103
|
queryURL = "".concat(this.getClient().baseURL, "/channels/").concat(this.type);
|
|
2780
3104
|
|
|
2781
3105
|
if (this.id) {
|
|
2782
3106
|
queryURL += "/".concat(this.id);
|
|
2783
3107
|
}
|
|
2784
3108
|
|
|
2785
|
-
_context31.next =
|
|
3109
|
+
_context31.next = 7;
|
|
2786
3110
|
return this.getClient().post(queryURL + '/query', _objectSpread$5({
|
|
2787
3111
|
data: this._data,
|
|
2788
3112
|
state: true
|
|
2789
3113
|
}, options));
|
|
2790
3114
|
|
|
2791
|
-
case
|
|
3115
|
+
case 7:
|
|
2792
3116
|
state = _context31.sent;
|
|
2793
3117
|
|
|
2794
3118
|
// update the channel id if it was missing
|
|
@@ -2817,11 +3141,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2817
3141
|
this.getClient()._addChannelConfig(state); // add any messages to our channel state
|
|
2818
3142
|
|
|
2819
3143
|
|
|
2820
|
-
this._initializeState(state);
|
|
3144
|
+
this._initializeState(state, messageSetToAddToIfDoesNotExist);
|
|
2821
3145
|
|
|
2822
3146
|
return _context31.abrupt("return", state);
|
|
2823
3147
|
|
|
2824
|
-
case
|
|
3148
|
+
case 12:
|
|
2825
3149
|
case "end":
|
|
2826
3150
|
return _context31.stop();
|
|
2827
3151
|
}
|
|
@@ -3371,6 +3695,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3371
3695
|
}, {
|
|
3372
3696
|
key: "_initializeState",
|
|
3373
3697
|
value: function _initializeState(state) {
|
|
3698
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'latest';
|
|
3699
|
+
|
|
3374
3700
|
var _this$getClient2 = this.getClient(),
|
|
3375
3701
|
clientState = _this$getClient2.state,
|
|
3376
3702
|
user = _this$getClient2.user,
|
|
@@ -3400,10 +3726,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3400
3726
|
var messages = state.messages || [];
|
|
3401
3727
|
|
|
3402
3728
|
if (!this.state.messages) {
|
|
3403
|
-
this.state.
|
|
3729
|
+
this.state.initMessages();
|
|
3404
3730
|
}
|
|
3405
3731
|
|
|
3406
|
-
this.state.addMessagesSorted(messages, false, true);
|
|
3732
|
+
this.state.addMessagesSorted(messages, false, true, true, messageSetToAddToIfDoesNotExist);
|
|
3407
3733
|
|
|
3408
3734
|
if (!this.state.pinnedMessages) {
|
|
3409
3735
|
this.state.pinnedMessages = [];
|
|
@@ -4823,7 +5149,7 @@ function TokenManager(secret) {
|
|
|
4823
5149
|
_defineProperty(this, "loadToken", function () {
|
|
4824
5150
|
// eslint-disable-next-line no-async-promise-executor
|
|
4825
5151
|
_this.loadTokenPromise = new Promise( /*#__PURE__*/function () {
|
|
4826
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
|
|
5152
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve, reject) {
|
|
4827
5153
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
4828
5154
|
while (1) {
|
|
4829
5155
|
switch (_context2.prev = _context2.next) {
|
|
@@ -4837,26 +5163,36 @@ function TokenManager(secret) {
|
|
|
4837
5163
|
|
|
4838
5164
|
case 2:
|
|
4839
5165
|
if (!(_this.tokenProvider && typeof _this.tokenProvider !== 'string')) {
|
|
4840
|
-
_context2.next =
|
|
5166
|
+
_context2.next = 13;
|
|
4841
5167
|
break;
|
|
4842
5168
|
}
|
|
4843
5169
|
|
|
4844
|
-
_context2.
|
|
5170
|
+
_context2.prev = 3;
|
|
5171
|
+
_context2.next = 6;
|
|
4845
5172
|
return _this.tokenProvider();
|
|
4846
5173
|
|
|
4847
|
-
case
|
|
5174
|
+
case 6:
|
|
4848
5175
|
_this.token = _context2.sent;
|
|
5176
|
+
_context2.next = 12;
|
|
5177
|
+
break;
|
|
5178
|
+
|
|
5179
|
+
case 9:
|
|
5180
|
+
_context2.prev = 9;
|
|
5181
|
+
_context2.t0 = _context2["catch"](3);
|
|
5182
|
+
return _context2.abrupt("return", reject(new Error("Call to tokenProvider failed with message: ".concat(_context2.t0))));
|
|
5183
|
+
|
|
5184
|
+
case 12:
|
|
4849
5185
|
resolve(_this.token);
|
|
4850
5186
|
|
|
4851
|
-
case
|
|
5187
|
+
case 13:
|
|
4852
5188
|
case "end":
|
|
4853
5189
|
return _context2.stop();
|
|
4854
5190
|
}
|
|
4855
5191
|
}
|
|
4856
|
-
}, _callee2);
|
|
5192
|
+
}, _callee2, null, [[3, 9]]);
|
|
4857
5193
|
}));
|
|
4858
5194
|
|
|
4859
|
-
return function (_x3) {
|
|
5195
|
+
return function (_x3, _x4) {
|
|
4860
5196
|
return _ref2.apply(this, arguments);
|
|
4861
5197
|
};
|
|
4862
5198
|
}());
|
|
@@ -6366,30 +6702,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6366
6702
|
key: "updateAppSettings",
|
|
6367
6703
|
value:
|
|
6368
6704
|
/**
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6705
|
+
* updateAppSettings - updates application settings
|
|
6706
|
+
*
|
|
6707
|
+
* @param {AppSettings} options App settings.
|
|
6708
|
+
* IE: {
|
|
6709
|
+
'apn_config': {
|
|
6710
|
+
'auth_type': 'token',
|
|
6711
|
+
'auth_key": fs.readFileSync(
|
|
6712
|
+
'./apn-push-auth-key.p8',
|
|
6713
|
+
'utf-8',
|
|
6714
|
+
),
|
|
6715
|
+
'key_id': 'keyid',
|
|
6716
|
+
'team_id': 'teamid',
|
|
6717
|
+
'notification_template": 'notification handlebars template',
|
|
6718
|
+
'bundle_id': 'com.apple.your.app',
|
|
6719
|
+
'development': true
|
|
6720
|
+
},
|
|
6721
|
+
'firebase_config': {
|
|
6722
|
+
'server_key': 'server key from fcm',
|
|
6723
|
+
'notification_template': 'notification handlebars template',
|
|
6724
|
+
'data_template': 'data handlebars template',
|
|
6725
|
+
'apn_template': 'apn notification handlebars template under v2'
|
|
6726
|
+
},
|
|
6727
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
6728
|
+
}
|
|
6729
|
+
*/
|
|
6393
6730
|
function () {
|
|
6394
6731
|
var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(options) {
|
|
6395
6732
|
var _options$apn_config;
|
|
@@ -6580,17 +6917,19 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6580
6917
|
return getAppSettings;
|
|
6581
6918
|
}()
|
|
6582
6919
|
/**
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6920
|
+
* testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
|
|
6921
|
+
*
|
|
6922
|
+
* @param {string} userID User ID. If user has no devices, it will error
|
|
6923
|
+
* @param {TestPushDataInput} [data] Overrides for push templates/message used
|
|
6924
|
+
* IE: {
|
|
6925
|
+
messageID: 'id-of-message', // will error if message does not exist
|
|
6926
|
+
apnTemplate: '{}', // if app doesn't have apn configured it will error
|
|
6927
|
+
firebaseTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6928
|
+
firebaseDataTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6929
|
+
skipDevices: true, // skip config/device checks and sending to real devices
|
|
6930
|
+
pushProviderName: 'staging' // one of your configured push providers
|
|
6931
|
+
pushProviderType: 'apn' // one of supported provider types
|
|
6932
|
+
}
|
|
6594
6933
|
*/
|
|
6595
6934
|
|
|
6596
6935
|
}, {
|
|
@@ -6605,7 +6944,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6605
6944
|
case 0:
|
|
6606
6945
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
6607
6946
|
_context12.next = 3;
|
|
6608
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6947
|
+
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6609
6948
|
user_id: userID
|
|
6610
6949
|
}, data.messageID ? {
|
|
6611
6950
|
message_id: data.messageID
|
|
@@ -6617,6 +6956,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6617
6956
|
firebase_data_template: data.firebaseDataTemplate
|
|
6618
6957
|
} : {}), data.skipDevices ? {
|
|
6619
6958
|
skip_devices: true
|
|
6959
|
+
} : {}), data.pushProviderName ? {
|
|
6960
|
+
push_provider_name: data.pushProviderName
|
|
6961
|
+
} : {}), data.pushProviderType ? {
|
|
6962
|
+
push_provider_type: data.pushProviderType
|
|
6620
6963
|
} : {}));
|
|
6621
6964
|
|
|
6622
6965
|
case 3:
|
|
@@ -6640,11 +6983,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6640
6983
|
* testSQSSettings - Tests that the given or configured SQS configuration is valid
|
|
6641
6984
|
*
|
|
6642
6985
|
* @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
|
|
6643
|
-
*
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6986
|
+
* IE: {
|
|
6987
|
+
sqs_key: 'auth_key',
|
|
6988
|
+
sqs_secret: 'auth_secret',
|
|
6989
|
+
sqs_url: 'url_to_queue',
|
|
6990
|
+
}
|
|
6648
6991
|
*/
|
|
6649
6992
|
|
|
6650
6993
|
}, {
|
|
@@ -6999,7 +7342,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6999
7342
|
this.mutedUsers = event.me.mutes;
|
|
7000
7343
|
}
|
|
7001
7344
|
|
|
7002
|
-
if (event.type === 'notification.mark_read') {
|
|
7345
|
+
if (event.type === 'notification.mark_read' && event.unread_channels === 0) {
|
|
7003
7346
|
var activeChannelKeys = Object.keys(this.activeChannels);
|
|
7004
7347
|
activeChannelKeys.forEach(function (activeChannelKey) {
|
|
7005
7348
|
return _this3.activeChannels[activeChannelKey].state.unreadCount = 0;
|
|
@@ -7441,11 +7784,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7441
7784
|
c.initialized = true;
|
|
7442
7785
|
|
|
7443
7786
|
if (skipInitialization === undefined) {
|
|
7444
|
-
c._initializeState(_channelState);
|
|
7787
|
+
c._initializeState(_channelState, 'latest');
|
|
7445
7788
|
} else if (!skipInitialization.includes(_channelState.channel.id)) {
|
|
7446
7789
|
c.state.clearMessages();
|
|
7447
7790
|
|
|
7448
|
-
c._initializeState(_channelState);
|
|
7791
|
+
c._initializeState(_channelState, 'latest');
|
|
7449
7792
|
}
|
|
7450
7793
|
|
|
7451
7794
|
channels.push(c);
|
|
@@ -7582,23 +7925,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7582
7925
|
* @param {string} id the device id
|
|
7583
7926
|
* @param {PushProvider} push_provider the push provider
|
|
7584
7927
|
* @param {string} [userID] the user id (defaults to current user)
|
|
7928
|
+
* @param {string} [push_provider_name] user provided push provider name for multi bundle support
|
|
7585
7929
|
*
|
|
7586
7930
|
*/
|
|
7587
7931
|
|
|
7588
7932
|
}, {
|
|
7589
7933
|
key: "addDevice",
|
|
7590
7934
|
value: function () {
|
|
7591
|
-
var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(id, push_provider, userID) {
|
|
7935
|
+
var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(id, push_provider, userID, push_provider_name) {
|
|
7592
7936
|
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
7593
7937
|
while (1) {
|
|
7594
7938
|
switch (_context21.prev = _context21.next) {
|
|
7595
7939
|
case 0:
|
|
7596
7940
|
_context21.next = 2;
|
|
7597
|
-
return this.post(this.baseURL + '/devices', _objectSpread({
|
|
7941
|
+
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
7598
7942
|
id: id,
|
|
7599
7943
|
push_provider: push_provider
|
|
7600
7944
|
}, userID != null ? {
|
|
7601
7945
|
user_id: userID
|
|
7946
|
+
} : {}), push_provider_name != null ? {
|
|
7947
|
+
push_provider_name: push_provider_name
|
|
7602
7948
|
} : {}));
|
|
7603
7949
|
|
|
7604
7950
|
case 2:
|
|
@@ -7612,7 +7958,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7612
7958
|
}, _callee21, this);
|
|
7613
7959
|
}));
|
|
7614
7960
|
|
|
7615
|
-
function addDevice(_x20, _x21, _x22) {
|
|
7961
|
+
function addDevice(_x20, _x21, _x22, _x23) {
|
|
7616
7962
|
return _addDevice.apply(this, arguments);
|
|
7617
7963
|
}
|
|
7618
7964
|
|
|
@@ -7650,7 +7996,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7650
7996
|
}, _callee22, this);
|
|
7651
7997
|
}));
|
|
7652
7998
|
|
|
7653
|
-
function getDevices(
|
|
7999
|
+
function getDevices(_x24) {
|
|
7654
8000
|
return _getDevices.apply(this, arguments);
|
|
7655
8001
|
}
|
|
7656
8002
|
|
|
@@ -7690,7 +8036,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7690
8036
|
}, _callee23, this);
|
|
7691
8037
|
}));
|
|
7692
8038
|
|
|
7693
|
-
function removeDevice(
|
|
8039
|
+
function removeDevice(_x25, _x26) {
|
|
7694
8040
|
return _removeDevice.apply(this, arguments);
|
|
7695
8041
|
}
|
|
7696
8042
|
|
|
@@ -7731,7 +8077,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7731
8077
|
}, _callee24, this);
|
|
7732
8078
|
}));
|
|
7733
8079
|
|
|
7734
|
-
function getRateLimits(
|
|
8080
|
+
function getRateLimits(_x27) {
|
|
7735
8081
|
return _getRateLimits.apply(this, arguments);
|
|
7736
8082
|
}
|
|
7737
8083
|
|
|
@@ -7832,7 +8178,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7832
8178
|
}, _callee25, this);
|
|
7833
8179
|
}));
|
|
7834
8180
|
|
|
7835
|
-
function partialUpdateUser(
|
|
8181
|
+
function partialUpdateUser(_x28) {
|
|
7836
8182
|
return _partialUpdateUser.apply(this, arguments);
|
|
7837
8183
|
}
|
|
7838
8184
|
|
|
@@ -7918,7 +8264,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7918
8264
|
}, _callee26, this, [[2, 13, 16, 19]]);
|
|
7919
8265
|
}));
|
|
7920
8266
|
|
|
7921
|
-
function upsertUsers(
|
|
8267
|
+
function upsertUsers(_x29) {
|
|
7922
8268
|
return _upsertUsers.apply(this, arguments);
|
|
7923
8269
|
}
|
|
7924
8270
|
|
|
@@ -8031,7 +8377,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8031
8377
|
}, _callee27, this, [[1, 11, 14, 17]]);
|
|
8032
8378
|
}));
|
|
8033
8379
|
|
|
8034
|
-
function partialUpdateUsers(
|
|
8380
|
+
function partialUpdateUsers(_x30) {
|
|
8035
8381
|
return _partialUpdateUsers.apply(this, arguments);
|
|
8036
8382
|
}
|
|
8037
8383
|
|
|
@@ -8059,7 +8405,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8059
8405
|
}, _callee28, this);
|
|
8060
8406
|
}));
|
|
8061
8407
|
|
|
8062
|
-
function deleteUser(
|
|
8408
|
+
function deleteUser(_x31, _x32) {
|
|
8063
8409
|
return _deleteUser.apply(this, arguments);
|
|
8064
8410
|
}
|
|
8065
8411
|
|
|
@@ -8087,7 +8433,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8087
8433
|
}, _callee29, this);
|
|
8088
8434
|
}));
|
|
8089
8435
|
|
|
8090
|
-
function reactivateUser(
|
|
8436
|
+
function reactivateUser(_x33, _x34) {
|
|
8091
8437
|
return _reactivateUser.apply(this, arguments);
|
|
8092
8438
|
}
|
|
8093
8439
|
|
|
@@ -8115,7 +8461,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8115
8461
|
}, _callee30, this);
|
|
8116
8462
|
}));
|
|
8117
8463
|
|
|
8118
|
-
function deactivateUser(
|
|
8464
|
+
function deactivateUser(_x35, _x36) {
|
|
8119
8465
|
return _deactivateUser.apply(this, arguments);
|
|
8120
8466
|
}
|
|
8121
8467
|
|
|
@@ -8143,7 +8489,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8143
8489
|
}, _callee31, this);
|
|
8144
8490
|
}));
|
|
8145
8491
|
|
|
8146
|
-
function exportUser(
|
|
8492
|
+
function exportUser(_x37, _x38) {
|
|
8147
8493
|
return _exportUser.apply(this, arguments);
|
|
8148
8494
|
}
|
|
8149
8495
|
|
|
@@ -8180,7 +8526,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8180
8526
|
}, _callee32, this);
|
|
8181
8527
|
}));
|
|
8182
8528
|
|
|
8183
|
-
function banUser(
|
|
8529
|
+
function banUser(_x39, _x40) {
|
|
8184
8530
|
return _banUser.apply(this, arguments);
|
|
8185
8531
|
}
|
|
8186
8532
|
|
|
@@ -8217,7 +8563,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8217
8563
|
}, _callee33, this);
|
|
8218
8564
|
}));
|
|
8219
8565
|
|
|
8220
|
-
function unbanUser(
|
|
8566
|
+
function unbanUser(_x41, _x42) {
|
|
8221
8567
|
return _unbanUser.apply(this, arguments);
|
|
8222
8568
|
}
|
|
8223
8569
|
|
|
@@ -8254,7 +8600,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8254
8600
|
}, _callee34, this);
|
|
8255
8601
|
}));
|
|
8256
8602
|
|
|
8257
|
-
function shadowBan(
|
|
8603
|
+
function shadowBan(_x43, _x44) {
|
|
8258
8604
|
return _shadowBan.apply(this, arguments);
|
|
8259
8605
|
}
|
|
8260
8606
|
|
|
@@ -8291,7 +8637,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8291
8637
|
}, _callee35, this);
|
|
8292
8638
|
}));
|
|
8293
8639
|
|
|
8294
|
-
function removeShadowBan(
|
|
8640
|
+
function removeShadowBan(_x45, _x46) {
|
|
8295
8641
|
return _removeShadowBan.apply(this, arguments);
|
|
8296
8642
|
}
|
|
8297
8643
|
|
|
@@ -8334,7 +8680,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8334
8680
|
}, _callee36, this);
|
|
8335
8681
|
}));
|
|
8336
8682
|
|
|
8337
|
-
function muteUser(
|
|
8683
|
+
function muteUser(_x47, _x48) {
|
|
8338
8684
|
return _muteUser.apply(this, arguments);
|
|
8339
8685
|
}
|
|
8340
8686
|
|
|
@@ -8373,7 +8719,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8373
8719
|
}, _callee37, this);
|
|
8374
8720
|
}));
|
|
8375
8721
|
|
|
8376
|
-
function unmuteUser(
|
|
8722
|
+
function unmuteUser(_x49, _x50) {
|
|
8377
8723
|
return _unmuteUser.apply(this, arguments);
|
|
8378
8724
|
}
|
|
8379
8725
|
|
|
@@ -8432,7 +8778,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8432
8778
|
}, _callee38, this);
|
|
8433
8779
|
}));
|
|
8434
8780
|
|
|
8435
|
-
function flagMessage(
|
|
8781
|
+
function flagMessage(_x51) {
|
|
8436
8782
|
return _flagMessage.apply(this, arguments);
|
|
8437
8783
|
}
|
|
8438
8784
|
|
|
@@ -8472,7 +8818,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8472
8818
|
}, _callee39, this);
|
|
8473
8819
|
}));
|
|
8474
8820
|
|
|
8475
|
-
function flagUser(
|
|
8821
|
+
function flagUser(_x52) {
|
|
8476
8822
|
return _flagUser.apply(this, arguments);
|
|
8477
8823
|
}
|
|
8478
8824
|
|
|
@@ -8512,7 +8858,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8512
8858
|
}, _callee40, this);
|
|
8513
8859
|
}));
|
|
8514
8860
|
|
|
8515
|
-
function unflagMessage(
|
|
8861
|
+
function unflagMessage(_x53) {
|
|
8516
8862
|
return _unflagMessage.apply(this, arguments);
|
|
8517
8863
|
}
|
|
8518
8864
|
|
|
@@ -8552,7 +8898,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8552
8898
|
}, _callee41, this);
|
|
8553
8899
|
}));
|
|
8554
8900
|
|
|
8555
|
-
function unflagUser(
|
|
8901
|
+
function unflagUser(_x54) {
|
|
8556
8902
|
return _unflagUser.apply(this, arguments);
|
|
8557
8903
|
}
|
|
8558
8904
|
|
|
@@ -8698,7 +9044,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8698
9044
|
}, _callee44, this);
|
|
8699
9045
|
}));
|
|
8700
9046
|
|
|
8701
|
-
function _reviewFlagReport(
|
|
9047
|
+
function _reviewFlagReport(_x55, _x56) {
|
|
8702
9048
|
return _reviewFlagReport2.apply(this, arguments);
|
|
8703
9049
|
}
|
|
8704
9050
|
|
|
@@ -8744,7 +9090,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8744
9090
|
}, _callee45, this);
|
|
8745
9091
|
}));
|
|
8746
9092
|
|
|
8747
|
-
function _unblockMessage(
|
|
9093
|
+
function _unblockMessage(_x57) {
|
|
8748
9094
|
return _unblockMessage2.apply(this, arguments);
|
|
8749
9095
|
}
|
|
8750
9096
|
|
|
@@ -8883,7 +9229,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8883
9229
|
}, _callee47, this);
|
|
8884
9230
|
}));
|
|
8885
9231
|
|
|
8886
|
-
function translateMessage(
|
|
9232
|
+
function translateMessage(_x58, _x59) {
|
|
8887
9233
|
return _translateMessage.apply(this, arguments);
|
|
8888
9234
|
}
|
|
8889
9235
|
|
|
@@ -9045,7 +9391,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9045
9391
|
}, _callee48, this);
|
|
9046
9392
|
}));
|
|
9047
9393
|
|
|
9048
|
-
function updateMessage(
|
|
9394
|
+
function updateMessage(_x60, _x61, _x62) {
|
|
9049
9395
|
return _updateMessage.apply(this, arguments);
|
|
9050
9396
|
}
|
|
9051
9397
|
|
|
@@ -9106,7 +9452,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9106
9452
|
}, _callee49, this);
|
|
9107
9453
|
}));
|
|
9108
9454
|
|
|
9109
|
-
function partialUpdateMessage(
|
|
9455
|
+
function partialUpdateMessage(_x63, _x64, _x65, _x66) {
|
|
9110
9456
|
return _partialUpdateMessage.apply(this, arguments);
|
|
9111
9457
|
}
|
|
9112
9458
|
|
|
@@ -9143,7 +9489,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9143
9489
|
}, _callee50, this);
|
|
9144
9490
|
}));
|
|
9145
9491
|
|
|
9146
|
-
function deleteMessage(
|
|
9492
|
+
function deleteMessage(_x67, _x68) {
|
|
9147
9493
|
return _deleteMessage.apply(this, arguments);
|
|
9148
9494
|
}
|
|
9149
9495
|
|
|
@@ -9171,7 +9517,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9171
9517
|
}, _callee51, this);
|
|
9172
9518
|
}));
|
|
9173
9519
|
|
|
9174
|
-
function getMessage(
|
|
9520
|
+
function getMessage(_x69) {
|
|
9175
9521
|
return _getMessage.apply(this, arguments);
|
|
9176
9522
|
}
|
|
9177
9523
|
|
|
@@ -9180,7 +9526,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9180
9526
|
}, {
|
|
9181
9527
|
key: "getUserAgent",
|
|
9182
9528
|
value: function getUserAgent() {
|
|
9183
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.
|
|
9529
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.5.0");
|
|
9184
9530
|
}
|
|
9185
9531
|
}, {
|
|
9186
9532
|
key: "setUserAgent",
|
|
@@ -9396,7 +9742,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9396
9742
|
}, _callee52, this);
|
|
9397
9743
|
}));
|
|
9398
9744
|
|
|
9399
|
-
function sendUserCustomEvent(
|
|
9745
|
+
function sendUserCustomEvent(_x70, _x71) {
|
|
9400
9746
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
9401
9747
|
}
|
|
9402
9748
|
|
|
@@ -9489,7 +9835,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9489
9835
|
}, _callee53, this);
|
|
9490
9836
|
}));
|
|
9491
9837
|
|
|
9492
|
-
function createSegment(
|
|
9838
|
+
function createSegment(_x72) {
|
|
9493
9839
|
return _createSegment.apply(this, arguments);
|
|
9494
9840
|
}
|
|
9495
9841
|
|
|
@@ -9529,7 +9875,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9529
9875
|
}, _callee54, this);
|
|
9530
9876
|
}));
|
|
9531
9877
|
|
|
9532
|
-
function getSegment(
|
|
9878
|
+
function getSegment(_x73) {
|
|
9533
9879
|
return _getSegment.apply(this, arguments);
|
|
9534
9880
|
}
|
|
9535
9881
|
|
|
@@ -9568,7 +9914,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9568
9914
|
}, _callee55, this);
|
|
9569
9915
|
}));
|
|
9570
9916
|
|
|
9571
|
-
function listSegments(
|
|
9917
|
+
function listSegments(_x74) {
|
|
9572
9918
|
return _listSegments.apply(this, arguments);
|
|
9573
9919
|
}
|
|
9574
9920
|
|
|
@@ -9611,7 +9957,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9611
9957
|
}, _callee56, this);
|
|
9612
9958
|
}));
|
|
9613
9959
|
|
|
9614
|
-
function updateSegment(
|
|
9960
|
+
function updateSegment(_x75, _x76) {
|
|
9615
9961
|
return _updateSegment.apply(this, arguments);
|
|
9616
9962
|
}
|
|
9617
9963
|
|
|
@@ -9643,7 +9989,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9643
9989
|
}, _callee57, this);
|
|
9644
9990
|
}));
|
|
9645
9991
|
|
|
9646
|
-
function deleteSegment(
|
|
9992
|
+
function deleteSegment(_x77) {
|
|
9647
9993
|
return _deleteSegment.apply(this, arguments);
|
|
9648
9994
|
}
|
|
9649
9995
|
|
|
@@ -9685,7 +10031,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9685
10031
|
}, _callee58, this);
|
|
9686
10032
|
}));
|
|
9687
10033
|
|
|
9688
|
-
function createCampaign(
|
|
10034
|
+
function createCampaign(_x78) {
|
|
9689
10035
|
return _createCampaign.apply(this, arguments);
|
|
9690
10036
|
}
|
|
9691
10037
|
|
|
@@ -9725,7 +10071,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9725
10071
|
}, _callee59, this);
|
|
9726
10072
|
}));
|
|
9727
10073
|
|
|
9728
|
-
function getCampaign(
|
|
10074
|
+
function getCampaign(_x79) {
|
|
9729
10075
|
return _getCampaign.apply(this, arguments);
|
|
9730
10076
|
}
|
|
9731
10077
|
|
|
@@ -9764,7 +10110,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9764
10110
|
}, _callee60, this);
|
|
9765
10111
|
}));
|
|
9766
10112
|
|
|
9767
|
-
function listCampaigns(
|
|
10113
|
+
function listCampaigns(_x80) {
|
|
9768
10114
|
return _listCampaigns.apply(this, arguments);
|
|
9769
10115
|
}
|
|
9770
10116
|
|
|
@@ -9807,7 +10153,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9807
10153
|
}, _callee61, this);
|
|
9808
10154
|
}));
|
|
9809
10155
|
|
|
9810
|
-
function updateCampaign(
|
|
10156
|
+
function updateCampaign(_x81, _x82) {
|
|
9811
10157
|
return _updateCampaign.apply(this, arguments);
|
|
9812
10158
|
}
|
|
9813
10159
|
|
|
@@ -9839,7 +10185,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9839
10185
|
}, _callee62, this);
|
|
9840
10186
|
}));
|
|
9841
10187
|
|
|
9842
|
-
function deleteCampaign(
|
|
10188
|
+
function deleteCampaign(_x83) {
|
|
9843
10189
|
return _deleteCampaign.apply(this, arguments);
|
|
9844
10190
|
}
|
|
9845
10191
|
|
|
@@ -9883,7 +10229,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9883
10229
|
}, _callee63, this);
|
|
9884
10230
|
}));
|
|
9885
10231
|
|
|
9886
|
-
function scheduleCampaign(
|
|
10232
|
+
function scheduleCampaign(_x84, _x85) {
|
|
9887
10233
|
return _scheduleCampaign.apply(this, arguments);
|
|
9888
10234
|
}
|
|
9889
10235
|
|
|
@@ -9923,7 +10269,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9923
10269
|
}, _callee64, this);
|
|
9924
10270
|
}));
|
|
9925
10271
|
|
|
9926
|
-
function stopCampaign(
|
|
10272
|
+
function stopCampaign(_x86) {
|
|
9927
10273
|
return _stopCampaign.apply(this, arguments);
|
|
9928
10274
|
}
|
|
9929
10275
|
|
|
@@ -9963,7 +10309,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9963
10309
|
}, _callee65, this);
|
|
9964
10310
|
}));
|
|
9965
10311
|
|
|
9966
|
-
function resumeCampaign(
|
|
10312
|
+
function resumeCampaign(_x87) {
|
|
9967
10313
|
return _resumeCampaign.apply(this, arguments);
|
|
9968
10314
|
}
|
|
9969
10315
|
|
|
@@ -10006,7 +10352,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10006
10352
|
}, _callee66, this);
|
|
10007
10353
|
}));
|
|
10008
10354
|
|
|
10009
|
-
function testCampaign(
|
|
10355
|
+
function testCampaign(_x88, _x89) {
|
|
10010
10356
|
return _testCampaign.apply(this, arguments);
|
|
10011
10357
|
}
|
|
10012
10358
|
|
|
@@ -10039,7 +10385,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10039
10385
|
}, _callee67, this);
|
|
10040
10386
|
}));
|
|
10041
10387
|
|
|
10042
|
-
function enrichURL(
|
|
10388
|
+
function enrichURL(_x90) {
|
|
10043
10389
|
return _enrichURL.apply(this, arguments);
|
|
10044
10390
|
}
|
|
10045
10391
|
|
|
@@ -10071,7 +10417,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10071
10417
|
}, _callee68, this);
|
|
10072
10418
|
}));
|
|
10073
10419
|
|
|
10074
|
-
function getTask(
|
|
10420
|
+
function getTask(_x91) {
|
|
10075
10421
|
return _getTask.apply(this, arguments);
|
|
10076
10422
|
}
|
|
10077
10423
|
|
|
@@ -10113,7 +10459,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10113
10459
|
}, _callee69, this);
|
|
10114
10460
|
}));
|
|
10115
10461
|
|
|
10116
|
-
function deleteChannels(
|
|
10462
|
+
function deleteChannels(_x92) {
|
|
10117
10463
|
return _deleteChannels.apply(this, arguments);
|
|
10118
10464
|
}
|
|
10119
10465
|
|
|
@@ -10176,7 +10522,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10176
10522
|
}, _callee70, this);
|
|
10177
10523
|
}));
|
|
10178
10524
|
|
|
10179
|
-
function deleteUsers(
|
|
10525
|
+
function deleteUsers(_x93, _x94) {
|
|
10180
10526
|
return _deleteUsers.apply(this, arguments);
|
|
10181
10527
|
}
|
|
10182
10528
|
|
|
@@ -10191,7 +10537,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10191
10537
|
*
|
|
10192
10538
|
* @private
|
|
10193
10539
|
* @param {string} filename filename of uploaded data
|
|
10194
|
-
*
|
|
10195
10540
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10196
10541
|
*/
|
|
10197
10542
|
|
|
@@ -10219,7 +10564,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10219
10564
|
}, _callee71, this);
|
|
10220
10565
|
}));
|
|
10221
10566
|
|
|
10222
|
-
function _createImportURL(
|
|
10567
|
+
function _createImportURL(_x95) {
|
|
10223
10568
|
return _createImportURL2.apply(this, arguments);
|
|
10224
10569
|
}
|
|
10225
10570
|
|
|
@@ -10234,7 +10579,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10234
10579
|
*
|
|
10235
10580
|
* @private
|
|
10236
10581
|
* @param {string} path path of uploaded data
|
|
10237
|
-
*
|
|
10582
|
+
* @param {CreateImportOptions} options import options
|
|
10238
10583
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10239
10584
|
*/
|
|
10240
10585
|
|
|
@@ -10242,19 +10587,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10242
10587
|
key: "_createImport",
|
|
10243
10588
|
value: function () {
|
|
10244
10589
|
var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(path) {
|
|
10590
|
+
var options,
|
|
10591
|
+
_args72 = arguments;
|
|
10245
10592
|
return _regeneratorRuntime.wrap(function _callee72$(_context72) {
|
|
10246
10593
|
while (1) {
|
|
10247
10594
|
switch (_context72.prev = _context72.next) {
|
|
10248
10595
|
case 0:
|
|
10249
|
-
|
|
10250
|
-
|
|
10596
|
+
options = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {
|
|
10597
|
+
mode: 'upsert'
|
|
10598
|
+
};
|
|
10599
|
+
_context72.next = 3;
|
|
10600
|
+
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
10251
10601
|
path: path
|
|
10252
|
-
});
|
|
10602
|
+
}, options));
|
|
10253
10603
|
|
|
10254
|
-
case
|
|
10604
|
+
case 3:
|
|
10255
10605
|
return _context72.abrupt("return", _context72.sent);
|
|
10256
10606
|
|
|
10257
|
-
case
|
|
10607
|
+
case 4:
|
|
10258
10608
|
case "end":
|
|
10259
10609
|
return _context72.stop();
|
|
10260
10610
|
}
|
|
@@ -10262,7 +10612,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10262
10612
|
}, _callee72, this);
|
|
10263
10613
|
}));
|
|
10264
10614
|
|
|
10265
|
-
function _createImport(
|
|
10615
|
+
function _createImport(_x96) {
|
|
10266
10616
|
return _createImport2.apply(this, arguments);
|
|
10267
10617
|
}
|
|
10268
10618
|
|
|
@@ -10303,7 +10653,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10303
10653
|
}, _callee73, this);
|
|
10304
10654
|
}));
|
|
10305
10655
|
|
|
10306
|
-
function _getImport(
|
|
10656
|
+
function _getImport(_x97) {
|
|
10307
10657
|
return _getImport2.apply(this, arguments);
|
|
10308
10658
|
}
|
|
10309
10659
|
|
|
@@ -10344,12 +10694,128 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10344
10694
|
}, _callee74, this);
|
|
10345
10695
|
}));
|
|
10346
10696
|
|
|
10347
|
-
function _listImports(
|
|
10697
|
+
function _listImports(_x98) {
|
|
10348
10698
|
return _listImports2.apply(this, arguments);
|
|
10349
10699
|
}
|
|
10350
10700
|
|
|
10351
10701
|
return _listImports;
|
|
10352
10702
|
}()
|
|
10703
|
+
/**
|
|
10704
|
+
* upsertPushProvider - Create or Update a push provider
|
|
10705
|
+
*
|
|
10706
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10707
|
+
*
|
|
10708
|
+
* @param {PushProviderConfig} configuration of the provider you want to create or update
|
|
10709
|
+
*
|
|
10710
|
+
* @return {APIResponse & PushProviderUpsertResponse} A push provider
|
|
10711
|
+
*/
|
|
10712
|
+
|
|
10713
|
+
}, {
|
|
10714
|
+
key: "upsertPushProvider",
|
|
10715
|
+
value: function () {
|
|
10716
|
+
var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(pushProvider) {
|
|
10717
|
+
return _regeneratorRuntime.wrap(function _callee75$(_context75) {
|
|
10718
|
+
while (1) {
|
|
10719
|
+
switch (_context75.prev = _context75.next) {
|
|
10720
|
+
case 0:
|
|
10721
|
+
_context75.next = 2;
|
|
10722
|
+
return this.post(this.baseURL + "/push_providers", {
|
|
10723
|
+
push_provider: pushProvider
|
|
10724
|
+
});
|
|
10725
|
+
|
|
10726
|
+
case 2:
|
|
10727
|
+
return _context75.abrupt("return", _context75.sent);
|
|
10728
|
+
|
|
10729
|
+
case 3:
|
|
10730
|
+
case "end":
|
|
10731
|
+
return _context75.stop();
|
|
10732
|
+
}
|
|
10733
|
+
}
|
|
10734
|
+
}, _callee75, this);
|
|
10735
|
+
}));
|
|
10736
|
+
|
|
10737
|
+
function upsertPushProvider(_x99) {
|
|
10738
|
+
return _upsertPushProvider.apply(this, arguments);
|
|
10739
|
+
}
|
|
10740
|
+
|
|
10741
|
+
return upsertPushProvider;
|
|
10742
|
+
}()
|
|
10743
|
+
/**
|
|
10744
|
+
* deletePushProvider - Delete a push provider
|
|
10745
|
+
*
|
|
10746
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10747
|
+
*
|
|
10748
|
+
* @param {PushProviderID} type and foreign id of the push provider to be deleted
|
|
10749
|
+
*
|
|
10750
|
+
* @return {APIResponse} An API response
|
|
10751
|
+
*/
|
|
10752
|
+
|
|
10753
|
+
}, {
|
|
10754
|
+
key: "deletePushProvider",
|
|
10755
|
+
value: function () {
|
|
10756
|
+
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(_ref8) {
|
|
10757
|
+
var type, name;
|
|
10758
|
+
return _regeneratorRuntime.wrap(function _callee76$(_context76) {
|
|
10759
|
+
while (1) {
|
|
10760
|
+
switch (_context76.prev = _context76.next) {
|
|
10761
|
+
case 0:
|
|
10762
|
+
type = _ref8.type, name = _ref8.name;
|
|
10763
|
+
_context76.next = 3;
|
|
10764
|
+
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
10765
|
+
|
|
10766
|
+
case 3:
|
|
10767
|
+
return _context76.abrupt("return", _context76.sent);
|
|
10768
|
+
|
|
10769
|
+
case 4:
|
|
10770
|
+
case "end":
|
|
10771
|
+
return _context76.stop();
|
|
10772
|
+
}
|
|
10773
|
+
}
|
|
10774
|
+
}, _callee76, this);
|
|
10775
|
+
}));
|
|
10776
|
+
|
|
10777
|
+
function deletePushProvider(_x100) {
|
|
10778
|
+
return _deletePushProvider.apply(this, arguments);
|
|
10779
|
+
}
|
|
10780
|
+
|
|
10781
|
+
return deletePushProvider;
|
|
10782
|
+
}()
|
|
10783
|
+
/**
|
|
10784
|
+
* listPushProviders - Get all push providers in the app
|
|
10785
|
+
*
|
|
10786
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10787
|
+
*
|
|
10788
|
+
* @return {APIResponse & PushProviderListResponse} A push provider
|
|
10789
|
+
*/
|
|
10790
|
+
|
|
10791
|
+
}, {
|
|
10792
|
+
key: "listPushProviders",
|
|
10793
|
+
value: function () {
|
|
10794
|
+
var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77() {
|
|
10795
|
+
return _regeneratorRuntime.wrap(function _callee77$(_context77) {
|
|
10796
|
+
while (1) {
|
|
10797
|
+
switch (_context77.prev = _context77.next) {
|
|
10798
|
+
case 0:
|
|
10799
|
+
_context77.next = 2;
|
|
10800
|
+
return this.get(this.baseURL + "/push_providers");
|
|
10801
|
+
|
|
10802
|
+
case 2:
|
|
10803
|
+
return _context77.abrupt("return", _context77.sent);
|
|
10804
|
+
|
|
10805
|
+
case 3:
|
|
10806
|
+
case "end":
|
|
10807
|
+
return _context77.stop();
|
|
10808
|
+
}
|
|
10809
|
+
}
|
|
10810
|
+
}, _callee77, this);
|
|
10811
|
+
}));
|
|
10812
|
+
|
|
10813
|
+
function listPushProviders() {
|
|
10814
|
+
return _listPushProviders.apply(this, arguments);
|
|
10815
|
+
}
|
|
10816
|
+
|
|
10817
|
+
return listPushProviders;
|
|
10818
|
+
}()
|
|
10353
10819
|
}], [{
|
|
10354
10820
|
key: "getInstance",
|
|
10355
10821
|
value: function getInstance(key, secretOrOptions, options) {
|