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.js
CHANGED
|
@@ -126,6 +126,13 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
126
126
|
* When false, any new message (received by websocket event - message.new) will not
|
|
127
127
|
* be pushed on to message list.
|
|
128
128
|
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Disjoint lists of messages
|
|
132
|
+
* Users can jump in the message list (with searching) and this can result in disjoint lists of messages
|
|
133
|
+
* The state manages these lists and merges them when lists overlap
|
|
134
|
+
* The messages array contains the currently active set
|
|
135
|
+
*/
|
|
129
136
|
function ChannelState(channel) {
|
|
130
137
|
var _this = this,
|
|
131
138
|
_channel$state;
|
|
@@ -140,8 +147,6 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
140
147
|
|
|
141
148
|
_defineProperty__default['default'](this, "read", void 0);
|
|
142
149
|
|
|
143
|
-
_defineProperty__default['default'](this, "messages", void 0);
|
|
144
|
-
|
|
145
150
|
_defineProperty__default['default'](this, "pinnedMessages", void 0);
|
|
146
151
|
|
|
147
152
|
_defineProperty__default['default'](this, "threads", void 0);
|
|
@@ -160,6 +165,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
160
165
|
|
|
161
166
|
_defineProperty__default['default'](this, "isUpToDate", void 0);
|
|
162
167
|
|
|
168
|
+
_defineProperty__default['default'](this, "messageSets", []);
|
|
169
|
+
|
|
163
170
|
_defineProperty__default['default'](this, "setIsUpToDate", function (isUpToDate) {
|
|
164
171
|
_this.isUpToDate = isUpToDate;
|
|
165
172
|
});
|
|
@@ -189,7 +196,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
189
196
|
}
|
|
190
197
|
};
|
|
191
198
|
|
|
192
|
-
|
|
199
|
+
_this.messageSets.forEach(function (set) {
|
|
200
|
+
return _updateUserMessages(set.messages, user);
|
|
201
|
+
});
|
|
193
202
|
|
|
194
203
|
for (var parentId in _this.threads) {
|
|
195
204
|
_updateUserMessages(_this.threads[parentId], user);
|
|
@@ -243,7 +252,9 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
243
252
|
}
|
|
244
253
|
};
|
|
245
254
|
|
|
246
|
-
|
|
255
|
+
_this.messageSets.forEach(function (set) {
|
|
256
|
+
return _deleteUserMessages(set.messages, user, hardDelete);
|
|
257
|
+
});
|
|
247
258
|
|
|
248
259
|
for (var parentId in _this.threads) {
|
|
249
260
|
_deleteUserMessages(_this.threads[parentId], user, hardDelete);
|
|
@@ -256,7 +267,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
256
267
|
this.watcher_count = 0;
|
|
257
268
|
this.typing = {};
|
|
258
269
|
this.read = {};
|
|
259
|
-
this.
|
|
270
|
+
this.initMessages();
|
|
260
271
|
this.pinnedMessages = [];
|
|
261
272
|
this.threads = {}; // a list of users to hide messages from
|
|
262
273
|
|
|
@@ -275,22 +286,58 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
275
286
|
this.isUpToDate = true;
|
|
276
287
|
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;
|
|
277
288
|
}
|
|
278
|
-
/**
|
|
279
|
-
* addMessageSorted - Add a message to the state
|
|
280
|
-
*
|
|
281
|
-
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
282
|
-
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
283
|
-
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
284
|
-
*
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
289
|
|
|
288
290
|
_createClass__default['default'](ChannelState, [{
|
|
291
|
+
key: "messages",
|
|
292
|
+
get: function get() {
|
|
293
|
+
var _this$messageSets$fin;
|
|
294
|
+
|
|
295
|
+
return ((_this$messageSets$fin = this.messageSets.find(function (s) {
|
|
296
|
+
return s.isCurrent;
|
|
297
|
+
})) === null || _this$messageSets$fin === void 0 ? void 0 : _this$messageSets$fin.messages) || [];
|
|
298
|
+
},
|
|
299
|
+
set: function set(messages) {
|
|
300
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
301
|
+
return s.isCurrent;
|
|
302
|
+
});
|
|
303
|
+
this.messageSets[index].messages = messages;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* The list of latest messages
|
|
307
|
+
* 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)
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
}, {
|
|
311
|
+
key: "latestMessages",
|
|
312
|
+
get: function get() {
|
|
313
|
+
var _this$messageSets$fin2;
|
|
314
|
+
|
|
315
|
+
return ((_this$messageSets$fin2 = this.messageSets.find(function (s) {
|
|
316
|
+
return s.isLatest;
|
|
317
|
+
})) === null || _this$messageSets$fin2 === void 0 ? void 0 : _this$messageSets$fin2.messages) || [];
|
|
318
|
+
},
|
|
319
|
+
set: function set(messages) {
|
|
320
|
+
var index = this.messageSets.findIndex(function (s) {
|
|
321
|
+
return s.isLatest;
|
|
322
|
+
});
|
|
323
|
+
this.messageSets[index].messages = messages;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* addMessageSorted - Add a message to the state
|
|
327
|
+
*
|
|
328
|
+
* @param {MessageResponse<StreamChatGenerics>} newMessage A new message
|
|
329
|
+
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
330
|
+
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
331
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if message is not in the list (only used if addIfDoesNotExist is true)
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
}, {
|
|
289
335
|
key: "addMessageSorted",
|
|
290
336
|
value: function addMessageSorted(newMessage) {
|
|
291
337
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
292
338
|
var addIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
293
|
-
|
|
339
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'latest';
|
|
340
|
+
return this.addMessagesSorted([newMessage], timestampChanged, false, addIfDoesNotExist, messageSetToAddToIfDoesNotExist);
|
|
294
341
|
}
|
|
295
342
|
/**
|
|
296
343
|
* formatMessage - Takes the message object. Parses the dates, sets __html
|
|
@@ -322,6 +369,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
322
369
|
* @param {boolean} timestampChanged Whether updating messages with changed created_at value.
|
|
323
370
|
* @param {boolean} initializing Whether channel is being initialized.
|
|
324
371
|
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
372
|
+
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if messages are not in the list (only used if addIfDoesNotExist is true)
|
|
325
373
|
*
|
|
326
374
|
*/
|
|
327
375
|
|
|
@@ -331,48 +379,63 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
331
379
|
var timestampChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
332
380
|
var initializing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
333
381
|
var addIfDoesNotExist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
382
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'current';
|
|
334
383
|
|
|
335
|
-
|
|
336
|
-
|
|
384
|
+
var _this$findTargetMessa = this.findTargetMessageSet(newMessages, addIfDoesNotExist, messageSetToAddToIfDoesNotExist),
|
|
385
|
+
messagesToAdd = _this$findTargetMessa.messagesToAdd,
|
|
386
|
+
targetMessageSetIndex = _this$findTargetMessa.targetMessageSetIndex;
|
|
337
387
|
|
|
338
|
-
|
|
388
|
+
for (var i = 0; i < messagesToAdd.length; i += 1) {
|
|
389
|
+
var isFromShadowBannedUser = messagesToAdd[i].shadowed;
|
|
339
390
|
|
|
340
391
|
if (isFromShadowBannedUser) {
|
|
341
392
|
continue;
|
|
342
|
-
}
|
|
393
|
+
} // If message is already formatted we can skip the tasks below
|
|
394
|
+
// This will be true for messages that are already present at the state -> this happens when we perform merging of message sets
|
|
395
|
+
// This will be also true for message previews used by some SDKs
|
|
343
396
|
|
|
344
|
-
var message = this.formatMessage(newMessages[i]);
|
|
345
397
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
* Store the reference to user for this channel, so that when we have to
|
|
349
|
-
* handle updates to user, we can use the reference map, to determine which
|
|
350
|
-
* channels need to be updated with updated user object.
|
|
351
|
-
*/
|
|
352
|
-
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
353
|
-
}
|
|
398
|
+
var isMessageFormatted = messagesToAdd[i].created_at instanceof Date;
|
|
399
|
+
var message = void 0;
|
|
354
400
|
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
// and consumer can refetch the replies.
|
|
360
|
-
delete this.threads[message.id];
|
|
361
|
-
}
|
|
401
|
+
if (isMessageFormatted) {
|
|
402
|
+
message = messagesToAdd[i];
|
|
403
|
+
} else {
|
|
404
|
+
var _this$_channel;
|
|
362
405
|
|
|
363
|
-
|
|
364
|
-
this.last_message_at = new Date(message.created_at.getTime());
|
|
365
|
-
}
|
|
406
|
+
message = this.formatMessage(messagesToAdd[i]);
|
|
366
407
|
|
|
367
|
-
|
|
368
|
-
|
|
408
|
+
if (message.user && (_this$_channel = this._channel) !== null && _this$_channel !== void 0 && _this$_channel.cid) {
|
|
409
|
+
/**
|
|
410
|
+
* Store the reference to user for this channel, so that when we have to
|
|
411
|
+
* handle updates to user, we can use the reference map, to determine which
|
|
412
|
+
* channels need to be updated with updated user object.
|
|
413
|
+
*/
|
|
414
|
+
this._channel.getClient().state.updateUserReference(message.user, this._channel.cid);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (initializing && message.id && this.threads[message.id]) {
|
|
418
|
+
// If we are initializing the state of channel (e.g., in case of connection recovery),
|
|
419
|
+
// then in that case we remove thread related to this message from threads object.
|
|
420
|
+
// This way we can ensure that we don't have any stale data in thread object
|
|
421
|
+
// and consumer can refetch the replies.
|
|
422
|
+
delete this.threads[message.id];
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (!this.last_message_at) {
|
|
426
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (message.created_at.getTime() > this.last_message_at.getTime()) {
|
|
430
|
+
this.last_message_at = new Date(message.created_at.getTime());
|
|
431
|
+
}
|
|
369
432
|
} // update or append the messages...
|
|
370
433
|
|
|
371
434
|
|
|
372
|
-
var parentID = message.parent_id; // add to the
|
|
435
|
+
var parentID = message.parent_id; // add to the given message set
|
|
373
436
|
|
|
374
|
-
if (!parentID || message.show_in_channel) {
|
|
375
|
-
this.messages = this._addToMessageList(this.messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
437
|
+
if ((!parentID || message.show_in_channel) && targetMessageSetIndex !== -1) {
|
|
438
|
+
this.messageSets[targetMessageSetIndex].messages = this._addToMessageList(this.messageSets[targetMessageSetIndex].messages, message, timestampChanged, 'created_at', addIfDoesNotExist);
|
|
376
439
|
}
|
|
377
440
|
/**
|
|
378
441
|
* Add message to thread if applicable and the message
|
|
@@ -496,6 +559,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
496
559
|
}, {
|
|
497
560
|
key: "removeQuotedMessageReferences",
|
|
498
561
|
value: function removeQuotedMessageReferences(message) {
|
|
562
|
+
var _this4 = this;
|
|
563
|
+
|
|
499
564
|
var parseMessage = function parseMessage(m) {
|
|
500
565
|
var _m$pinned_at, _m$updated_at;
|
|
501
566
|
|
|
@@ -506,16 +571,19 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
506
571
|
});
|
|
507
572
|
};
|
|
508
573
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
574
|
+
this.messageSets.forEach(function (set) {
|
|
575
|
+
var updatedMessages = set.messages.filter(function (msg) {
|
|
576
|
+
return msg.quoted_message_id === message.id;
|
|
577
|
+
}).map(parseMessage).map(function (msg) {
|
|
578
|
+
return _objectSpread$7(_objectSpread$7({}, msg), {}, {
|
|
579
|
+
quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
580
|
+
attachments: []
|
|
581
|
+
})
|
|
582
|
+
});
|
|
516
583
|
});
|
|
584
|
+
|
|
585
|
+
_this4.addMessagesSorted(updatedMessages, true);
|
|
517
586
|
});
|
|
518
|
-
this.addMessagesSorted(updatedMessages, true);
|
|
519
587
|
}
|
|
520
588
|
/**
|
|
521
589
|
* Updates all instances of given message in channel state
|
|
@@ -543,12 +611,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
543
611
|
}
|
|
544
612
|
|
|
545
613
|
if (!show_in_channel && !parent_id || show_in_channel) {
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
614
|
+
var messageSetIndex = this.findMessageSetIndex(message);
|
|
615
|
+
|
|
616
|
+
if (messageSetIndex !== -1) {
|
|
617
|
+
var _msgIndex = this.messageSets[messageSetIndex].messages.findIndex(function (msg) {
|
|
618
|
+
return msg.id === message.id;
|
|
619
|
+
});
|
|
549
620
|
|
|
550
|
-
|
|
551
|
-
|
|
621
|
+
if (_msgIndex !== -1) {
|
|
622
|
+
this.messageSets[messageSetIndex].messages[_msgIndex] = updateFunc(this.messageSets[messageSetIndex].messages[_msgIndex]);
|
|
623
|
+
}
|
|
552
624
|
}
|
|
553
625
|
}
|
|
554
626
|
|
|
@@ -667,12 +739,16 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
667
739
|
this.threads[messageToRemove.parent_id] = threadMessages;
|
|
668
740
|
isRemoved = removed;
|
|
669
741
|
} else {
|
|
670
|
-
var
|
|
671
|
-
_removed = _this$removeMessageFr3.removed,
|
|
672
|
-
messages = _this$removeMessageFr3.result;
|
|
742
|
+
var messageSetIndex = this.findMessageSetIndex(messageToRemove);
|
|
673
743
|
|
|
674
|
-
|
|
675
|
-
|
|
744
|
+
if (messageSetIndex !== -1) {
|
|
745
|
+
var _this$removeMessageFr3 = this.removeMessageFromArray(this.messageSets[messageSetIndex].messages, messageToRemove),
|
|
746
|
+
_removed = _this$removeMessageFr3.removed,
|
|
747
|
+
messages = _this$removeMessageFr3.result;
|
|
748
|
+
|
|
749
|
+
this.messageSets[messageSetIndex].messages = messages;
|
|
750
|
+
isRemoved = _removed;
|
|
751
|
+
}
|
|
676
752
|
}
|
|
677
753
|
|
|
678
754
|
return isRemoved;
|
|
@@ -685,10 +761,10 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
685
761
|
*
|
|
686
762
|
*/
|
|
687
763
|
function filterErrorMessages() {
|
|
688
|
-
var filteredMessages = this.
|
|
764
|
+
var filteredMessages = this.latestMessages.filter(function (message) {
|
|
689
765
|
return message.type !== 'error';
|
|
690
766
|
});
|
|
691
|
-
this.
|
|
767
|
+
this.latestMessages = filteredMessages;
|
|
692
768
|
}
|
|
693
769
|
/**
|
|
694
770
|
* clean - Remove stale data such as users that stayed in typing state for more than 5 seconds
|
|
@@ -722,9 +798,250 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
722
798
|
}, {
|
|
723
799
|
key: "clearMessages",
|
|
724
800
|
value: function clearMessages() {
|
|
725
|
-
this.
|
|
801
|
+
this.initMessages();
|
|
726
802
|
this.pinnedMessages = [];
|
|
727
803
|
}
|
|
804
|
+
}, {
|
|
805
|
+
key: "initMessages",
|
|
806
|
+
value: function initMessages() {
|
|
807
|
+
this.messageSets = [{
|
|
808
|
+
messages: [],
|
|
809
|
+
isLatest: true,
|
|
810
|
+
isCurrent: true
|
|
811
|
+
}];
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* loadMessageIntoState - Loads a given message (and messages around it) into the state
|
|
815
|
+
*
|
|
816
|
+
* @param {string} messageId The id of the message, or 'latest' to indicate switching to the latest messages
|
|
817
|
+
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply
|
|
818
|
+
*/
|
|
819
|
+
|
|
820
|
+
}, {
|
|
821
|
+
key: "loadMessageIntoState",
|
|
822
|
+
value: function () {
|
|
823
|
+
var _loadMessageIntoState = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(messageId, parentMessageId) {
|
|
824
|
+
var _this$threads$parentM;
|
|
825
|
+
|
|
826
|
+
var messageSetIndex, switchedToMessageSet, loadedMessageThread, messageIdToFind;
|
|
827
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
828
|
+
while (1) {
|
|
829
|
+
switch (_context.prev = _context.next) {
|
|
830
|
+
case 0:
|
|
831
|
+
switchedToMessageSet = false;
|
|
832
|
+
loadedMessageThread = false;
|
|
833
|
+
messageIdToFind = parentMessageId || messageId;
|
|
834
|
+
|
|
835
|
+
if (!(messageId === 'latest')) {
|
|
836
|
+
_context.next = 9;
|
|
837
|
+
break;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
if (!(this.messages === this.latestMessages)) {
|
|
841
|
+
_context.next = 6;
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
return _context.abrupt("return");
|
|
846
|
+
|
|
847
|
+
case 6:
|
|
848
|
+
messageSetIndex = this.messageSets.findIndex(function (s) {
|
|
849
|
+
return s.isLatest;
|
|
850
|
+
});
|
|
851
|
+
_context.next = 10;
|
|
852
|
+
break;
|
|
853
|
+
|
|
854
|
+
case 9:
|
|
855
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
856
|
+
id: messageIdToFind
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
case 10:
|
|
860
|
+
if (messageSetIndex !== -1) {
|
|
861
|
+
this.switchToMessageSet(messageSetIndex);
|
|
862
|
+
switchedToMessageSet = true;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
loadedMessageThread = !parentMessageId || !!((_this$threads$parentM = this.threads[parentMessageId]) !== null && _this$threads$parentM !== void 0 && _this$threads$parentM.find(function (m) {
|
|
866
|
+
return m.id === messageId;
|
|
867
|
+
}));
|
|
868
|
+
|
|
869
|
+
if (!(switchedToMessageSet && loadedMessageThread)) {
|
|
870
|
+
_context.next = 14;
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
return _context.abrupt("return");
|
|
875
|
+
|
|
876
|
+
case 14:
|
|
877
|
+
if (switchedToMessageSet) {
|
|
878
|
+
_context.next = 17;
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
_context.next = 17;
|
|
883
|
+
return this._channel.query({
|
|
884
|
+
messages: {
|
|
885
|
+
id_around: messageIdToFind,
|
|
886
|
+
limit: 25
|
|
887
|
+
}
|
|
888
|
+
}, 'new');
|
|
889
|
+
|
|
890
|
+
case 17:
|
|
891
|
+
if (!(!loadedMessageThread && parentMessageId)) {
|
|
892
|
+
_context.next = 20;
|
|
893
|
+
break;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
_context.next = 20;
|
|
897
|
+
return this._channel.getReplies(parentMessageId, {
|
|
898
|
+
id_around: messageId,
|
|
899
|
+
limit: 25
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
case 20:
|
|
903
|
+
messageSetIndex = this.findMessageSetIndex({
|
|
904
|
+
id: messageIdToFind
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
if (messageSetIndex !== -1) {
|
|
908
|
+
this.switchToMessageSet(messageSetIndex);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
case 22:
|
|
912
|
+
case "end":
|
|
913
|
+
return _context.stop();
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}, _callee, this);
|
|
917
|
+
}));
|
|
918
|
+
|
|
919
|
+
function loadMessageIntoState(_x, _x2) {
|
|
920
|
+
return _loadMessageIntoState.apply(this, arguments);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
return loadMessageIntoState;
|
|
924
|
+
}()
|
|
925
|
+
}, {
|
|
926
|
+
key: "switchToMessageSet",
|
|
927
|
+
value: function switchToMessageSet(index) {
|
|
928
|
+
var currentMessages = this.messageSets.find(function (s) {
|
|
929
|
+
return s.isCurrent;
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
if (!currentMessages) {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
currentMessages.isCurrent = false;
|
|
937
|
+
this.messageSets[index].isCurrent = true;
|
|
938
|
+
}
|
|
939
|
+
}, {
|
|
940
|
+
key: "areMessageSetsOverlap",
|
|
941
|
+
value: function areMessageSetsOverlap(messages1, messages2) {
|
|
942
|
+
return messages1.some(function (m1) {
|
|
943
|
+
return messages2.find(function (m2) {
|
|
944
|
+
return m1.id === m2.id;
|
|
945
|
+
});
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
}, {
|
|
949
|
+
key: "findMessageSetIndex",
|
|
950
|
+
value: function findMessageSetIndex(message) {
|
|
951
|
+
return this.messageSets.findIndex(function (set) {
|
|
952
|
+
return !!set.messages.find(function (m) {
|
|
953
|
+
return m.id === message.id;
|
|
954
|
+
});
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
}, {
|
|
958
|
+
key: "findTargetMessageSet",
|
|
959
|
+
value: function findTargetMessageSet(newMessages) {
|
|
960
|
+
var _this5 = this;
|
|
961
|
+
|
|
962
|
+
var addIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
963
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'current';
|
|
964
|
+
var messagesToAdd = newMessages;
|
|
965
|
+
var targetMessageSetIndex;
|
|
966
|
+
|
|
967
|
+
if (addIfDoesNotExist) {
|
|
968
|
+
var overlappingMessageSetIndices = this.messageSets.map(function (_, i) {
|
|
969
|
+
return i;
|
|
970
|
+
}).filter(function (i) {
|
|
971
|
+
return _this5.areMessageSetsOverlap(_this5.messageSets[i].messages, newMessages);
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
switch (messageSetToAddToIfDoesNotExist) {
|
|
975
|
+
case 'new':
|
|
976
|
+
if (overlappingMessageSetIndices.length > 0) {
|
|
977
|
+
targetMessageSetIndex = overlappingMessageSetIndices[0]; // No new message set is created if newMessages only contains thread replies
|
|
978
|
+
} else if (newMessages.some(function (m) {
|
|
979
|
+
return !m.parent_id;
|
|
980
|
+
})) {
|
|
981
|
+
this.messageSets.push({
|
|
982
|
+
messages: [],
|
|
983
|
+
isCurrent: false,
|
|
984
|
+
isLatest: false
|
|
985
|
+
});
|
|
986
|
+
targetMessageSetIndex = this.messageSets.length - 1;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
break;
|
|
990
|
+
|
|
991
|
+
case 'current':
|
|
992
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
993
|
+
return s.isCurrent;
|
|
994
|
+
});
|
|
995
|
+
break;
|
|
996
|
+
|
|
997
|
+
case 'latest':
|
|
998
|
+
targetMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
999
|
+
return s.isLatest;
|
|
1000
|
+
});
|
|
1001
|
+
break;
|
|
1002
|
+
|
|
1003
|
+
default:
|
|
1004
|
+
targetMessageSetIndex = -1;
|
|
1005
|
+
} // when merging the target set will be the first one from the overlapping message sets
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
var mergeTargetMessageSetIndex = overlappingMessageSetIndices.splice(0, 1)[0];
|
|
1009
|
+
|
|
1010
|
+
var mergeSourceMessageSetIndices = _toConsumableArray__default['default'](overlappingMessageSetIndices);
|
|
1011
|
+
|
|
1012
|
+
if (mergeTargetMessageSetIndex !== undefined && mergeTargetMessageSetIndex !== targetMessageSetIndex) {
|
|
1013
|
+
mergeSourceMessageSetIndices.push(targetMessageSetIndex);
|
|
1014
|
+
} // merge message sets
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
if (mergeSourceMessageSetIndices.length > 0) {
|
|
1018
|
+
var target = this.messageSets[mergeTargetMessageSetIndex];
|
|
1019
|
+
var sources = this.messageSets.filter(function (_, i) {
|
|
1020
|
+
return mergeSourceMessageSetIndices.indexOf(i) !== -1;
|
|
1021
|
+
});
|
|
1022
|
+
sources.forEach(function (messageSet) {
|
|
1023
|
+
target.isLatest = target.isLatest || messageSet.isLatest;
|
|
1024
|
+
target.isCurrent = target.isCurrent || messageSet.isCurrent;
|
|
1025
|
+
messagesToAdd = [].concat(_toConsumableArray__default['default'](messagesToAdd), _toConsumableArray__default['default'](messageSet.messages));
|
|
1026
|
+
});
|
|
1027
|
+
sources.forEach(function (s) {
|
|
1028
|
+
return _this5.messageSets.splice(_this5.messageSets.indexOf(s), 1);
|
|
1029
|
+
});
|
|
1030
|
+
var overlappingMessageSetIndex = this.messageSets.findIndex(function (s) {
|
|
1031
|
+
return _this5.areMessageSetsOverlap(s.messages, newMessages);
|
|
1032
|
+
});
|
|
1033
|
+
targetMessageSetIndex = overlappingMessageSetIndex;
|
|
1034
|
+
}
|
|
1035
|
+
} else {
|
|
1036
|
+
// assumes that all new messages belong to the same set
|
|
1037
|
+
targetMessageSetIndex = this.findMessageSetIndex(newMessages[0]);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
return {
|
|
1041
|
+
targetMessageSetIndex: targetMessageSetIndex,
|
|
1042
|
+
messagesToAdd: messagesToAdd
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
728
1045
|
}]);
|
|
729
1046
|
|
|
730
1047
|
return ChannelState;
|
|
@@ -1087,7 +1404,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1087
1404
|
presence: false
|
|
1088
1405
|
};
|
|
1089
1406
|
_context.next = 3;
|
|
1090
|
-
return _this.query(options);
|
|
1407
|
+
return _this.query(options, 'latest');
|
|
1091
1408
|
|
|
1092
1409
|
case 3:
|
|
1093
1410
|
return _context.abrupt("return", _context.sent);
|
|
@@ -2385,14 +2702,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2385
2702
|
value: function lastMessage() {
|
|
2386
2703
|
// get last 5 messages, sort, return the latest
|
|
2387
2704
|
// get a slice of the last 5
|
|
2388
|
-
var min = this.state.
|
|
2705
|
+
var min = this.state.latestMessages.length - 5;
|
|
2389
2706
|
|
|
2390
2707
|
if (min < 0) {
|
|
2391
2708
|
min = 0;
|
|
2392
2709
|
}
|
|
2393
2710
|
|
|
2394
|
-
var max = this.state.
|
|
2395
|
-
var messageSlice = this.state.
|
|
2711
|
+
var max = this.state.latestMessages.length + 1;
|
|
2712
|
+
var messageSlice = this.state.latestMessages.slice(min, max); // sort by pk desc
|
|
2396
2713
|
|
|
2397
2714
|
messageSlice.sort(function (a, b) {
|
|
2398
2715
|
return b.created_at.getTime() - a.created_at.getTime();
|
|
@@ -2501,7 +2818,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2501
2818
|
|
|
2502
2819
|
combined = _objectSpread$5(_objectSpread$5({}, defaultOptions), options);
|
|
2503
2820
|
_context27.next = 7;
|
|
2504
|
-
return this.query(combined);
|
|
2821
|
+
return this.query(combined, 'latest');
|
|
2505
2822
|
|
|
2506
2823
|
case 7:
|
|
2507
2824
|
state = _context27.sent;
|
|
@@ -2575,7 +2892,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2575
2892
|
* getReplies - List the message replies for a parent message
|
|
2576
2893
|
*
|
|
2577
2894
|
* @param {string} parent_id The message parent id, ie the top of the thread
|
|
2578
|
-
* @param {
|
|
2895
|
+
* @param {MessagePaginationOptions & { user?: UserResponse<StreamChatGenerics>; user_id?: string }} options Pagination params, ie {limit:10, id_lte: 10}
|
|
2579
2896
|
*
|
|
2580
2897
|
* @return {Promise<GetRepliesAPIResponse<StreamChatGenerics>>} A response with a list of messages
|
|
2581
2898
|
*/
|
|
@@ -2736,8 +3053,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2736
3053
|
if (!lastRead) return this.state.unreadCount;
|
|
2737
3054
|
var count = 0;
|
|
2738
3055
|
|
|
2739
|
-
for (var i = 0; i < this.state.
|
|
2740
|
-
var message = this.state.
|
|
3056
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
3057
|
+
var message = this.state.latestMessages[i];
|
|
2741
3058
|
|
|
2742
3059
|
if (message.created_at > lastRead && this._countMessageAsUnread(message)) {
|
|
2743
3060
|
count++;
|
|
@@ -2747,7 +3064,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2747
3064
|
return count;
|
|
2748
3065
|
}
|
|
2749
3066
|
/**
|
|
2750
|
-
*
|
|
3067
|
+
* countUnreadMentions - Count the number of unread messages mentioning the current user
|
|
2751
3068
|
*
|
|
2752
3069
|
* @return {number} Unread mentions count
|
|
2753
3070
|
*/
|
|
@@ -2759,10 +3076,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2759
3076
|
var userID = this.getClient().userID;
|
|
2760
3077
|
var count = 0;
|
|
2761
3078
|
|
|
2762
|
-
for (var i = 0; i < this.state.
|
|
3079
|
+
for (var i = 0; i < this.state.latestMessages.length; i += 1) {
|
|
2763
3080
|
var _message$mentioned_us;
|
|
2764
3081
|
|
|
2765
|
-
var message = this.state.
|
|
3082
|
+
var message = this.state.latestMessages[i];
|
|
2766
3083
|
|
|
2767
3084
|
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) {
|
|
2768
3085
|
return user.id === userID;
|
|
@@ -2786,33 +3103,40 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2786
3103
|
* query - Query the API, get messages, members or other channel fields
|
|
2787
3104
|
*
|
|
2788
3105
|
* @param {ChannelQueryOptions<StreamChatGenerics>} options The query options
|
|
3106
|
+
* @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
|
|
2789
3107
|
*
|
|
2790
3108
|
* @return {Promise<ChannelAPIResponse<StreamChatGenerics>>} Returns a query response
|
|
2791
3109
|
*/
|
|
2792
3110
|
function () {
|
|
2793
3111
|
var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee31(options) {
|
|
2794
|
-
var
|
|
3112
|
+
var messageSetToAddToIfDoesNotExist,
|
|
3113
|
+
queryURL,
|
|
3114
|
+
state,
|
|
3115
|
+
membersStr,
|
|
3116
|
+
tempChannelCid,
|
|
3117
|
+
_args31 = arguments;
|
|
2795
3118
|
return _regeneratorRuntime__default['default'].wrap(function _callee31$(_context31) {
|
|
2796
3119
|
while (1) {
|
|
2797
3120
|
switch (_context31.prev = _context31.next) {
|
|
2798
3121
|
case 0:
|
|
2799
|
-
|
|
3122
|
+
messageSetToAddToIfDoesNotExist = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : 'current';
|
|
3123
|
+
_context31.next = 3;
|
|
2800
3124
|
return this.getClient().wsPromise;
|
|
2801
3125
|
|
|
2802
|
-
case
|
|
3126
|
+
case 3:
|
|
2803
3127
|
queryURL = "".concat(this.getClient().baseURL, "/channels/").concat(this.type);
|
|
2804
3128
|
|
|
2805
3129
|
if (this.id) {
|
|
2806
3130
|
queryURL += "/".concat(this.id);
|
|
2807
3131
|
}
|
|
2808
3132
|
|
|
2809
|
-
_context31.next =
|
|
3133
|
+
_context31.next = 7;
|
|
2810
3134
|
return this.getClient().post(queryURL + '/query', _objectSpread$5({
|
|
2811
3135
|
data: this._data,
|
|
2812
3136
|
state: true
|
|
2813
3137
|
}, options));
|
|
2814
3138
|
|
|
2815
|
-
case
|
|
3139
|
+
case 7:
|
|
2816
3140
|
state = _context31.sent;
|
|
2817
3141
|
|
|
2818
3142
|
// update the channel id if it was missing
|
|
@@ -2841,11 +3165,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2841
3165
|
this.getClient()._addChannelConfig(state); // add any messages to our channel state
|
|
2842
3166
|
|
|
2843
3167
|
|
|
2844
|
-
this._initializeState(state);
|
|
3168
|
+
this._initializeState(state, messageSetToAddToIfDoesNotExist);
|
|
2845
3169
|
|
|
2846
3170
|
return _context31.abrupt("return", state);
|
|
2847
3171
|
|
|
2848
|
-
case
|
|
3172
|
+
case 12:
|
|
2849
3173
|
case "end":
|
|
2850
3174
|
return _context31.stop();
|
|
2851
3175
|
}
|
|
@@ -3395,6 +3719,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3395
3719
|
}, {
|
|
3396
3720
|
key: "_initializeState",
|
|
3397
3721
|
value: function _initializeState(state) {
|
|
3722
|
+
var messageSetToAddToIfDoesNotExist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'latest';
|
|
3723
|
+
|
|
3398
3724
|
var _this$getClient2 = this.getClient(),
|
|
3399
3725
|
clientState = _this$getClient2.state,
|
|
3400
3726
|
user = _this$getClient2.user,
|
|
@@ -3424,10 +3750,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3424
3750
|
var messages = state.messages || [];
|
|
3425
3751
|
|
|
3426
3752
|
if (!this.state.messages) {
|
|
3427
|
-
this.state.
|
|
3753
|
+
this.state.initMessages();
|
|
3428
3754
|
}
|
|
3429
3755
|
|
|
3430
|
-
this.state.addMessagesSorted(messages, false, true);
|
|
3756
|
+
this.state.addMessagesSorted(messages, false, true, true, messageSetToAddToIfDoesNotExist);
|
|
3431
3757
|
|
|
3432
3758
|
if (!this.state.pinnedMessages) {
|
|
3433
3759
|
this.state.pinnedMessages = [];
|
|
@@ -4849,7 +5175,7 @@ function TokenManager(secret) {
|
|
|
4849
5175
|
_defineProperty__default['default'](this, "loadToken", function () {
|
|
4850
5176
|
// eslint-disable-next-line no-async-promise-executor
|
|
4851
5177
|
_this.loadTokenPromise = new Promise( /*#__PURE__*/function () {
|
|
4852
|
-
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(resolve) {
|
|
5178
|
+
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(resolve, reject) {
|
|
4853
5179
|
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
4854
5180
|
while (1) {
|
|
4855
5181
|
switch (_context2.prev = _context2.next) {
|
|
@@ -4863,26 +5189,36 @@ function TokenManager(secret) {
|
|
|
4863
5189
|
|
|
4864
5190
|
case 2:
|
|
4865
5191
|
if (!(_this.tokenProvider && typeof _this.tokenProvider !== 'string')) {
|
|
4866
|
-
_context2.next =
|
|
5192
|
+
_context2.next = 13;
|
|
4867
5193
|
break;
|
|
4868
5194
|
}
|
|
4869
5195
|
|
|
4870
|
-
_context2.
|
|
5196
|
+
_context2.prev = 3;
|
|
5197
|
+
_context2.next = 6;
|
|
4871
5198
|
return _this.tokenProvider();
|
|
4872
5199
|
|
|
4873
|
-
case
|
|
5200
|
+
case 6:
|
|
4874
5201
|
_this.token = _context2.sent;
|
|
5202
|
+
_context2.next = 12;
|
|
5203
|
+
break;
|
|
5204
|
+
|
|
5205
|
+
case 9:
|
|
5206
|
+
_context2.prev = 9;
|
|
5207
|
+
_context2.t0 = _context2["catch"](3);
|
|
5208
|
+
return _context2.abrupt("return", reject(new Error("Call to tokenProvider failed with message: ".concat(_context2.t0))));
|
|
5209
|
+
|
|
5210
|
+
case 12:
|
|
4875
5211
|
resolve(_this.token);
|
|
4876
5212
|
|
|
4877
|
-
case
|
|
5213
|
+
case 13:
|
|
4878
5214
|
case "end":
|
|
4879
5215
|
return _context2.stop();
|
|
4880
5216
|
}
|
|
4881
5217
|
}
|
|
4882
|
-
}, _callee2);
|
|
5218
|
+
}, _callee2, null, [[3, 9]]);
|
|
4883
5219
|
}));
|
|
4884
5220
|
|
|
4885
|
-
return function (_x3) {
|
|
5221
|
+
return function (_x3, _x4) {
|
|
4886
5222
|
return _ref2.apply(this, arguments);
|
|
4887
5223
|
};
|
|
4888
5224
|
}());
|
|
@@ -6392,30 +6728,31 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6392
6728
|
key: "updateAppSettings",
|
|
6393
6729
|
value:
|
|
6394
6730
|
/**
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6731
|
+
* updateAppSettings - updates application settings
|
|
6732
|
+
*
|
|
6733
|
+
* @param {AppSettings} options App settings.
|
|
6734
|
+
* IE: {
|
|
6735
|
+
'apn_config': {
|
|
6736
|
+
'auth_type': 'token',
|
|
6737
|
+
'auth_key": fs.readFileSync(
|
|
6738
|
+
'./apn-push-auth-key.p8',
|
|
6739
|
+
'utf-8',
|
|
6740
|
+
),
|
|
6741
|
+
'key_id': 'keyid',
|
|
6742
|
+
'team_id': 'teamid',
|
|
6743
|
+
'notification_template": 'notification handlebars template',
|
|
6744
|
+
'bundle_id': 'com.apple.your.app',
|
|
6745
|
+
'development': true
|
|
6746
|
+
},
|
|
6747
|
+
'firebase_config': {
|
|
6748
|
+
'server_key': 'server key from fcm',
|
|
6749
|
+
'notification_template': 'notification handlebars template',
|
|
6750
|
+
'data_template': 'data handlebars template',
|
|
6751
|
+
'apn_template': 'apn notification handlebars template under v2'
|
|
6752
|
+
},
|
|
6753
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
6754
|
+
}
|
|
6755
|
+
*/
|
|
6419
6756
|
function () {
|
|
6420
6757
|
var _updateAppSettings = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee7(options) {
|
|
6421
6758
|
var _options$apn_config;
|
|
@@ -6606,17 +6943,19 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6606
6943
|
return getAppSettings;
|
|
6607
6944
|
}()
|
|
6608
6945
|
/**
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6946
|
+
* testPushSettings - Tests the push settings for a user with a random chat message and the configured push templates
|
|
6947
|
+
*
|
|
6948
|
+
* @param {string} userID User ID. If user has no devices, it will error
|
|
6949
|
+
* @param {TestPushDataInput} [data] Overrides for push templates/message used
|
|
6950
|
+
* IE: {
|
|
6951
|
+
messageID: 'id-of-message', // will error if message does not exist
|
|
6952
|
+
apnTemplate: '{}', // if app doesn't have apn configured it will error
|
|
6953
|
+
firebaseTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6954
|
+
firebaseDataTemplate: '{}', // if app doesn't have firebase configured it will error
|
|
6955
|
+
skipDevices: true, // skip config/device checks and sending to real devices
|
|
6956
|
+
pushProviderName: 'staging' // one of your configured push providers
|
|
6957
|
+
pushProviderType: 'apn' // one of supported provider types
|
|
6958
|
+
}
|
|
6620
6959
|
*/
|
|
6621
6960
|
|
|
6622
6961
|
}, {
|
|
@@ -6631,7 +6970,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6631
6970
|
case 0:
|
|
6632
6971
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
6633
6972
|
_context12.next = 3;
|
|
6634
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6973
|
+
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
6635
6974
|
user_id: userID
|
|
6636
6975
|
}, data.messageID ? {
|
|
6637
6976
|
message_id: data.messageID
|
|
@@ -6643,6 +6982,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6643
6982
|
firebase_data_template: data.firebaseDataTemplate
|
|
6644
6983
|
} : {}), data.skipDevices ? {
|
|
6645
6984
|
skip_devices: true
|
|
6985
|
+
} : {}), data.pushProviderName ? {
|
|
6986
|
+
push_provider_name: data.pushProviderName
|
|
6987
|
+
} : {}), data.pushProviderType ? {
|
|
6988
|
+
push_provider_type: data.pushProviderType
|
|
6646
6989
|
} : {}));
|
|
6647
6990
|
|
|
6648
6991
|
case 3:
|
|
@@ -6666,11 +7009,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
6666
7009
|
* testSQSSettings - Tests that the given or configured SQS configuration is valid
|
|
6667
7010
|
*
|
|
6668
7011
|
* @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
|
|
6669
|
-
*
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
7012
|
+
* IE: {
|
|
7013
|
+
sqs_key: 'auth_key',
|
|
7014
|
+
sqs_secret: 'auth_secret',
|
|
7015
|
+
sqs_url: 'url_to_queue',
|
|
7016
|
+
}
|
|
6674
7017
|
*/
|
|
6675
7018
|
|
|
6676
7019
|
}, {
|
|
@@ -7025,7 +7368,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7025
7368
|
this.mutedUsers = event.me.mutes;
|
|
7026
7369
|
}
|
|
7027
7370
|
|
|
7028
|
-
if (event.type === 'notification.mark_read') {
|
|
7371
|
+
if (event.type === 'notification.mark_read' && event.unread_channels === 0) {
|
|
7029
7372
|
var activeChannelKeys = Object.keys(this.activeChannels);
|
|
7030
7373
|
activeChannelKeys.forEach(function (activeChannelKey) {
|
|
7031
7374
|
return _this3.activeChannels[activeChannelKey].state.unreadCount = 0;
|
|
@@ -7467,11 +7810,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7467
7810
|
c.initialized = true;
|
|
7468
7811
|
|
|
7469
7812
|
if (skipInitialization === undefined) {
|
|
7470
|
-
c._initializeState(_channelState);
|
|
7813
|
+
c._initializeState(_channelState, 'latest');
|
|
7471
7814
|
} else if (!skipInitialization.includes(_channelState.channel.id)) {
|
|
7472
7815
|
c.state.clearMessages();
|
|
7473
7816
|
|
|
7474
|
-
c._initializeState(_channelState);
|
|
7817
|
+
c._initializeState(_channelState, 'latest');
|
|
7475
7818
|
}
|
|
7476
7819
|
|
|
7477
7820
|
channels.push(c);
|
|
@@ -7608,23 +7951,26 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7608
7951
|
* @param {string} id the device id
|
|
7609
7952
|
* @param {PushProvider} push_provider the push provider
|
|
7610
7953
|
* @param {string} [userID] the user id (defaults to current user)
|
|
7954
|
+
* @param {string} [push_provider_name] user provided push provider name for multi bundle support
|
|
7611
7955
|
*
|
|
7612
7956
|
*/
|
|
7613
7957
|
|
|
7614
7958
|
}, {
|
|
7615
7959
|
key: "addDevice",
|
|
7616
7960
|
value: function () {
|
|
7617
|
-
var _addDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee21(id, push_provider, userID) {
|
|
7961
|
+
var _addDevice = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee21(id, push_provider, userID, push_provider_name) {
|
|
7618
7962
|
return _regeneratorRuntime__default['default'].wrap(function _callee21$(_context21) {
|
|
7619
7963
|
while (1) {
|
|
7620
7964
|
switch (_context21.prev = _context21.next) {
|
|
7621
7965
|
case 0:
|
|
7622
7966
|
_context21.next = 2;
|
|
7623
|
-
return this.post(this.baseURL + '/devices', _objectSpread({
|
|
7967
|
+
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
7624
7968
|
id: id,
|
|
7625
7969
|
push_provider: push_provider
|
|
7626
7970
|
}, userID != null ? {
|
|
7627
7971
|
user_id: userID
|
|
7972
|
+
} : {}), push_provider_name != null ? {
|
|
7973
|
+
push_provider_name: push_provider_name
|
|
7628
7974
|
} : {}));
|
|
7629
7975
|
|
|
7630
7976
|
case 2:
|
|
@@ -7638,7 +7984,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7638
7984
|
}, _callee21, this);
|
|
7639
7985
|
}));
|
|
7640
7986
|
|
|
7641
|
-
function addDevice(_x20, _x21, _x22) {
|
|
7987
|
+
function addDevice(_x20, _x21, _x22, _x23) {
|
|
7642
7988
|
return _addDevice.apply(this, arguments);
|
|
7643
7989
|
}
|
|
7644
7990
|
|
|
@@ -7676,7 +8022,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7676
8022
|
}, _callee22, this);
|
|
7677
8023
|
}));
|
|
7678
8024
|
|
|
7679
|
-
function getDevices(
|
|
8025
|
+
function getDevices(_x24) {
|
|
7680
8026
|
return _getDevices.apply(this, arguments);
|
|
7681
8027
|
}
|
|
7682
8028
|
|
|
@@ -7716,7 +8062,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7716
8062
|
}, _callee23, this);
|
|
7717
8063
|
}));
|
|
7718
8064
|
|
|
7719
|
-
function removeDevice(
|
|
8065
|
+
function removeDevice(_x25, _x26) {
|
|
7720
8066
|
return _removeDevice.apply(this, arguments);
|
|
7721
8067
|
}
|
|
7722
8068
|
|
|
@@ -7757,7 +8103,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7757
8103
|
}, _callee24, this);
|
|
7758
8104
|
}));
|
|
7759
8105
|
|
|
7760
|
-
function getRateLimits(
|
|
8106
|
+
function getRateLimits(_x27) {
|
|
7761
8107
|
return _getRateLimits.apply(this, arguments);
|
|
7762
8108
|
}
|
|
7763
8109
|
|
|
@@ -7858,7 +8204,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7858
8204
|
}, _callee25, this);
|
|
7859
8205
|
}));
|
|
7860
8206
|
|
|
7861
|
-
function partialUpdateUser(
|
|
8207
|
+
function partialUpdateUser(_x28) {
|
|
7862
8208
|
return _partialUpdateUser.apply(this, arguments);
|
|
7863
8209
|
}
|
|
7864
8210
|
|
|
@@ -7944,7 +8290,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7944
8290
|
}, _callee26, this, [[2, 13, 16, 19]]);
|
|
7945
8291
|
}));
|
|
7946
8292
|
|
|
7947
|
-
function upsertUsers(
|
|
8293
|
+
function upsertUsers(_x29) {
|
|
7948
8294
|
return _upsertUsers.apply(this, arguments);
|
|
7949
8295
|
}
|
|
7950
8296
|
|
|
@@ -8057,7 +8403,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8057
8403
|
}, _callee27, this, [[1, 11, 14, 17]]);
|
|
8058
8404
|
}));
|
|
8059
8405
|
|
|
8060
|
-
function partialUpdateUsers(
|
|
8406
|
+
function partialUpdateUsers(_x30) {
|
|
8061
8407
|
return _partialUpdateUsers.apply(this, arguments);
|
|
8062
8408
|
}
|
|
8063
8409
|
|
|
@@ -8085,7 +8431,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8085
8431
|
}, _callee28, this);
|
|
8086
8432
|
}));
|
|
8087
8433
|
|
|
8088
|
-
function deleteUser(
|
|
8434
|
+
function deleteUser(_x31, _x32) {
|
|
8089
8435
|
return _deleteUser.apply(this, arguments);
|
|
8090
8436
|
}
|
|
8091
8437
|
|
|
@@ -8113,7 +8459,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8113
8459
|
}, _callee29, this);
|
|
8114
8460
|
}));
|
|
8115
8461
|
|
|
8116
|
-
function reactivateUser(
|
|
8462
|
+
function reactivateUser(_x33, _x34) {
|
|
8117
8463
|
return _reactivateUser.apply(this, arguments);
|
|
8118
8464
|
}
|
|
8119
8465
|
|
|
@@ -8141,7 +8487,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8141
8487
|
}, _callee30, this);
|
|
8142
8488
|
}));
|
|
8143
8489
|
|
|
8144
|
-
function deactivateUser(
|
|
8490
|
+
function deactivateUser(_x35, _x36) {
|
|
8145
8491
|
return _deactivateUser.apply(this, arguments);
|
|
8146
8492
|
}
|
|
8147
8493
|
|
|
@@ -8169,7 +8515,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8169
8515
|
}, _callee31, this);
|
|
8170
8516
|
}));
|
|
8171
8517
|
|
|
8172
|
-
function exportUser(
|
|
8518
|
+
function exportUser(_x37, _x38) {
|
|
8173
8519
|
return _exportUser.apply(this, arguments);
|
|
8174
8520
|
}
|
|
8175
8521
|
|
|
@@ -8206,7 +8552,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8206
8552
|
}, _callee32, this);
|
|
8207
8553
|
}));
|
|
8208
8554
|
|
|
8209
|
-
function banUser(
|
|
8555
|
+
function banUser(_x39, _x40) {
|
|
8210
8556
|
return _banUser.apply(this, arguments);
|
|
8211
8557
|
}
|
|
8212
8558
|
|
|
@@ -8243,7 +8589,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8243
8589
|
}, _callee33, this);
|
|
8244
8590
|
}));
|
|
8245
8591
|
|
|
8246
|
-
function unbanUser(
|
|
8592
|
+
function unbanUser(_x41, _x42) {
|
|
8247
8593
|
return _unbanUser.apply(this, arguments);
|
|
8248
8594
|
}
|
|
8249
8595
|
|
|
@@ -8280,7 +8626,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8280
8626
|
}, _callee34, this);
|
|
8281
8627
|
}));
|
|
8282
8628
|
|
|
8283
|
-
function shadowBan(
|
|
8629
|
+
function shadowBan(_x43, _x44) {
|
|
8284
8630
|
return _shadowBan.apply(this, arguments);
|
|
8285
8631
|
}
|
|
8286
8632
|
|
|
@@ -8317,7 +8663,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8317
8663
|
}, _callee35, this);
|
|
8318
8664
|
}));
|
|
8319
8665
|
|
|
8320
|
-
function removeShadowBan(
|
|
8666
|
+
function removeShadowBan(_x45, _x46) {
|
|
8321
8667
|
return _removeShadowBan.apply(this, arguments);
|
|
8322
8668
|
}
|
|
8323
8669
|
|
|
@@ -8360,7 +8706,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8360
8706
|
}, _callee36, this);
|
|
8361
8707
|
}));
|
|
8362
8708
|
|
|
8363
|
-
function muteUser(
|
|
8709
|
+
function muteUser(_x47, _x48) {
|
|
8364
8710
|
return _muteUser.apply(this, arguments);
|
|
8365
8711
|
}
|
|
8366
8712
|
|
|
@@ -8399,7 +8745,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8399
8745
|
}, _callee37, this);
|
|
8400
8746
|
}));
|
|
8401
8747
|
|
|
8402
|
-
function unmuteUser(
|
|
8748
|
+
function unmuteUser(_x49, _x50) {
|
|
8403
8749
|
return _unmuteUser.apply(this, arguments);
|
|
8404
8750
|
}
|
|
8405
8751
|
|
|
@@ -8458,7 +8804,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8458
8804
|
}, _callee38, this);
|
|
8459
8805
|
}));
|
|
8460
8806
|
|
|
8461
|
-
function flagMessage(
|
|
8807
|
+
function flagMessage(_x51) {
|
|
8462
8808
|
return _flagMessage.apply(this, arguments);
|
|
8463
8809
|
}
|
|
8464
8810
|
|
|
@@ -8498,7 +8844,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8498
8844
|
}, _callee39, this);
|
|
8499
8845
|
}));
|
|
8500
8846
|
|
|
8501
|
-
function flagUser(
|
|
8847
|
+
function flagUser(_x52) {
|
|
8502
8848
|
return _flagUser.apply(this, arguments);
|
|
8503
8849
|
}
|
|
8504
8850
|
|
|
@@ -8538,7 +8884,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8538
8884
|
}, _callee40, this);
|
|
8539
8885
|
}));
|
|
8540
8886
|
|
|
8541
|
-
function unflagMessage(
|
|
8887
|
+
function unflagMessage(_x53) {
|
|
8542
8888
|
return _unflagMessage.apply(this, arguments);
|
|
8543
8889
|
}
|
|
8544
8890
|
|
|
@@ -8578,7 +8924,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8578
8924
|
}, _callee41, this);
|
|
8579
8925
|
}));
|
|
8580
8926
|
|
|
8581
|
-
function unflagUser(
|
|
8927
|
+
function unflagUser(_x54) {
|
|
8582
8928
|
return _unflagUser.apply(this, arguments);
|
|
8583
8929
|
}
|
|
8584
8930
|
|
|
@@ -8724,7 +9070,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8724
9070
|
}, _callee44, this);
|
|
8725
9071
|
}));
|
|
8726
9072
|
|
|
8727
|
-
function _reviewFlagReport(
|
|
9073
|
+
function _reviewFlagReport(_x55, _x56) {
|
|
8728
9074
|
return _reviewFlagReport2.apply(this, arguments);
|
|
8729
9075
|
}
|
|
8730
9076
|
|
|
@@ -8770,7 +9116,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8770
9116
|
}, _callee45, this);
|
|
8771
9117
|
}));
|
|
8772
9118
|
|
|
8773
|
-
function _unblockMessage(
|
|
9119
|
+
function _unblockMessage(_x57) {
|
|
8774
9120
|
return _unblockMessage2.apply(this, arguments);
|
|
8775
9121
|
}
|
|
8776
9122
|
|
|
@@ -8909,7 +9255,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8909
9255
|
}, _callee47, this);
|
|
8910
9256
|
}));
|
|
8911
9257
|
|
|
8912
|
-
function translateMessage(
|
|
9258
|
+
function translateMessage(_x58, _x59) {
|
|
8913
9259
|
return _translateMessage.apply(this, arguments);
|
|
8914
9260
|
}
|
|
8915
9261
|
|
|
@@ -9071,7 +9417,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9071
9417
|
}, _callee48, this);
|
|
9072
9418
|
}));
|
|
9073
9419
|
|
|
9074
|
-
function updateMessage(
|
|
9420
|
+
function updateMessage(_x60, _x61, _x62) {
|
|
9075
9421
|
return _updateMessage.apply(this, arguments);
|
|
9076
9422
|
}
|
|
9077
9423
|
|
|
@@ -9132,7 +9478,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9132
9478
|
}, _callee49, this);
|
|
9133
9479
|
}));
|
|
9134
9480
|
|
|
9135
|
-
function partialUpdateMessage(
|
|
9481
|
+
function partialUpdateMessage(_x63, _x64, _x65, _x66) {
|
|
9136
9482
|
return _partialUpdateMessage.apply(this, arguments);
|
|
9137
9483
|
}
|
|
9138
9484
|
|
|
@@ -9169,7 +9515,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9169
9515
|
}, _callee50, this);
|
|
9170
9516
|
}));
|
|
9171
9517
|
|
|
9172
|
-
function deleteMessage(
|
|
9518
|
+
function deleteMessage(_x67, _x68) {
|
|
9173
9519
|
return _deleteMessage.apply(this, arguments);
|
|
9174
9520
|
}
|
|
9175
9521
|
|
|
@@ -9197,7 +9543,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9197
9543
|
}, _callee51, this);
|
|
9198
9544
|
}));
|
|
9199
9545
|
|
|
9200
|
-
function getMessage(
|
|
9546
|
+
function getMessage(_x69) {
|
|
9201
9547
|
return _getMessage.apply(this, arguments);
|
|
9202
9548
|
}
|
|
9203
9549
|
|
|
@@ -9206,7 +9552,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9206
9552
|
}, {
|
|
9207
9553
|
key: "getUserAgent",
|
|
9208
9554
|
value: function getUserAgent() {
|
|
9209
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.
|
|
9555
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.5.0");
|
|
9210
9556
|
}
|
|
9211
9557
|
}, {
|
|
9212
9558
|
key: "setUserAgent",
|
|
@@ -9422,7 +9768,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9422
9768
|
}, _callee52, this);
|
|
9423
9769
|
}));
|
|
9424
9770
|
|
|
9425
|
-
function sendUserCustomEvent(
|
|
9771
|
+
function sendUserCustomEvent(_x70, _x71) {
|
|
9426
9772
|
return _sendUserCustomEvent.apply(this, arguments);
|
|
9427
9773
|
}
|
|
9428
9774
|
|
|
@@ -9515,7 +9861,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9515
9861
|
}, _callee53, this);
|
|
9516
9862
|
}));
|
|
9517
9863
|
|
|
9518
|
-
function createSegment(
|
|
9864
|
+
function createSegment(_x72) {
|
|
9519
9865
|
return _createSegment.apply(this, arguments);
|
|
9520
9866
|
}
|
|
9521
9867
|
|
|
@@ -9555,7 +9901,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9555
9901
|
}, _callee54, this);
|
|
9556
9902
|
}));
|
|
9557
9903
|
|
|
9558
|
-
function getSegment(
|
|
9904
|
+
function getSegment(_x73) {
|
|
9559
9905
|
return _getSegment.apply(this, arguments);
|
|
9560
9906
|
}
|
|
9561
9907
|
|
|
@@ -9594,7 +9940,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9594
9940
|
}, _callee55, this);
|
|
9595
9941
|
}));
|
|
9596
9942
|
|
|
9597
|
-
function listSegments(
|
|
9943
|
+
function listSegments(_x74) {
|
|
9598
9944
|
return _listSegments.apply(this, arguments);
|
|
9599
9945
|
}
|
|
9600
9946
|
|
|
@@ -9637,7 +9983,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9637
9983
|
}, _callee56, this);
|
|
9638
9984
|
}));
|
|
9639
9985
|
|
|
9640
|
-
function updateSegment(
|
|
9986
|
+
function updateSegment(_x75, _x76) {
|
|
9641
9987
|
return _updateSegment.apply(this, arguments);
|
|
9642
9988
|
}
|
|
9643
9989
|
|
|
@@ -9669,7 +10015,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9669
10015
|
}, _callee57, this);
|
|
9670
10016
|
}));
|
|
9671
10017
|
|
|
9672
|
-
function deleteSegment(
|
|
10018
|
+
function deleteSegment(_x77) {
|
|
9673
10019
|
return _deleteSegment.apply(this, arguments);
|
|
9674
10020
|
}
|
|
9675
10021
|
|
|
@@ -9711,7 +10057,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9711
10057
|
}, _callee58, this);
|
|
9712
10058
|
}));
|
|
9713
10059
|
|
|
9714
|
-
function createCampaign(
|
|
10060
|
+
function createCampaign(_x78) {
|
|
9715
10061
|
return _createCampaign.apply(this, arguments);
|
|
9716
10062
|
}
|
|
9717
10063
|
|
|
@@ -9751,7 +10097,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9751
10097
|
}, _callee59, this);
|
|
9752
10098
|
}));
|
|
9753
10099
|
|
|
9754
|
-
function getCampaign(
|
|
10100
|
+
function getCampaign(_x79) {
|
|
9755
10101
|
return _getCampaign.apply(this, arguments);
|
|
9756
10102
|
}
|
|
9757
10103
|
|
|
@@ -9790,7 +10136,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9790
10136
|
}, _callee60, this);
|
|
9791
10137
|
}));
|
|
9792
10138
|
|
|
9793
|
-
function listCampaigns(
|
|
10139
|
+
function listCampaigns(_x80) {
|
|
9794
10140
|
return _listCampaigns.apply(this, arguments);
|
|
9795
10141
|
}
|
|
9796
10142
|
|
|
@@ -9833,7 +10179,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9833
10179
|
}, _callee61, this);
|
|
9834
10180
|
}));
|
|
9835
10181
|
|
|
9836
|
-
function updateCampaign(
|
|
10182
|
+
function updateCampaign(_x81, _x82) {
|
|
9837
10183
|
return _updateCampaign.apply(this, arguments);
|
|
9838
10184
|
}
|
|
9839
10185
|
|
|
@@ -9865,7 +10211,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9865
10211
|
}, _callee62, this);
|
|
9866
10212
|
}));
|
|
9867
10213
|
|
|
9868
|
-
function deleteCampaign(
|
|
10214
|
+
function deleteCampaign(_x83) {
|
|
9869
10215
|
return _deleteCampaign.apply(this, arguments);
|
|
9870
10216
|
}
|
|
9871
10217
|
|
|
@@ -9909,7 +10255,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9909
10255
|
}, _callee63, this);
|
|
9910
10256
|
}));
|
|
9911
10257
|
|
|
9912
|
-
function scheduleCampaign(
|
|
10258
|
+
function scheduleCampaign(_x84, _x85) {
|
|
9913
10259
|
return _scheduleCampaign.apply(this, arguments);
|
|
9914
10260
|
}
|
|
9915
10261
|
|
|
@@ -9949,7 +10295,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9949
10295
|
}, _callee64, this);
|
|
9950
10296
|
}));
|
|
9951
10297
|
|
|
9952
|
-
function stopCampaign(
|
|
10298
|
+
function stopCampaign(_x86) {
|
|
9953
10299
|
return _stopCampaign.apply(this, arguments);
|
|
9954
10300
|
}
|
|
9955
10301
|
|
|
@@ -9989,7 +10335,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
9989
10335
|
}, _callee65, this);
|
|
9990
10336
|
}));
|
|
9991
10337
|
|
|
9992
|
-
function resumeCampaign(
|
|
10338
|
+
function resumeCampaign(_x87) {
|
|
9993
10339
|
return _resumeCampaign.apply(this, arguments);
|
|
9994
10340
|
}
|
|
9995
10341
|
|
|
@@ -10032,7 +10378,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10032
10378
|
}, _callee66, this);
|
|
10033
10379
|
}));
|
|
10034
10380
|
|
|
10035
|
-
function testCampaign(
|
|
10381
|
+
function testCampaign(_x88, _x89) {
|
|
10036
10382
|
return _testCampaign.apply(this, arguments);
|
|
10037
10383
|
}
|
|
10038
10384
|
|
|
@@ -10065,7 +10411,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10065
10411
|
}, _callee67, this);
|
|
10066
10412
|
}));
|
|
10067
10413
|
|
|
10068
|
-
function enrichURL(
|
|
10414
|
+
function enrichURL(_x90) {
|
|
10069
10415
|
return _enrichURL.apply(this, arguments);
|
|
10070
10416
|
}
|
|
10071
10417
|
|
|
@@ -10097,7 +10443,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10097
10443
|
}, _callee68, this);
|
|
10098
10444
|
}));
|
|
10099
10445
|
|
|
10100
|
-
function getTask(
|
|
10446
|
+
function getTask(_x91) {
|
|
10101
10447
|
return _getTask.apply(this, arguments);
|
|
10102
10448
|
}
|
|
10103
10449
|
|
|
@@ -10139,7 +10485,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10139
10485
|
}, _callee69, this);
|
|
10140
10486
|
}));
|
|
10141
10487
|
|
|
10142
|
-
function deleteChannels(
|
|
10488
|
+
function deleteChannels(_x92) {
|
|
10143
10489
|
return _deleteChannels.apply(this, arguments);
|
|
10144
10490
|
}
|
|
10145
10491
|
|
|
@@ -10202,7 +10548,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10202
10548
|
}, _callee70, this);
|
|
10203
10549
|
}));
|
|
10204
10550
|
|
|
10205
|
-
function deleteUsers(
|
|
10551
|
+
function deleteUsers(_x93, _x94) {
|
|
10206
10552
|
return _deleteUsers.apply(this, arguments);
|
|
10207
10553
|
}
|
|
10208
10554
|
|
|
@@ -10217,7 +10563,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10217
10563
|
*
|
|
10218
10564
|
* @private
|
|
10219
10565
|
* @param {string} filename filename of uploaded data
|
|
10220
|
-
*
|
|
10221
10566
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10222
10567
|
*/
|
|
10223
10568
|
|
|
@@ -10245,7 +10590,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10245
10590
|
}, _callee71, this);
|
|
10246
10591
|
}));
|
|
10247
10592
|
|
|
10248
|
-
function _createImportURL(
|
|
10593
|
+
function _createImportURL(_x95) {
|
|
10249
10594
|
return _createImportURL2.apply(this, arguments);
|
|
10250
10595
|
}
|
|
10251
10596
|
|
|
@@ -10260,7 +10605,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10260
10605
|
*
|
|
10261
10606
|
* @private
|
|
10262
10607
|
* @param {string} path path of uploaded data
|
|
10263
|
-
*
|
|
10608
|
+
* @param {CreateImportOptions} options import options
|
|
10264
10609
|
* @return {APIResponse & CreateImportResponse} An ImportTask
|
|
10265
10610
|
*/
|
|
10266
10611
|
|
|
@@ -10268,19 +10613,24 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10268
10613
|
key: "_createImport",
|
|
10269
10614
|
value: function () {
|
|
10270
10615
|
var _createImport2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee72(path) {
|
|
10616
|
+
var options,
|
|
10617
|
+
_args72 = arguments;
|
|
10271
10618
|
return _regeneratorRuntime__default['default'].wrap(function _callee72$(_context72) {
|
|
10272
10619
|
while (1) {
|
|
10273
10620
|
switch (_context72.prev = _context72.next) {
|
|
10274
10621
|
case 0:
|
|
10275
|
-
|
|
10276
|
-
|
|
10622
|
+
options = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {
|
|
10623
|
+
mode: 'upsert'
|
|
10624
|
+
};
|
|
10625
|
+
_context72.next = 3;
|
|
10626
|
+
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
10277
10627
|
path: path
|
|
10278
|
-
});
|
|
10628
|
+
}, options));
|
|
10279
10629
|
|
|
10280
|
-
case
|
|
10630
|
+
case 3:
|
|
10281
10631
|
return _context72.abrupt("return", _context72.sent);
|
|
10282
10632
|
|
|
10283
|
-
case
|
|
10633
|
+
case 4:
|
|
10284
10634
|
case "end":
|
|
10285
10635
|
return _context72.stop();
|
|
10286
10636
|
}
|
|
@@ -10288,7 +10638,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10288
10638
|
}, _callee72, this);
|
|
10289
10639
|
}));
|
|
10290
10640
|
|
|
10291
|
-
function _createImport(
|
|
10641
|
+
function _createImport(_x96) {
|
|
10292
10642
|
return _createImport2.apply(this, arguments);
|
|
10293
10643
|
}
|
|
10294
10644
|
|
|
@@ -10329,7 +10679,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10329
10679
|
}, _callee73, this);
|
|
10330
10680
|
}));
|
|
10331
10681
|
|
|
10332
|
-
function _getImport(
|
|
10682
|
+
function _getImport(_x97) {
|
|
10333
10683
|
return _getImport2.apply(this, arguments);
|
|
10334
10684
|
}
|
|
10335
10685
|
|
|
@@ -10370,12 +10720,128 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10370
10720
|
}, _callee74, this);
|
|
10371
10721
|
}));
|
|
10372
10722
|
|
|
10373
|
-
function _listImports(
|
|
10723
|
+
function _listImports(_x98) {
|
|
10374
10724
|
return _listImports2.apply(this, arguments);
|
|
10375
10725
|
}
|
|
10376
10726
|
|
|
10377
10727
|
return _listImports;
|
|
10378
10728
|
}()
|
|
10729
|
+
/**
|
|
10730
|
+
* upsertPushProvider - Create or Update a push provider
|
|
10731
|
+
*
|
|
10732
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10733
|
+
*
|
|
10734
|
+
* @param {PushProviderConfig} configuration of the provider you want to create or update
|
|
10735
|
+
*
|
|
10736
|
+
* @return {APIResponse & PushProviderUpsertResponse} A push provider
|
|
10737
|
+
*/
|
|
10738
|
+
|
|
10739
|
+
}, {
|
|
10740
|
+
key: "upsertPushProvider",
|
|
10741
|
+
value: function () {
|
|
10742
|
+
var _upsertPushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee75(pushProvider) {
|
|
10743
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee75$(_context75) {
|
|
10744
|
+
while (1) {
|
|
10745
|
+
switch (_context75.prev = _context75.next) {
|
|
10746
|
+
case 0:
|
|
10747
|
+
_context75.next = 2;
|
|
10748
|
+
return this.post(this.baseURL + "/push_providers", {
|
|
10749
|
+
push_provider: pushProvider
|
|
10750
|
+
});
|
|
10751
|
+
|
|
10752
|
+
case 2:
|
|
10753
|
+
return _context75.abrupt("return", _context75.sent);
|
|
10754
|
+
|
|
10755
|
+
case 3:
|
|
10756
|
+
case "end":
|
|
10757
|
+
return _context75.stop();
|
|
10758
|
+
}
|
|
10759
|
+
}
|
|
10760
|
+
}, _callee75, this);
|
|
10761
|
+
}));
|
|
10762
|
+
|
|
10763
|
+
function upsertPushProvider(_x99) {
|
|
10764
|
+
return _upsertPushProvider.apply(this, arguments);
|
|
10765
|
+
}
|
|
10766
|
+
|
|
10767
|
+
return upsertPushProvider;
|
|
10768
|
+
}()
|
|
10769
|
+
/**
|
|
10770
|
+
* deletePushProvider - Delete a push provider
|
|
10771
|
+
*
|
|
10772
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10773
|
+
*
|
|
10774
|
+
* @param {PushProviderID} type and foreign id of the push provider to be deleted
|
|
10775
|
+
*
|
|
10776
|
+
* @return {APIResponse} An API response
|
|
10777
|
+
*/
|
|
10778
|
+
|
|
10779
|
+
}, {
|
|
10780
|
+
key: "deletePushProvider",
|
|
10781
|
+
value: function () {
|
|
10782
|
+
var _deletePushProvider = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee76(_ref8) {
|
|
10783
|
+
var type, name;
|
|
10784
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee76$(_context76) {
|
|
10785
|
+
while (1) {
|
|
10786
|
+
switch (_context76.prev = _context76.next) {
|
|
10787
|
+
case 0:
|
|
10788
|
+
type = _ref8.type, name = _ref8.name;
|
|
10789
|
+
_context76.next = 3;
|
|
10790
|
+
return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
|
|
10791
|
+
|
|
10792
|
+
case 3:
|
|
10793
|
+
return _context76.abrupt("return", _context76.sent);
|
|
10794
|
+
|
|
10795
|
+
case 4:
|
|
10796
|
+
case "end":
|
|
10797
|
+
return _context76.stop();
|
|
10798
|
+
}
|
|
10799
|
+
}
|
|
10800
|
+
}, _callee76, this);
|
|
10801
|
+
}));
|
|
10802
|
+
|
|
10803
|
+
function deletePushProvider(_x100) {
|
|
10804
|
+
return _deletePushProvider.apply(this, arguments);
|
|
10805
|
+
}
|
|
10806
|
+
|
|
10807
|
+
return deletePushProvider;
|
|
10808
|
+
}()
|
|
10809
|
+
/**
|
|
10810
|
+
* listPushProviders - Get all push providers in the app
|
|
10811
|
+
*
|
|
10812
|
+
* Note: Works only for v2 push version is enabled on app settings.
|
|
10813
|
+
*
|
|
10814
|
+
* @return {APIResponse & PushProviderListResponse} A push provider
|
|
10815
|
+
*/
|
|
10816
|
+
|
|
10817
|
+
}, {
|
|
10818
|
+
key: "listPushProviders",
|
|
10819
|
+
value: function () {
|
|
10820
|
+
var _listPushProviders = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee77() {
|
|
10821
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee77$(_context77) {
|
|
10822
|
+
while (1) {
|
|
10823
|
+
switch (_context77.prev = _context77.next) {
|
|
10824
|
+
case 0:
|
|
10825
|
+
_context77.next = 2;
|
|
10826
|
+
return this.get(this.baseURL + "/push_providers");
|
|
10827
|
+
|
|
10828
|
+
case 2:
|
|
10829
|
+
return _context77.abrupt("return", _context77.sent);
|
|
10830
|
+
|
|
10831
|
+
case 3:
|
|
10832
|
+
case "end":
|
|
10833
|
+
return _context77.stop();
|
|
10834
|
+
}
|
|
10835
|
+
}
|
|
10836
|
+
}, _callee77, this);
|
|
10837
|
+
}));
|
|
10838
|
+
|
|
10839
|
+
function listPushProviders() {
|
|
10840
|
+
return _listPushProviders.apply(this, arguments);
|
|
10841
|
+
}
|
|
10842
|
+
|
|
10843
|
+
return listPushProviders;
|
|
10844
|
+
}()
|
|
10379
10845
|
}], [{
|
|
10380
10846
|
key: "getInstance",
|
|
10381
10847
|
value: function getInstance(key, secretOrOptions, options) {
|