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/index.es.js
CHANGED
|
@@ -103,6 +103,13 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
103
103
|
* When false, any new message (received by websocket event - message.new) will not
|
|
104
104
|
* be pushed on to message list.
|
|
105
105
|
*/
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Disjoint lists of messages
|
|
109
|
+
* Users can jump in the message list (with searching) and this can result in disjoint lists of messages
|
|
110
|
+
* The state manages these lists and merges them when lists overlap
|
|
111
|
+
* The messages array contains the currently active set
|
|
112
|
+
*/
|
|
106
113
|
function ChannelState(channel) {
|
|
107
114
|
var _this = this,
|
|
108
115
|
_channel$state;
|
|
@@ -117,8 +124,6 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
117
124
|
|
|
118
125
|
_defineProperty(this, "read", void 0);
|
|
119
126
|
|
|
120
|
-
_defineProperty(this, "messages", void 0);
|
|
121
|
-
|
|
122
127
|
_defineProperty(this, "pinnedMessages", void 0);
|
|
123
128
|
|
|
124
129
|
_defineProperty(this, "threads", void 0);
|
|
@@ -137,6 +142,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
137
142
|
|
|
138
143
|
_defineProperty(this, "isUpToDate", void 0);
|
|
139
144
|
|
|
145
|
+
_defineProperty(this, "messageSets", []);
|
|
146
|
+
|
|
140
147
|
_defineProperty(this, "setIsUpToDate", function (isUpToDate) {
|
|
141
148
|
_this.isUpToDate = isUpToDate;
|
|
142
149
|
});
|
|
@@ -166,7 +173,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
166
173
|
}
|
|
167
174
|
};
|
|
168
175
|
|
|
169
|
-
|
|
176
|
+
_this.messageSets.forEach(function (set) {
|
|
177
|
+
return _updateUserMessages(set.messages, user);
|
|
178
|
+
});
|
|
170
179
|
|
|
171
180
|
for (var parentId in _this.threads) {
|
|
172
181
|
_updateUserMessages(_this.threads[parentId], user);
|
|
@@ -220,7 +229,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
220
229
|
}
|
|
221
230
|
};
|
|
222
231
|
|
|
223
|
-
|
|
232
|
+
_this.messageSets.forEach(function (set) {
|
|
233
|
+
return _deleteUserMessages(set.messages, user, hardDelete);
|
|
234
|
+
});
|
|
224
235
|
|
|
225
236
|
for (var parentId in _this.threads) {
|
|
226
237
|
_deleteUserMessages(_this.threads[parentId], user, hardDelete);
|
|
@@ -233,7 +244,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
233
244
|
this.watcher_count = 0;
|
|
234
245
|
this.typing = {};
|
|
235
246
|
this.read = {};
|
|
236
|
-
this.
|
|
247
|
+
this.initMessages();
|
|
237
248
|
this.pinnedMessages = [];
|
|
238
249
|
this.threads = {}; // a list of users to hide messages from
|
|
239
250
|
|
|
@@ -252,22 +263,58 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
252
263
|
this.isUpToDate = true;
|
|
253
264
|
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;
|
|
254
265
|
}
|
|
255
|
-
/**
|
|
256
|
-
* addMessageSorted - Add a message to the state
|
|
257
|
-
*
|
|
258
|
-
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
259
|
-
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
260
|
-
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
261
|
-
*
|
|
262
|
-
*/
|
|
263
|
-
|
|
264
266
|
|
|
265
267
|
_createClass(ChannelState, [{
|
|
268
|
+
key: "messages",
|
|
269
|
+
get: function get() {
|
|
270
|
+
var _this$messageSets$fin;
|
|
271
|
+
|
|
272
|
+
return ((_this$messageSets$fin = this.messageSets.find(function (s) {
|
|
273
|
+
return s.isCurrent;
|
|
274
|
+
})) === null || _this$messageSets$fin === void 0 ? void 0 : _this$messageSets$fin.messages) || [];
|
|
275
|
+
},
|
|
276
|
+
set: function set(messages) {
|
|
277
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
278
|
+
return s.isCurrent;
|
|
279
|
+
});
|
|
280
|
+
this.messageSets[index].messages = messages;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* The list of latest messages
|
|
284
|
+
* 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)
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
}, {
|
|
288
|
+
key: "latestMessages",
|
|
289
|
+
get: function get() {
|
|
290
|
+
var _this$messageSets$fin2;
|
|
291
|
+
|
|
292
|
+
return ((_this$messageSets$fin2 = this.messageSets.find(function (s) {
|
|
293
|
+
return s.isLatest;
|
|
294
|
+
})) === null || _this$messageSets$fin2 === void 0 ? void 0 : _this$messageSets$fin2.messages) || [];
|
|
295
|
+
},
|
|
296
|
+
set: function set(messages) {
|
|
297
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
298
|
+
return s.isLatest;
|
|
299
|
+
});
|
|
300
|
+
this.messageSets[index].messages = messages;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* addMessageSorted - Add a message to the state
|
|
304
|
+
*
|
|
305
|
+
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
306
|
+
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
307
|
+
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
308
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if message is not in the list (only used if addIfDoesNotExist is true)
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
}, {
|
|
266
312
|
key: "addMessageSorted",
|
|
267
313
|
value: function addMessageSorted(newMessage) {
|
|
268
314
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
269
315
|
var addIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
270
|
-
|
|
316
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'latest';
|
|
317
|
+
return this.addMessagesSorted([newMessage], timestampChanged, false, addIfDoesNotExist, messageSetToAddToIfDoesNotExist);
|
|
271
318
|
}
|
|
272
319
|
/**
|
|
273
320
|
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
@@ -299,6 +346,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
299
346
|
* @param {boolean} timestampChanged Whether updating messages with changed created_at value.
|
|
300
347
|
* @param {boolean} initializing Whether channel is being initialized.
|
|
301
348
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
349
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if messages are not in the list (only used if addIfDoesNotExist is true)
|
|
302
350
|
*
|
|
303
351
|
*/
|
|
304
352
|
|
|
@@ -308,48 +356,63 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
308
356
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
309
357
|
var initializing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
310
358
|
var addIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
359
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'current';
|
|
311
360
|
|
|
312
|
-
|
|
313
|
-
|
|
361
|
+
var _this$findTargetMessa = this.findTargetMessageSet(newMessages, addIfDoesNotExist, messageSetToAddToIfDoesNotExist),
|
|
362
|
+
messagesToAdd = _this$findTargetMessa.messagesToAdd,
|
|
363
|
+
targetMessageSetIndex = _this$findTargetMessa.targetMessageSetIndex;
|
|
314
364
|
|
|
315
|
-
|
|
365
|
+
for (var i = 0; i < messagesToAdd.length; i += 1) {
|
|
366
|
+
var isFromShadowBannedUser = messagesToAdd[i].shadowed;
|
|
316
367
|
|
|
317
368
|
if (isFromShadowBannedUser) {
|
|
318
369
|
continue;
|
|
319
|
-
}
|
|
370
|
+
} // If message is already formatted we can skip the tasks below
|
|
371
|
+
// This will be true for messages that are already present at the state -> this happens when we perform merging of message sets
|
|
372
|
+
// This will be also true for message previews used by some SDKs
|
|
320
373
|
|
|
321
|
-
var message = this.formatMessage(newMessages[i]);
|
|
322
374
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
* Store the reference to user for this channel, so that when we have to
|
|
326
|
-
* handle updates to user, we can use the reference map, to determine which
|
|
327
|
-
* channels need to be updated with updated user object.
|
|
328
|
-
*/
|
|
329
|
-
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
330
|
-
}
|
|
375
|
+
var isMessageFormatted = messagesToAdd[i].created_at instanceof Date;
|
|
376
|
+
var message = void 0;
|
|
331
377
|
|
|
332
|
-
if (
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
// and consumer can refetch the replies.
|
|
337
|
-
delete this.threads[message.id];
|
|
338
|
-
}
|
|
378
|
+
if (isMessageFormatted) {
|
|
379
|
+
message = messagesToAdd[i];
|
|
380
|
+
} else {
|
|
381
|
+
var _this$_channel;
|
|
339
382
|
|
|
340
|
-
|
|
341
|
-
this.last_message_at = new Date(message.created_at.getTime());
|
|
342
|
-
}
|
|
383
|
+
message = this.formatMessage(messagesToAdd[i]);
|
|
343
384
|
|
|
344
|
-
|
|
345
|
-
|
|
385
|
+
if (message.user && (_this$_channel = this._channel) !== null && _this$_channel !== void 0 && _this$_channel.cid) {
|
|
386
|
+
/**
|
|
387
|
+
* Store the reference to user for this channel, so that when we have to
|
|
388
|
+
* handle updates to user, we can use the reference map, to determine which
|
|
389
|
+
* channels need to be updated with updated user object.
|
|
390
|
+
*/
|
|
391
|
+
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (initializing && message.id && this.threads[message.id]) {
|
|
395
|
+
// If we are initializing the state of channel (e.g., in case of connection recovery),
|
|
396
|
+
// then in that case we remove thread related to this message from threads object.
|
|
397
|
+
// This way we can ensure that we don't have any stale data in thread object
|
|
398
|
+
// and consumer can refetch the replies.
|
|
399
|
+
delete this.threads[message.id];
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (!this.last_message_at) {
|
|
403
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (message.created_at.getTime() > this.last_message_at.getTime()) {
|
|
407
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
408
|
+
}
|
|
346
409
|
} // update or append the messages...
|
|
347
410
|
|
|
348
411
|
|
|
349
|
-
var parentID = message.parent_id; // add to the
|
|
412
|
+
var parentID = message.parent_id; // add to the given message set
|
|
350
413
|
|
|
351
|
-
if (!parentID || message.show_in_channel) {
|
|
352
|
-
this.messages = this._addToMessageList(this.messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
414
|
+
if ((!parentID || message.show_in_channel) && targetMessageSetIndex !== -1) {
|
|
415
|
+
this.messageSets[targetMessageSetIndex].messages = this._addToMessageList(this.messageSets[targetMessageSetIndex].messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
353
416
|
}
|
|
354
417
|
/**
|
|
355
418
|
* Add message to thread if applicable and the message
|
|
@@ -473,6 +536,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
473
536
|
}, {
|
|
474
537
|
key: "removeQuotedMessageReferences",
|
|
475
538
|
value: function removeQuotedMessageReferences(message) {
|
|
539
|
+
var _this4 = this;
|
|
540
|
+
|
|
476
541
|
var parseMessage = function parseMessage(m) {
|
|
477
542
|
var _m$pinned_at, _m$updated_at;
|
|
478
543
|
|
|
@@ -483,16 +548,19 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
483
548
|
});
|
|
484
549
|
};
|
|
485
550
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
551
|
+
this.messageSets.forEach(function (set) {
|
|
552
|
+
var updatedMessages = set.messages.filter(function (msg) {
|
|
553
|
+
return msg.quoted_message_id === message.id;
|
|
554
|
+
}).map(parseMessage).map(function (msg) {
|
|
555
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
556
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
557
|
+
attachments: []
|
|
558
|
+
})
|
|
559
|
+
});
|
|
493
560
|
});
|
|
561
|
+
|
|
562
|
+
_this4.addMessagesSorted(updatedMessages, true);
|
|
494
563
|
});
|
|
495
|
-
this.addMessagesSorted(updatedMessages, true);
|
|
496
564
|
}
|
|
497
565
|
/**
|
|
498
566
|
* Updates all instances of given message in channel state
|
|
@@ -520,12 +588,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
520
588
|
}
|
|
521
589
|
|
|
522
590
|
if (!show_in_channel && !parent_id || show_in_channel) {
|
|
523
|
-
var
|
|
524
|
-
|
|
525
|
-
|
|
591
|
+
var messageSetIndex = this.findMessageSetIndex(message);
|
|
592
|
+
|
|
593
|
+
if (messageSetIndex !== -1) {
|
|
594
|
+
var _msgIndex = this.messageSets[messageSetIndex].messages.findIndex(function (msg) {
|
|
595
|
+
return msg.id === message.id;
|
|
596
|
+
});
|
|
526
597
|
|
|
527
|
-
|
|
528
|
-
|
|
598
|
+
if (_msgIndex !== -1) {
|
|
599
|
+
this.messageSets[messageSetIndex].messages[_msgIndex] = updateFunc(this.messageSets[messageSetIndex].messages[_msgIndex]);
|
|
600
|
+
}
|
|
529
601
|
}
|
|
530
602
|
}
|
|
531
603
|
|
|
@@ -644,12 +716,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
644
716
|
this.threads[messageToRemove.parent_id] = threadMessages;
|
|
645
717
|
isRemoved = removed;
|
|
646
718
|
} else {
|
|
647
|
-
var
|
|
648
|
-
_removed = _this$removeMessageFr3.removed,
|
|
649
|
-
messages = _this$removeMessageFr3.result;
|
|
719
|
+
var messageSetIndex = this.findMessageSetIndex(messageToRemove);
|
|
650
720
|
|
|
651
|
-
|
|
652
|
-
|
|
721
|
+
if (messageSetIndex !== -1) {
|
|
722
|
+
var _this$removeMessageFr3 = this.removeMessageFromArray(this.messageSets[messageSetIndex].messages, messageToRemove),
|
|
723
|
+
_removed = _this$removeMessageFr3.removed,
|
|
724
|
+
messages = _this$removeMessageFr3.result;
|
|
725
|
+
|
|
726
|
+
this.messageSets[messageSetIndex].messages = messages;
|
|
727
|
+
isRemoved = _removed;
|
|
728
|
+
}
|
|
653
729
|
}
|
|
654
730
|
|
|
655
731
|
return isRemoved;
|
|
@@ -662,10 +738,10 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
662
738
|
*
|
|
663
739
|
*/
|
|
664
740
|
function filterErrorMessages() {
|
|
665
|
-
var filteredMessages = this.
|
|
741
|
+
var filteredMessages = this.latestMessages.filter(function (message) {
|
|
666
742
|
return message.type !== 'error';
|
|
667
743
|
});
|
|
668
|
-
this.
|
|
744
|
+
this.latestMessages = filteredMessages;
|
|
669
745
|
}
|
|
670
746
|
/**
|
|
671
747
|
* clean - Remove stale data such as users that stayed in typing state for more than 5 seconds
|
|
@@ -699,9 +775,250 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
699
775
|
}, {
|
|
700
776
|
key: "clearMessages",
|
|
701
777
|
value: function clearMessages() {
|
|
702
|
-
this.
|
|
778
|
+
this.initMessages();
|
|
703
779
|
this.pinnedMessages = [];
|
|
704
780
|
}
|
|
781
|
+
}, {
|
|
782
|
+
key: "initMessages",
|
|
783
|
+
value: function initMessages() {
|
|
784
|
+
this.messageSets = [{
|
|
785
|
+
messages: [],
|
|
786
|
+
isLatest: true,
|
|
787
|
+
isCurrent: true
|
|
788
|
+
}];
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* loadMessageIntoState - Loads a given message (and messages around it) into the state
|
|
792
|
+
*
|
|
793
|
+
* @param {string} messageId The id of the message, or 'latest' to indicate switching to the latest messages
|
|
794
|
+
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply
|
|
795
|
+
*/
|
|
796
|
+
|
|
797
|
+
}, {
|
|
798
|
+
key: "loadMessageIntoState",
|
|
799
|
+
value: function () {
|
|
800
|
+
var _loadMessageIntoState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(messageId, parentMessageId) {
|
|
801
|
+
var _this$threads$parentM;
|
|
802
|
+
|
|
803
|
+
var messageSetIndex, switchedToMessageSet, loadedMessageThread, messageIdToFind;
|
|
804
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
805
|
+
while (1) {
|
|
806
|
+
switch (_context.prev = _context.next) {
|
|
807
|
+
case 0:
|
|
808
|
+
switchedToMessageSet = false;
|
|
809
|
+
loadedMessageThread = false;
|
|
810
|
+
messageIdToFind = parentMessageId || messageId;
|
|
811
|
+
|
|
812
|
+
if (!(messageId === 'latest')) {
|
|
813
|
+
_context.next = 9;
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (!(this.messages === this.latestMessages)) {
|
|
818
|
+
_context.next = 6;
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
return _context.abrupt("return");
|
|
823
|
+
|
|
824
|
+
case 6:
|
|
825
|
+
messageSetIndex = this.messageSets.findIndex(function (s) {
|
|
826
|
+
return s.isLatest;
|
|
827
|
+
});
|
|
828
|
+
_context.next = 10;
|
|
829
|
+
break;
|
|
830
|
+
|
|
831
|
+
case 9:
|
|
832
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
833
|
+
id: messageIdToFind
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
case 10:
|
|
837
|
+
if (messageSetIndex !== -1) {
|
|
838
|
+
this.switchToMessageSet(messageSetIndex);
|
|
839
|
+
switchedToMessageSet = true;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
loadedMessageThread = !parentMessageId || !!((_this$threads$parentM = this.threads[parentMessageId]) !== null && _this$threads$parentM !== void 0 && _this$threads$parentM.find(function (m) {
|
|
843
|
+
return m.id === messageId;
|
|
844
|
+
}));
|
|
845
|
+
|
|
846
|
+
if (!(switchedToMessageSet && loadedMessageThread)) {
|
|
847
|
+
_context.next = 14;
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
return _context.abrupt("return");
|
|
852
|
+
|
|
853
|
+
case 14:
|
|
854
|
+
if (switchedToMessageSet) {
|
|
855
|
+
_context.next = 17;
|
|
856
|
+
break;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
_context.next = 17;
|
|
860
|
+
return this._channel.query({
|
|
861
|
+
messages: {
|
|
862
|
+
id_around: messageIdToFind,
|
|
863
|
+
limit: 25
|
|
864
|
+
}
|
|
865
|
+
}, 'new');
|
|
866
|
+
|
|
867
|
+
case 17:
|
|
868
|
+
if (!(!loadedMessageThread && parentMessageId)) {
|
|
869
|
+
_context.next = 20;
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
_context.next = 20;
|
|
874
|
+
return this._channel.getReplies(parentMessageId, {
|
|
875
|
+
id_around: messageId,
|
|
876
|
+
limit: 25
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
case 20:
|
|
880
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
881
|
+
id: messageIdToFind
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
if (messageSetIndex !== -1) {
|
|
885
|
+
this.switchToMessageSet(messageSetIndex);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
case 22:
|
|
889
|
+
case "end":
|
|
890
|
+
return _context.stop();
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}, _callee, this);
|
|
894
|
+
}));
|
|
895
|
+
|
|
896
|
+
function loadMessageIntoState(_x, _x2) {
|
|
897
|
+
return _loadMessageIntoState.apply(this, arguments);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
return loadMessageIntoState;
|
|
901
|
+
}()
|
|
902
|
+
}, {
|
|
903
|
+
key: "switchToMessageSet",
|
|
904
|
+
value: function switchToMessageSet(index) {
|
|
905
|
+
var currentMessages = this.messageSets.find(function (s) {
|
|
906
|
+
return s.isCurrent;
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
if (!currentMessages) {
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
currentMessages.isCurrent = false;
|
|
914
|
+
this.messageSets[index].isCurrent = true;
|
|
915
|
+
}
|
|
916
|
+
}, {
|
|
917
|
+
key: "areMessageSetsOverlap",
|
|
918
|
+
value: function areMessageSetsOverlap(messages1, messages2) {
|
|
919
|
+
return messages1.some(function (m1) {
|
|
920
|
+
return messages2.find(function (m2) {
|
|
921
|
+
return m1.id === m2.id;
|
|
922
|
+
});
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
}, {
|
|
926
|
+
key: "findMessageSetIndex",
|
|
927
|
+
value: function findMessageSetIndex(message) {
|
|
928
|
+
return this.messageSets.findIndex(function (set) {
|
|
929
|
+
return !!set.messages.find(function (m) {
|
|
930
|
+
return m.id === message.id;
|
|
931
|
+
});
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
}, {
|
|
935
|
+
key: "findTargetMessageSet",
|
|
936
|
+
value: function findTargetMessageSet(newMessages) {
|
|
937
|
+
var _this5 = this;
|
|
938
|
+
|
|
939
|
+
var addIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
940
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'current';
|
|
941
|
+
var messagesToAdd = newMessages;
|
|
942
|
+
var targetMessageSetIndex;
|
|
943
|
+
|
|
944
|
+
if (addIfDoesNotExist) {
|
|
945
|
+
var overlappingMessageSetIndices = this.messageSets.map(function (_, i) {
|
|
946
|
+
return i;
|
|
947
|
+
}).filter(function (i) {
|
|
948
|
+
return _this5.areMessageSetsOverlap(_this5.messageSets[i].messages, newMessages);
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
switch (messageSetToAddToIfDoesNotExist) {
|
|
952
|
+
case 'new':
|
|
953
|
+
if (overlappingMessageSetIndices.length > 0) {
|
|
954
|
+
targetMessageSetIndex = overlappingMessageSetIndices[0]; // No new message set is created if newMessages only contains thread replies
|
|
955
|
+
} else if (newMessages.some(function (m) {
|
|
956
|
+
return !m.parent_id;
|
|
957
|
+
})) {
|
|
958
|
+
this.messageSets.push({
|
|
959
|
+
messages: [],
|
|
960
|
+
isCurrent: false,
|
|
961
|
+
isLatest: false
|
|
962
|
+
});
|
|
963
|
+
targetMessageSetIndex = this.messageSets.length - 1;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
break;
|
|
967
|
+
|
|
968
|
+
case 'current':
|
|
969
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
970
|
+
return s.isCurrent;
|
|
971
|
+
});
|
|
972
|
+
break;
|
|
973
|
+
|
|
974
|
+
case 'latest':
|
|
975
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
976
|
+
return s.isLatest;
|
|
977
|
+
});
|
|
978
|
+
break;
|
|
979
|
+
|
|
980
|
+
default:
|
|
981
|
+
targetMessageSetIndex = -1;
|
|
982
|
+
} // when merging the target set will be the first one from the overlapping message sets
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
986
|
+
|
|
987
|
+
var mergeSourceMessageSetIndices = _toConsumableArray(overlappingMessageSetIndices);
|
|
988
|
+
|
|
989
|
+
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
990
|
+
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
991
|
+
} // merge message sets
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
if (mergeSourceMessageSetIndices.length > 0) {
|
|
995
|
+
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
996
|
+
var sources = this.messageSets.filter(function (_, i) {
|
|
997
|
+
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
998
|
+
});
|
|
999
|
+
sources.forEach(function (messageSet) {
|
|
1000
|
+
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1001
|
+
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1002
|
+
messagesToAdd = [].concat(_toConsumableArray(messagesToAdd), _toConsumableArray(messageSet.messages));
|
|
1003
|
+
});
|
|
1004
|
+
sources.forEach(function (s) {
|
|
1005
|
+
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1006
|
+
});
|
|
1007
|
+
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1008
|
+
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1009
|
+
});
|
|
1010
|
+
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1011
|
+
}
|
|
1012
|
+
} else {
|
|
1013
|
+
// assumes that all new messages belong to the same set
|
|
1014
|
+
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
return {
|
|
1018
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1019
|
+
messagesToAdd: messagesToAdd
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
705
1022
|
}]);
|
|
706
1023
|
|
|
707
1024
|
return ChannelState;
|
|
@@ -1064,7 +1381,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1064
1381
|
presence: false
|
|
1065
1382
|
};
|
|
1066
1383
|
_context.next = 3;
|
|
1067
|
-
return _this.query(options);
|
|
1384
|
+
return _this.query(options, 'latest');
|
|
1068
1385
|
|
|
1069
1386
|
case 3:
|
|
1070
1387
|
return _context.abrupt("return", _context.sent);
|
|
@@ -2362,14 +2679,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2362
2679
|
value: function lastMessage() {
|
|
2363
2680
|
// get last 5 messages, sort, return the latest
|
|
2364
2681
|
// get a slice of the last 5
|
|
2365
|
-
var min = this.state.
|
|
2682
|
+
var min = this.state.latestMessages.length - 5;
|
|
2366
2683
|
|
|
2367
2684
|
if (min < 0) {
|
|
2368
2685
|
min = 0;
|
|
2369
2686
|
}
|
|
2370
2687
|
|
|
2371
|
-
var max = this.state.
|
|
2372
|
-
var messageSlice = this.state.
|
|
2688
|
+
var max = this.state.latestMessages.length + 1;
|
|
2689
|
+
var messageSlice = this.state.latestMessages.slice(min, max); // sort by pk desc
|
|
2373
2690
|
|
|
2374
2691
|
messageSlice.sort(function (a, b) {
|
|
2375
2692
|
return b.created_at.getTime() - a.created_at.getTime();
|
|
@@ -2478,7 +2795,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2478
2795
|
|
|
2479
2796
|
combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
|
|
2480
2797
|
_context27.next = 7;
|
|
2481
|
-
return this.query(combined);
|
|
2798
|
+
return this.query(combined, 'latest');
|
|
2482
2799
|
|
|
2483
2800
|
case 7:
|
|
2484
2801
|
state = _context27.sent;
|
|
@@ -2552,7 +2869,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2552
2869
|
* getReplies - List the message replies for a parent message
|
|
2553
2870
|
*
|
|
2554
2871
|
* @param {string} parent_id The message parent id, ie the top of the thread
|
|
2555
|
-
* @param {
|
|
2872
|
+
* @param {MessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2556
2873
|
*
|
|
2557
2874
|
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2558
2875
|
*/
|
|
@@ -2713,8 +3030,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2713
3030
|
if (!lastRead) return this.state.unreadCount;
|
|
2714
3031
|
var count = 0;
|
|
2715
3032
|
|
|
2716
|
-
for (var i = 0; i < this.state.
|
|
2717
|
-
var message = this.state.
|
|
3033
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
3034
|
+
var message = this.state.latestMessages[i];
|
|
2718
3035
|
|
|
2719
3036
|
if (message.created_at > lastRead && this._countMessageAsUnread(message)) {
|
|
2720
3037
|
count++;
|
|
@@ -2724,7 +3041,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2724
3041
|
return count;
|
|
2725
3042
|
}
|
|
2726
3043
|
/**
|
|
2727
|
-
*
|
|
3044
|
+
* countUnreadMentions - Count the number of unread messages mentioning the current user
|
|
2728
3045
|
*
|
|
2729
3046
|
* @return {number} Unread mentions count
|
|
2730
3047
|
*/
|
|
@@ -2736,10 +3053,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2736
3053
|
var userID = this.getClient().userID;
|
|
2737
3054
|
var count = 0;
|
|
2738
3055
|
|
|
2739
|
-
for (var i = 0; i < this.state.
|
|
3056
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
2740
3057
|
var _message$mentioned_us;
|
|
2741
3058
|
|
|
2742
|
-
var message = this.state.
|
|
3059
|
+
var message = this.state.latestMessages[i];
|
|
2743
3060
|
|
|
2744
3061
|
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) {
|
|
2745
3062
|
return user.id === userID;
|
|
@@ -2763,33 +3080,40 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2763
3080
|
* query - Query the API, get messages, members or other channel fields
|
|
2764
3081
|
*
|
|
2765
3082
|
* @param {ChannelQueryOptions<StreamChatGenerics>} options The query options
|
|
3083
|
+
* @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
|
|
2766
3084
|
*
|
|
2767
3085
|
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} Returns a query response
|
|
2768
3086
|
*/
|
|
2769
3087
|
function () {
|
|
2770
3088
|
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(options) {
|
|
2771
|
-
var
|
|
3089
|
+
var messageSetToAddToIfDoesNotExist,
|
|
3090
|
+
queryURL,
|
|
3091
|
+
state,
|
|
3092
|
+
membersStr,
|
|
3093
|
+
tempChannelCid,
|
|
3094
|
+
_args31 = arguments;
|
|
2772
3095
|
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
2773
3096
|
while (1) {
|
|
2774
3097
|
switch (_context31.prev = _context31.next) {
|
|
2775
3098
|
case 0:
|
|
2776
|
-
|
|
3099
|
+
messageSetToAddToIfDoesNotExist = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : 'current';
|
|
3100
|
+
_context31.next = 3;
|
|
2777
3101
|
return this.getClient().wsPromise;
|
|
2778
3102
|
|
|
2779
|
-
case
|
|
3103
|
+
case 3:
|
|
2780
3104
|
queryURL = "".concat(this.getClient().baseURL, "/channels/").concat(this.type);
|
|
2781
3105
|
|
|
2782
3106
|
if (this.id) {
|
|
2783
3107
|
queryURL += "/".concat(this.id);
|
|
2784
3108
|
}
|
|
2785
3109
|
|
|
2786
|
-
_context31.next =
|
|
3110
|
+
_context31.next = 7;
|
|
2787
3111
|
return this.getClient().post(queryURL + '/query', _objectSpread$5({
|
|
2788
3112
|
data: this._data,
|
|
2789
3113
|
state: true
|
|
2790
3114
|
}, options));
|
|
2791
3115
|
|
|
2792
|
-
case
|
|
3116
|
+
case 7:
|
|
2793
3117
|
state = _context31.sent;
|
|
2794
3118
|
|
|
2795
3119
|
// update the channel id if it was missing
|
|
@@ -2818,11 +3142,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2818
3142
|
this.getClient()._addChannelConfig(state); // add any messages to our channel state
|
|
2819
3143
|
|
|
2820
3144
|
|
|
2821
|
-
this._initializeState(state);
|
|
3145
|
+
this._initializeState(state, messageSetToAddToIfDoesNotExist);
|
|
2822
3146
|
|
|
2823
3147
|
return _context31.abrupt("return", state);
|
|
2824
3148
|
|
|
2825
|
-
case
|
|
3149
|
+
case 12:
|
|
2826
3150
|
case "end":
|
|
2827
3151
|
return _context31.stop();
|
|
2828
3152
|
}
|
|
@@ -3372,6 +3696,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3372
3696
|
}, {
|
|
3373
3697
|
key: "_initializeState",
|
|
3374
3698
|
value: function _initializeState(state) {
|
|
3699
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'latest';
|
|
3700
|
+
|
|
3375
3701
|
var _this$getClient2 = this.getClient(),
|
|
3376
3702
|
clientState = _this$getClient2.state,
|
|
3377
3703
|
user = _this$getClient2.user,
|
|
@@ -3401,10 +3727,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3401
3727
|
var messages = state.messages || [];
|
|
3402
3728
|
|
|
3403
3729
|
if (!this.state.messages) {
|
|
3404
|
-
this.state.
|
|
3730
|
+
this.state.initMessages();
|
|
3405
3731
|
}
|
|
3406
3732
|
|
|
3407
|
-
this.state.addMessagesSorted(messages, false, true);
|
|
3733
|
+
this.state.addMessagesSorted(messages, false, true, true, messageSetToAddToIfDoesNotExist);
|
|
3408
3734
|
|
|
3409
3735
|
if (!this.state.pinnedMessages) {
|
|
3410
3736
|
this.state.pinnedMessages = [];
|
|
@@ -4826,7 +5152,7 @@ function TokenManager(secret) {
|
|
|
4826
5152
|
_defineProperty(this, "loadToken", function () {
|
|
4827
5153
|
// eslint-disable-next-line no-async-promise-executor
|
|
4828
5154
|
_this.loadTokenPromise = new Promise( /*#__PURE__*/function () {
|
|
4829
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
|
|
5155
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve, reject) {
|
|
4830
5156
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
4831
5157
|
while (1) {
|
|
4832
5158
|
switch (_context2.prev = _context2.next) {
|
|
@@ -4840,26 +5166,36 @@ function TokenManager(secret) {
|
|
|
4840
5166
|
|
|
4841
5167
|
case 2:
|
|
4842
5168
|
if (!(_this.tokenProvider && typeof _this.tokenProvider !== 'string')) {
|
|
4843
|
-
_context2.next =
|
|
5169
|
+
_context2.next = 13;
|
|
4844
5170
|
break;
|
|
4845
5171
|
}
|
|
4846
5172
|
|
|
4847
|
-
_context2.
|
|
5173
|
+
_context2.prev = 3;
|
|
5174
|
+
_context2.next = 6;
|
|
4848
5175
|
return _this.tokenProvider();
|
|
4849
5176
|
|
|
4850
|
-
case
|
|
5177
|
+
case 6:
|
|
4851
5178
|
_this.token = _context2.sent;
|
|
5179
|
+
_context2.next = 12;
|
|
5180
|
+
break;
|
|
5181
|
+
|
|
5182
|
+
case 9:
|
|
5183
|
+
_context2.prev = 9;
|
|
5184
|
+
_context2.t0 = _context2["catch"](3);
|
|
5185
|
+
return _context2.abrupt("return", reject(new Error("Call to tokenProvider failed with message: ".concat(_context2.t0))));
|
|
5186
|
+
|
|
5187
|
+
case 12:
|
|
4852
5188
|
resolve(_this.token);
|
|
4853
5189
|
|
|
4854
|
-
case
|
|
5190
|
+
case 13:
|
|
4855
5191
|
case "end":
|
|
4856
5192
|
return _context2.stop();
|
|
4857
5193
|
}
|
|
4858
5194
|
}
|
|
4859
|
-
}, _callee2);
|
|
5195
|
+
}, _callee2, null, [[3, 9]]);
|
|
4860
5196
|
}));
|
|
4861
5197
|
|
|
4862
|
-
return function (_x3) {
|
|
5198
|
+
return function (_x3, _x4) {
|
|
4863
5199
|
return _ref2.apply(this, arguments);
|
|
4864
5200
|
};
|
|
4865
5201
|
}());
|
|
@@ -6369,30 +6705,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6369
6705
|
key: "updateAppSettings",
|
|
6370
6706
|
value:
|
|
6371
6707
|
/**
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6708
|
+
* updateAppSettings - updates application settings
|
|
6709
|
+
*
|
|
6710
|
+
* @param {AppSettings} options App settings.
|
|
6711
|
+
* IE: {
|
|
6712
|
+
'apn_config': {
|
|
6713
|
+
'auth_type': 'token',
|
|
6714
|
+
'auth_key": fs.readFileSync(
|
|
6715
|
+
'./apn-push-auth-key.p8',
|
|
6716
|
+
'utf-8',
|
|
6717
|
+
),
|
|
6718
|
+
'key_id': 'keyid',
|
|
6719
|
+
'team_id': 'teamid',
|
|
6720
|
+
'notification_template": 'notification handlebars template',
|
|
6721
|
+
'bundle_id': 'com.apple.your.app',
|
|
6722
|
+
'development': true
|
|
6723
|
+
},
|
|
6724
|
+
'firebase_config': {
|
|
6725
|
+
'server_key': 'server key from fcm',
|
|
6726
|
+
'notification_template': 'notification handlebars template',
|
|
6727
|
+
'data_template': 'data handlebars template',
|
|
6728
|
+
'apn_template': 'apn notification handlebars template under v2'
|
|
6729
|
+
},
|
|
6730
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
6731
|
+
}
|
|
6732
|
+
*/
|
|
6396
6733
|
function () {
|
|
6397
6734
|
var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(options) {
|
|
6398
6735
|
var _options$apn_config;
|
|
@@ -6583,17 +6920,19 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6583
6920
|
return getAppSettings;
|
|
6584
6921
|
}()
|
|
6585
6922
|
/**
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6923
|
+
* testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
|
|
6924
|
+
*
|
|
6925
|
+
* @param {string} userID User ID. If user has no devices, it will error
|
|
6926
|
+
* @param {TestPushDataInput} [data] Overrides for push templates/message used
|
|
6927
|
+
* IE: {
|
|
6928
|
+
messageID: 'id-of-message', // will error if message does not exist
|
|
6929
|
+
apnTemplate: '{}', // if app doesn't have apn configured it will error
|
|
6930
|
+
firebaseTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6931
|
+
firebaseDataTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6932
|
+
skipDevices: true, // skip config/device checks and sending to real devices
|
|
6933
|
+
pushProviderName: 'staging' // one of your configured push providers
|
|
6934
|
+
pushProviderType: 'apn' // one of supported provider types
|
|
6935
|
+
}
|
|
6597
6936
|
*/
|
|
6598
6937
|
|
|
6599
6938
|
}, {
|
|
@@ -6608,7 +6947,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6608
6947
|
case 0:
|
|
6609
6948
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
6610
6949
|
_context12.next = 3;
|
|
6611
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6950
|
+
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6612
6951
|
user_id: userID
|
|
6613
6952
|
}, data.messageID ? {
|
|
6614
6953
|
message_id: data.messageID
|
|
@@ -6620,6 +6959,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6620
6959
|
firebase_data_template: data.firebaseDataTemplate
|
|
6621
6960
|
} : {}), data.skipDevices ? {
|
|
6622
6961
|
skip_devices: true
|
|
6962
|
+
} : {}), data.pushProviderName ? {
|
|
6963
|
+
push_provider_name: data.pushProviderName
|
|
6964
|
+
} : {}), data.pushProviderType ? {
|
|
6965
|
+
push_provider_type: data.pushProviderType
|
|
6623
6966
|
} : {}));
|
|
6624
6967
|
|
|
6625
6968
|
case 3:
|
|
@@ -6643,11 +6986,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6643
6986
|
* testSQSSettings - Tests that the given or configured SQS configuration is valid
|
|
6644
6987
|
*
|
|
6645
6988
|
* @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
|
|
6646
|
-
*
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6989
|
+
* IE: {
|
|
6990
|
+
sqs_key: 'auth_key',
|
|
6991
|
+
sqs_secret: 'auth_secret',
|
|
6992
|
+
sqs_url: 'url_to_queue',
|
|
6993
|
+
}
|
|
6651
6994
|
*/
|
|
6652
6995
|
|
|
6653
6996
|
}, {
|
|
@@ -7002,7 +7345,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7002
7345
|
this.mutedUsers = event.me.mutes;
|
|
7003
7346
|
}
|
|
7004
7347
|
|
|
7005
|
-
if (event.type === 'notification.mark_read') {
|
|
7348
|
+
if (event.type === 'notification.mark_read' && event.unread_channels === 0) {
|
|
7006
7349
|
var activeChannelKeys = Object.keys(this.activeChannels);
|
|
7007
7350
|
activeChannelKeys.forEach(function (activeChannelKey) {
|
|
7008
7351
|
return _this3.activeChannels[activeChannelKey].state.unreadCount = 0;
|
|
@@ -7444,11 +7787,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7444
7787
|
c.initialized = true;
|
|
7445
7788
|
|
|
7446
7789
|
if (skipInitialization === undefined) {
|
|
7447
|
-
c._initializeState(_channelState);
|
|
7790
|
+
c._initializeState(_channelState, 'latest');
|
|
7448
7791
|
} else if (!skipInitialization.includes(_channelState.channel.id)) {
|
|
7449
7792
|
c.state.clearMessages();
|
|
7450
7793
|
|
|
7451
|
-
c._initializeState(_channelState);
|
|
7794
|
+
c._initializeState(_channelState, 'latest');
|
|
7452
7795
|
}
|
|
7453
7796
|
|
|
7454
7797
|
channels.push(c);
|
|
@@ -7585,23 +7928,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7585
7928
|
* @param {string} id the device id
|
|
7586
7929
|
* @param {PushProvider} push_provider the push provider
|
|
7587
7930
|
* @param {string} [userID] the user id (defaults to current user)
|
|
7931
|
+
* @param {string} [push_provider_name] user provided push provider name for multi bundle support
|
|
7588
7932
|
*
|
|
7589
7933
|
*/
|
|
7590
7934
|
|
|
7591
7935
|
}, {
|
|
7592
7936
|
key: "addDevice",
|
|
7593
7937
|
value: function () {
|
|
7594
|
-
var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(id, push_provider, userID) {
|
|
7938
|
+
var _addDevice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(id, push_provider, userID, push_provider_name) {
|
|
7595
7939
|
return _regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
7596
7940
|
while (1) {
|
|
7597
7941
|
switch (_context21.prev = _context21.next) {
|
|
7598
7942
|
case 0:
|
|
7599
7943
|
_context21.next = 2;
|
|
7600
|
-
return this.post(this.baseURL + '/devices', _objectSpread({
|
|
7944
|
+
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
7601
7945
|
id: id,
|
|
7602
7946
|
push_provider: push_provider
|
|
7603
7947
|
}, userID != null ? {
|
|
7604
7948
|
user_id: userID
|
|
7949
|
+
} : {}), push_provider_name != null ? {
|
|
7950
|
+
push_provider_name: push_provider_name
|
|
7605
7951
|
} : {}));
|
|
7606
7952
|
|
|
7607
7953
|
case 2:
|
|
@@ -7615,7 +7961,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7615
7961
|
}, _callee21, this);
|
|
7616
7962
|
}));
|
|
7617
7963
|
|
|
7618
|
-
function addDevice(_x20, _x21, _x22) {
|
|
7964
|
+
function addDevice(_x20, _x21, _x22, _x23) {
|
|
7619
7965
|
return _addDevice.apply(this, arguments);
|
|
7620
7966
|
}
|
|
7621
7967
|
|
|
@@ -7653,7 +7999,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7653
7999
|
}, _callee22, this);
|
|
7654
8000
|
}));
|
|
7655
8001
|
|
|
7656
|
-
function getDevices(
|
|
8002
|
+
function getDevices(_x24) {
|
|
7657
8003
|
return _getDevices.apply(this, arguments);
|
|
7658
8004
|
}
|
|
7659
8005
|
|
|
@@ -7693,7 +8039,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7693
8039
|
}, _callee23, this);
|
|
7694
8040
|
}));
|
|
7695
8041
|
|
|
7696
|
-
function removeDevice(
|
|
8042
|
+
function removeDevice(_x25, _x26) {
|
|
7697
8043
|
return _removeDevice.apply(this, arguments);
|
|
7698
8044
|
}
|
|
7699
8045
|
|
|
@@ -7734,7 +8080,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7734
8080
|
}, _callee24, this);
|
|
7735
8081
|
}));
|
|
7736
8082
|
|
|
7737
|
-
function getRateLimits(
|
|
8083
|
+
function getRateLimits(_x27) {
|
|
7738
8084
|
return _getRateLimits.apply(this, arguments);
|
|
7739
8085
|
}
|
|
7740
8086
|
|
|
@@ -7835,7 +8181,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7835
8181
|
}, _callee25, this);
|
|
7836
8182
|
}));
|
|
7837
8183
|
|
|
7838
|
-
function partialUpdateUser(
|
|
8184
|
+
function partialUpdateUser(_x28) {
|
|
7839
8185
|
return _partialUpdateUser.apply(this, arguments);
|
|
7840
8186
|
}
|
|
7841
8187
|
|
|
@@ -7921,7 +8267,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7921
8267
|
}, _callee26, this, [[2, 13, 16, 19]]);
|
|
7922
8268
|
}));
|
|
7923
8269
|
|
|
7924
|
-
function upsertUsers(
|
|
8270
|
+
function upsertUsers(_x29) {
|
|
7925
8271
|
return _upsertUsers.apply(this, arguments);
|
|
7926
8272
|
}
|
|
7927
8273
|
|
|
@@ -8034,7 +8380,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8034
8380
|
}, _callee27, this, [[1, 11, 14, 17]]);
|
|
8035
8381
|
}));
|
|
8036
8382
|
|
|
8037
|
-
function partialUpdateUsers(
|
|
8383
|
+
function partialUpdateUsers(_x30) {
|
|
8038
8384
|
return _partialUpdateUsers.apply(this, arguments);
|
|
8039
8385
|
}
|
|
8040
8386
|
|
|
@@ -8062,7 +8408,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8062
8408
|
}, _callee28, this);
|
|
8063
8409
|
}));
|
|
8064
8410
|
|
|
8065
|
-
function deleteUser(
|
|
8411
|
+
function deleteUser(_x31, _x32) {
|
|
8066
8412
|
return _deleteUser.apply(this, arguments);
|
|
8067
8413
|
}
|
|
8068
8414
|
|
|
@@ -8090,7 +8436,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8090
8436
|
}, _callee29, this);
|
|
8091
8437
|
}));
|
|
8092
8438
|
|
|
8093
|
-
function reactivateUser(
|
|
8439
|
+
function reactivateUser(_x33, _x34) {
|
|
8094
8440
|
return _reactivateUser.apply(this, arguments);
|
|
8095
8441
|
}
|
|
8096
8442
|
|
|
@@ -8118,7 +8464,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8118
8464
|
}, _callee30, this);
|
|
8119
8465
|
}));
|
|
8120
8466
|
|
|
8121
|
-
function deactivateUser(
|
|
8467
|
+
function deactivateUser(_x35, _x36) {
|
|
8122
8468
|
return _deactivateUser.apply(this, arguments);
|
|
8123
8469
|
}
|
|
8124
8470
|
|
|
@@ -8146,7 +8492,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8146
8492
|
}, _callee31, this);
|
|
8147
8493
|
}));
|
|
8148
8494
|
|
|
8149
|
-
function exportUser(
|
|
8495
|
+
function exportUser(_x37, _x38) {
|
|
8150
8496
|
return _exportUser.apply(this, arguments);
|
|
8151
8497
|
}
|
|
8152
8498
|
|
|
@@ -8183,7 +8529,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8183
8529
|
}, _callee32, this);
|
|
8184
8530
|
}));
|
|
8185
8531
|
|
|
8186
|
-
function banUser(
|
|
8532
|
+
function banUser(_x39, _x40) {
|
|
8187
8533
|
return _banUser.apply(this, arguments);
|
|
8188
8534
|
}
|
|
8189
8535
|
|
|
@@ -8220,7 +8566,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8220
8566
|
}, _callee33, this);
|
|
8221
8567
|
}));
|
|
8222
8568
|
|
|
8223
|
-
function unbanUser(
|
|
8569
|
+
function unbanUser(_x41, _x42) {
|
|
8224
8570
|
return _unbanUser.apply(this, arguments);
|
|
8225
8571
|
}
|
|
8226
8572
|
|
|
@@ -8257,7 +8603,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8257
8603
|
}, _callee34, this);
|
|
8258
8604
|
}));
|
|
8259
8605
|
|
|
8260
|
-
function shadowBan(
|
|
8606
|
+
function shadowBan(_x43, _x44) {
|
|
8261
8607
|
return _shadowBan.apply(this, arguments);
|
|
8262
8608
|
}
|
|
8263
8609
|
|
|
@@ -8294,7 +8640,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8294
8640
|
}, _callee35, this);
|
|
8295
8641
|
}));
|
|
8296
8642
|
|
|
8297
|
-
function removeShadowBan(
|
|
8643
|
+
function removeShadowBan(_x45, _x46) {
|
|
8298
8644
|
return _removeShadowBan.apply(this, arguments);
|
|
8299
8645
|
}
|
|
8300
8646
|
|
|
@@ -8337,7 +8683,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8337
8683
|
}, _callee36, this);
|
|
8338
8684
|
}));
|
|
8339
8685
|
|
|
8340
|
-
function muteUser(
|
|
8686
|
+
function muteUser(_x47, _x48) {
|
|
8341
8687
|
return _muteUser.apply(this, arguments);
|
|
8342
8688
|
}
|
|
8343
8689
|
|
|
@@ -8376,7 +8722,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8376
8722
|
}, _callee37, this);
|
|
8377
8723
|
}));
|
|
8378
8724
|
|
|
8379
|
-
function unmuteUser(
|
|
8725
|
+
function unmuteUser(_x49, _x50) {
|
|
8380
8726
|
return _unmuteUser.apply(this, arguments);
|
|
8381
8727
|
}
|
|
8382
8728
|
|
|
@@ -8435,7 +8781,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8435
8781
|
}, _callee38, this);
|
|
8436
8782
|
}));
|
|
8437
8783
|
|
|
8438
|
-
function flagMessage(
|
|
8784
|
+
function flagMessage(_x51) {
|
|
8439
8785
|
return _flagMessage.apply(this, arguments);
|
|
8440
8786
|
}
|
|
8441
8787
|
|
|
@@ -8475,7 +8821,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8475
8821
|
}, _callee39, this);
|
|
8476
8822
|
}));
|
|
8477
8823
|
|
|
8478
|
-
function flagUser(
|
|
8824
|
+
function flagUser(_x52) {
|
|
8479
8825
|
return _flagUser.apply(this, arguments);
|
|
8480
8826
|
}
|
|
8481
8827
|
|
|
@@ -8515,7 +8861,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8515
8861
|
}, _callee40, this);
|
|
8516
8862
|
}));
|
|
8517
8863
|
|
|
8518
|
-
function unflagMessage(
|
|
8864
|
+
function unflagMessage(_x53) {
|
|
8519
8865
|
return _unflagMessage.apply(this, arguments);
|
|
8520
8866
|
}
|
|
8521
8867
|
|
|
@@ -8555,7 +8901,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8555
8901
|
}, _callee41, this);
|
|
8556
8902
|
}));
|
|
8557
8903
|
|
|
8558
|
-
function unflagUser(
|
|
8904
|
+
function unflagUser(_x54) {
|
|
8559
8905
|
return _unflagUser.apply(this, arguments);
|
|
8560
8906
|
}
|
|
8561
8907
|
|
|
@@ -8701,7 +9047,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8701
9047
|
}, _callee44, this);
|
|
8702
9048
|
}));
|
|
8703
9049
|
|
|
8704
|
-
function _reviewFlagReport(
|
|
9050
|
+
function _reviewFlagReport(_x55, _x56) {
|
|
8705
9051
|
return _reviewFlagReport2.apply(this, arguments);
|
|
8706
9052
|
}
|
|
8707
9053
|
|
|
@@ -8747,7 +9093,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8747
9093
|
}, _callee45, this);
|
|
8748
9094
|
}));
|
|
8749
9095
|
|
|
8750
|
-
function _unblockMessage(
|
|
9096
|
+
function _unblockMessage(_x57) {
|
|
8751
9097
|
return _unblockMessage2.apply(this, arguments);
|
|
8752
9098
|
}
|
|
8753
9099
|
|
|
@@ -8886,7 +9232,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8886
9232
|
}, _callee47, this);
|
|
8887
9233
|
}));
|
|
8888
9234
|
|
|
8889
|
-
function translateMessage(
|
|
9235
|
+
function translateMessage(_x58, _x59) {
|
|
8890
9236
|
return _translateMessage.apply(this, arguments);
|
|
8891
9237
|
}
|
|
8892
9238
|
|
|
@@ -9048,7 +9394,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9048
9394
|
}, _callee48, this);
|
|
9049
9395
|
}));
|
|
9050
9396
|
|
|
9051
|
-
function updateMessage(
|
|
9397
|
+
function updateMessage(_x60, _x61, _x62) {
|
|
9052
9398
|
return _updateMessage.apply(this, arguments);
|
|
9053
9399
|
}
|
|
9054
9400
|
|
|
@@ -9109,7 +9455,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9109
9455
|
}, _callee49, this);
|
|
9110
9456
|
}));
|
|
9111
9457
|
|
|
9112
|
-
function partialUpdateMessage(
|
|
9458
|
+
function partialUpdateMessage(_x63, _x64, _x65, _x66) {
|
|
9113
9459
|
return _partialUpdateMessage.apply(this, arguments);
|
|
9114
9460
|
}
|
|
9115
9461
|
|
|
@@ -9146,7 +9492,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9146
9492
|
}, _callee50, this);
|
|
9147
9493
|
}));
|
|
9148
9494
|
|
|
9149
|
-
function deleteMessage(
|
|
9495
|
+
function deleteMessage(_x67, _x68) {
|
|
9150
9496
|
return _deleteMessage.apply(this, arguments);
|
|
9151
9497
|
}
|
|
9152
9498
|
|
|
@@ -9174,7 +9520,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9174
9520
|
}, _callee51, this);
|
|
9175
9521
|
}));
|
|
9176
9522
|
|
|
9177
|
-
function getMessage(
|
|
9523
|
+
function getMessage(_x69) {
|
|
9178
9524
|
return _getMessage.apply(this, arguments);
|
|
9179
9525
|
}
|
|
9180
9526
|
|
|
@@ -9183,7 +9529,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9183
9529
|
}, {
|
|
9184
9530
|
key: "getUserAgent",
|
|
9185
9531
|
value: function getUserAgent() {
|
|
9186
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.
|
|
9532
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.5.0");
|
|
9187
9533
|
}
|
|
9188
9534
|
}, {
|
|
9189
9535
|
key: "setUserAgent",
|
|
@@ -9399,7 +9745,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9399
9745
|
}, _callee52, this);
|
|
9400
9746
|
}));
|
|
9401
9747
|
|
|
9402
|
-
function sendUserCustomEvent(
|
|
9748
|
+
function sendUserCustomEvent(_x70, _x71) {
|
|
9403
9749
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
9404
9750
|
}
|
|
9405
9751
|
|
|
@@ -9492,7 +9838,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9492
9838
|
}, _callee53, this);
|
|
9493
9839
|
}));
|
|
9494
9840
|
|
|
9495
|
-
function createSegment(
|
|
9841
|
+
function createSegment(_x72) {
|
|
9496
9842
|
return _createSegment.apply(this, arguments);
|
|
9497
9843
|
}
|
|
9498
9844
|
|
|
@@ -9532,7 +9878,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9532
9878
|
}, _callee54, this);
|
|
9533
9879
|
}));
|
|
9534
9880
|
|
|
9535
|
-
function getSegment(
|
|
9881
|
+
function getSegment(_x73) {
|
|
9536
9882
|
return _getSegment.apply(this, arguments);
|
|
9537
9883
|
}
|
|
9538
9884
|
|
|
@@ -9571,7 +9917,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9571
9917
|
}, _callee55, this);
|
|
9572
9918
|
}));
|
|
9573
9919
|
|
|
9574
|
-
function listSegments(
|
|
9920
|
+
function listSegments(_x74) {
|
|
9575
9921
|
return _listSegments.apply(this, arguments);
|
|
9576
9922
|
}
|
|
9577
9923
|
|
|
@@ -9614,7 +9960,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9614
9960
|
}, _callee56, this);
|
|
9615
9961
|
}));
|
|
9616
9962
|
|
|
9617
|
-
function updateSegment(
|
|
9963
|
+
function updateSegment(_x75, _x76) {
|
|
9618
9964
|
return _updateSegment.apply(this, arguments);
|
|
9619
9965
|
}
|
|
9620
9966
|
|
|
@@ -9646,7 +9992,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9646
9992
|
}, _callee57, this);
|
|
9647
9993
|
}));
|
|
9648
9994
|
|
|
9649
|
-
function deleteSegment(
|
|
9995
|
+
function deleteSegment(_x77) {
|
|
9650
9996
|
return _deleteSegment.apply(this, arguments);
|
|
9651
9997
|
}
|
|
9652
9998
|
|
|
@@ -9688,7 +10034,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9688
10034
|
}, _callee58, this);
|
|
9689
10035
|
}));
|
|
9690
10036
|
|
|
9691
|
-
function createCampaign(
|
|
10037
|
+
function createCampaign(_x78) {
|
|
9692
10038
|
return _createCampaign.apply(this, arguments);
|
|
9693
10039
|
}
|
|
9694
10040
|
|
|
@@ -9728,7 +10074,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9728
10074
|
}, _callee59, this);
|
|
9729
10075
|
}));
|
|
9730
10076
|
|
|
9731
|
-
function getCampaign(
|
|
10077
|
+
function getCampaign(_x79) {
|
|
9732
10078
|
return _getCampaign.apply(this, arguments);
|
|
9733
10079
|
}
|
|
9734
10080
|
|
|
@@ -9767,7 +10113,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9767
10113
|
}, _callee60, this);
|
|
9768
10114
|
}));
|
|
9769
10115
|
|
|
9770
|
-
function listCampaigns(
|
|
10116
|
+
function listCampaigns(_x80) {
|
|
9771
10117
|
return _listCampaigns.apply(this, arguments);
|
|
9772
10118
|
}
|
|
9773
10119
|
|
|
@@ -9810,7 +10156,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9810
10156
|
}, _callee61, this);
|
|
9811
10157
|
}));
|
|
9812
10158
|
|
|
9813
|
-
function updateCampaign(
|
|
10159
|
+
function updateCampaign(_x81, _x82) {
|
|
9814
10160
|
return _updateCampaign.apply(this, arguments);
|
|
9815
10161
|
}
|
|
9816
10162
|
|
|
@@ -9842,7 +10188,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9842
10188
|
}, _callee62, this);
|
|
9843
10189
|
}));
|
|
9844
10190
|
|
|
9845
|
-
function deleteCampaign(
|
|
10191
|
+
function deleteCampaign(_x83) {
|
|
9846
10192
|
return _deleteCampaign.apply(this, arguments);
|
|
9847
10193
|
}
|
|
9848
10194
|
|
|
@@ -9886,7 +10232,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9886
10232
|
}, _callee63, this);
|
|
9887
10233
|
}));
|
|
9888
10234
|
|
|
9889
|
-
function scheduleCampaign(
|
|
10235
|
+
function scheduleCampaign(_x84, _x85) {
|
|
9890
10236
|
return _scheduleCampaign.apply(this, arguments);
|
|
9891
10237
|
}
|
|
9892
10238
|
|
|
@@ -9926,7 +10272,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9926
10272
|
}, _callee64, this);
|
|
9927
10273
|
}));
|
|
9928
10274
|
|
|
9929
|
-
function stopCampaign(
|
|
10275
|
+
function stopCampaign(_x86) {
|
|
9930
10276
|
return _stopCampaign.apply(this, arguments);
|
|
9931
10277
|
}
|
|
9932
10278
|
|
|
@@ -9966,7 +10312,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9966
10312
|
}, _callee65, this);
|
|
9967
10313
|
}));
|
|
9968
10314
|
|
|
9969
|
-
function resumeCampaign(
|
|
10315
|
+
function resumeCampaign(_x87) {
|
|
9970
10316
|
return _resumeCampaign.apply(this, arguments);
|
|
9971
10317
|
}
|
|
9972
10318
|
|
|
@@ -10009,7 +10355,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10009
10355
|
}, _callee66, this);
|
|
10010
10356
|
}));
|
|
10011
10357
|
|
|
10012
|
-
function testCampaign(
|
|
10358
|
+
function testCampaign(_x88, _x89) {
|
|
10013
10359
|
return _testCampaign.apply(this, arguments);
|
|
10014
10360
|
}
|
|
10015
10361
|
|
|
@@ -10042,7 +10388,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10042
10388
|
}, _callee67, this);
|
|
10043
10389
|
}));
|
|
10044
10390
|
|
|
10045
|
-
function enrichURL(
|
|
10391
|
+
function enrichURL(_x90) {
|
|
10046
10392
|
return _enrichURL.apply(this, arguments);
|
|
10047
10393
|
}
|
|
10048
10394
|
|
|
@@ -10074,7 +10420,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10074
10420
|
}, _callee68, this);
|
|
10075
10421
|
}));
|
|
10076
10422
|
|
|
10077
|
-
function getTask(
|
|
10423
|
+
function getTask(_x91) {
|
|
10078
10424
|
return _getTask.apply(this, arguments);
|
|
10079
10425
|
}
|
|
10080
10426
|
|
|
@@ -10116,7 +10462,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10116
10462
|
}, _callee69, this);
|
|
10117
10463
|
}));
|
|
10118
10464
|
|
|
10119
|
-
function deleteChannels(
|
|
10465
|
+
function deleteChannels(_x92) {
|
|
10120
10466
|
return _deleteChannels.apply(this, arguments);
|
|
10121
10467
|
}
|
|
10122
10468
|
|
|
@@ -10179,7 +10525,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10179
10525
|
}, _callee70, this);
|
|
10180
10526
|
}));
|
|
10181
10527
|
|
|
10182
|
-
function deleteUsers(
|
|
10528
|
+
function deleteUsers(_x93, _x94) {
|
|
10183
10529
|
return _deleteUsers.apply(this, arguments);
|
|
10184
10530
|
}
|
|
10185
10531
|
|
|
@@ -10194,7 +10540,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10194
10540
|
*
|
|
10195
10541
|
* @private
|
|
10196
10542
|
* @param {string} filename filename of uploaded data
|
|
10197
|
-
*
|
|
10198
10543
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10199
10544
|
*/
|
|
10200
10545
|
|
|
@@ -10222,7 +10567,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10222
10567
|
}, _callee71, this);
|
|
10223
10568
|
}));
|
|
10224
10569
|
|
|
10225
|
-
function _createImportURL(
|
|
10570
|
+
function _createImportURL(_x95) {
|
|
10226
10571
|
return _createImportURL2.apply(this, arguments);
|
|
10227
10572
|
}
|
|
10228
10573
|
|
|
@@ -10237,7 +10582,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10237
10582
|
*
|
|
10238
10583
|
* @private
|
|
10239
10584
|
* @param {string} path path of uploaded data
|
|
10240
|
-
*
|
|
10585
|
+
* @param {CreateImportOptions} options import options
|
|
10241
10586
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10242
10587
|
*/
|
|
10243
10588
|
|
|
@@ -10245,19 +10590,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10245
10590
|
key: "_createImport",
|
|
10246
10591
|
value: function () {
|
|
10247
10592
|
var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(path) {
|
|
10593
|
+
var options,
|
|
10594
|
+
_args72 = arguments;
|
|
10248
10595
|
return _regeneratorRuntime.wrap(function _callee72$(_context72) {
|
|
10249
10596
|
while (1) {
|
|
10250
10597
|
switch (_context72.prev = _context72.next) {
|
|
10251
10598
|
case 0:
|
|
10252
|
-
|
|
10253
|
-
|
|
10599
|
+
options = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {
|
|
10600
|
+
mode: 'upsert'
|
|
10601
|
+
};
|
|
10602
|
+
_context72.next = 3;
|
|
10603
|
+
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
10254
10604
|
path: path
|
|
10255
|
-
});
|
|
10605
|
+
}, options));
|
|
10256
10606
|
|
|
10257
|
-
case
|
|
10607
|
+
case 3:
|
|
10258
10608
|
return _context72.abrupt("return", _context72.sent);
|
|
10259
10609
|
|
|
10260
|
-
case
|
|
10610
|
+
case 4:
|
|
10261
10611
|
case "end":
|
|
10262
10612
|
return _context72.stop();
|
|
10263
10613
|
}
|
|
@@ -10265,7 +10615,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10265
10615
|
}, _callee72, this);
|
|
10266
10616
|
}));
|
|
10267
10617
|
|
|
10268
|
-
function _createImport(
|
|
10618
|
+
function _createImport(_x96) {
|
|
10269
10619
|
return _createImport2.apply(this, arguments);
|
|
10270
10620
|
}
|
|
10271
10621
|
|
|
@@ -10306,7 +10656,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10306
10656
|
}, _callee73, this);
|
|
10307
10657
|
}));
|
|
10308
10658
|
|
|
10309
|
-
function _getImport(
|
|
10659
|
+
function _getImport(_x97) {
|
|
10310
10660
|
return _getImport2.apply(this, arguments);
|
|
10311
10661
|
}
|
|
10312
10662
|
|
|
@@ -10347,12 +10697,128 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10347
10697
|
}, _callee74, this);
|
|
10348
10698
|
}));
|
|
10349
10699
|
|
|
10350
|
-
function _listImports(
|
|
10700
|
+
function _listImports(_x98) {
|
|
10351
10701
|
return _listImports2.apply(this, arguments);
|
|
10352
10702
|
}
|
|
10353
10703
|
|
|
10354
10704
|
return _listImports;
|
|
10355
10705
|
}()
|
|
10706
|
+
/**
|
|
10707
|
+
* upsertPushProvider - Create or Update a push provider
|
|
10708
|
+
*
|
|
10709
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10710
|
+
*
|
|
10711
|
+
* @param {PushProviderConfig} configuration of the provider you want to create or update
|
|
10712
|
+
*
|
|
10713
|
+
* @return {APIResponse & PushProviderUpsertResponse} A push provider
|
|
10714
|
+
*/
|
|
10715
|
+
|
|
10716
|
+
}, {
|
|
10717
|
+
key: "upsertPushProvider",
|
|
10718
|
+
value: function () {
|
|
10719
|
+
var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(pushProvider) {
|
|
10720
|
+
return _regeneratorRuntime.wrap(function _callee75$(_context75) {
|
|
10721
|
+
while (1) {
|
|
10722
|
+
switch (_context75.prev = _context75.next) {
|
|
10723
|
+
case 0:
|
|
10724
|
+
_context75.next = 2;
|
|
10725
|
+
return this.post(this.baseURL + "/push_providers", {
|
|
10726
|
+
push_provider: pushProvider
|
|
10727
|
+
});
|
|
10728
|
+
|
|
10729
|
+
case 2:
|
|
10730
|
+
return _context75.abrupt("return", _context75.sent);
|
|
10731
|
+
|
|
10732
|
+
case 3:
|
|
10733
|
+
case "end":
|
|
10734
|
+
return _context75.stop();
|
|
10735
|
+
}
|
|
10736
|
+
}
|
|
10737
|
+
}, _callee75, this);
|
|
10738
|
+
}));
|
|
10739
|
+
|
|
10740
|
+
function upsertPushProvider(_x99) {
|
|
10741
|
+
return _upsertPushProvider.apply(this, arguments);
|
|
10742
|
+
}
|
|
10743
|
+
|
|
10744
|
+
return upsertPushProvider;
|
|
10745
|
+
}()
|
|
10746
|
+
/**
|
|
10747
|
+
* deletePushProvider - Delete a push provider
|
|
10748
|
+
*
|
|
10749
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10750
|
+
*
|
|
10751
|
+
* @param {PushProviderID} type and foreign id of the push provider to be deleted
|
|
10752
|
+
*
|
|
10753
|
+
* @return {APIResponse} An API response
|
|
10754
|
+
*/
|
|
10755
|
+
|
|
10756
|
+
}, {
|
|
10757
|
+
key: "deletePushProvider",
|
|
10758
|
+
value: function () {
|
|
10759
|
+
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(_ref8) {
|
|
10760
|
+
var type, name;
|
|
10761
|
+
return _regeneratorRuntime.wrap(function _callee76$(_context76) {
|
|
10762
|
+
while (1) {
|
|
10763
|
+
switch (_context76.prev = _context76.next) {
|
|
10764
|
+
case 0:
|
|
10765
|
+
type = _ref8.type, name = _ref8.name;
|
|
10766
|
+
_context76.next = 3;
|
|
10767
|
+
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
10768
|
+
|
|
10769
|
+
case 3:
|
|
10770
|
+
return _context76.abrupt("return", _context76.sent);
|
|
10771
|
+
|
|
10772
|
+
case 4:
|
|
10773
|
+
case "end":
|
|
10774
|
+
return _context76.stop();
|
|
10775
|
+
}
|
|
10776
|
+
}
|
|
10777
|
+
}, _callee76, this);
|
|
10778
|
+
}));
|
|
10779
|
+
|
|
10780
|
+
function deletePushProvider(_x100) {
|
|
10781
|
+
return _deletePushProvider.apply(this, arguments);
|
|
10782
|
+
}
|
|
10783
|
+
|
|
10784
|
+
return deletePushProvider;
|
|
10785
|
+
}()
|
|
10786
|
+
/**
|
|
10787
|
+
* listPushProviders - Get all push providers in the app
|
|
10788
|
+
*
|
|
10789
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10790
|
+
*
|
|
10791
|
+
* @return {APIResponse & PushProviderListResponse} A push provider
|
|
10792
|
+
*/
|
|
10793
|
+
|
|
10794
|
+
}, {
|
|
10795
|
+
key: "listPushProviders",
|
|
10796
|
+
value: function () {
|
|
10797
|
+
var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77() {
|
|
10798
|
+
return _regeneratorRuntime.wrap(function _callee77$(_context77) {
|
|
10799
|
+
while (1) {
|
|
10800
|
+
switch (_context77.prev = _context77.next) {
|
|
10801
|
+
case 0:
|
|
10802
|
+
_context77.next = 2;
|
|
10803
|
+
return this.get(this.baseURL + "/push_providers");
|
|
10804
|
+
|
|
10805
|
+
case 2:
|
|
10806
|
+
return _context77.abrupt("return", _context77.sent);
|
|
10807
|
+
|
|
10808
|
+
case 3:
|
|
10809
|
+
case "end":
|
|
10810
|
+
return _context77.stop();
|
|
10811
|
+
}
|
|
10812
|
+
}
|
|
10813
|
+
}, _callee77, this);
|
|
10814
|
+
}));
|
|
10815
|
+
|
|
10816
|
+
function listPushProviders() {
|
|
10817
|
+
return _listPushProviders.apply(this, arguments);
|
|
10818
|
+
}
|
|
10819
|
+
|
|
10820
|
+
return listPushProviders;
|
|
10821
|
+
}()
|
|
10356
10822
|
}], [{
|
|
10357
10823
|
key: "getInstance",
|
|
10358
10824
|
value: function getInstance(key, secretOrOptions, options) {
|