stream-chat 8.28.0 → 8.30.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 +49 -18
- 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 +49 -18
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +49 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +49 -18
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +1 -0
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/client.d.ts +6 -2
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/types.d.ts +15 -3
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +9 -2
- package/src/types.ts +15 -6
- package/src/utils.ts +32 -0
package/dist/browser.es.js
CHANGED
|
@@ -161,6 +161,7 @@ function isOwnUserBaseProperty(property) {
|
|
|
161
161
|
unread_count: true,
|
|
162
162
|
unread_threads: true,
|
|
163
163
|
invisible: true,
|
|
164
|
+
privacy_settings: true,
|
|
164
165
|
roles: true
|
|
165
166
|
};
|
|
166
167
|
return ownUserBaseProperties[property];
|
|
@@ -365,7 +366,8 @@ function formatMessage(message) {
|
|
|
365
366
|
pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
|
|
366
367
|
created_at: message.created_at ? new Date(message.created_at) : new Date(),
|
|
367
368
|
updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
|
|
368
|
-
status: message.status || 'received'
|
|
369
|
+
status: message.status || 'received',
|
|
370
|
+
reaction_groups: maybeGetReactionGroupsFallback(message.reaction_groups, message.reaction_counts, message.reaction_scores)
|
|
369
371
|
});
|
|
370
372
|
}
|
|
371
373
|
function addToMessageList(messages, message) {
|
|
@@ -432,6 +434,28 @@ function addToMessageList(messages, message) {
|
|
|
432
434
|
return _toConsumableArray(messageArr);
|
|
433
435
|
}
|
|
434
436
|
|
|
437
|
+
function maybeGetReactionGroupsFallback(groups, counts, scores) {
|
|
438
|
+
if (groups) {
|
|
439
|
+
return groups;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (counts && scores) {
|
|
443
|
+
var fallback = {};
|
|
444
|
+
|
|
445
|
+
for (var _i2 = 0, _Object$keys = Object.keys(counts); _i2 < _Object$keys.length; _i2++) {
|
|
446
|
+
var type = _Object$keys[_i2];
|
|
447
|
+
fallback[type] = {
|
|
448
|
+
count: counts[type],
|
|
449
|
+
sum_scores: scores[type]
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return fallback;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return null;
|
|
457
|
+
}
|
|
458
|
+
|
|
435
459
|
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
436
460
|
|
|
437
461
|
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -2775,14 +2799,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2775
2799
|
key: "keystroke",
|
|
2776
2800
|
value: function () {
|
|
2777
2801
|
var _keystroke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(parent_id, options) {
|
|
2778
|
-
var _this$getConfig;
|
|
2779
|
-
|
|
2780
2802
|
var now, diff;
|
|
2781
2803
|
return _regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
2782
2804
|
while (1) {
|
|
2783
2805
|
switch (_context24.prev = _context24.next) {
|
|
2784
2806
|
case 0:
|
|
2785
|
-
if (
|
|
2807
|
+
if (this._isTypingIndicatorsEnabled()) {
|
|
2786
2808
|
_context24.next = 2;
|
|
2787
2809
|
break;
|
|
2788
2810
|
}
|
|
@@ -2831,13 +2853,11 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2831
2853
|
key: "stopTyping",
|
|
2832
2854
|
value: function () {
|
|
2833
2855
|
var _stopTyping = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(parent_id, options) {
|
|
2834
|
-
var _this$getConfig2;
|
|
2835
|
-
|
|
2836
2856
|
return _regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
2837
2857
|
while (1) {
|
|
2838
2858
|
switch (_context25.prev = _context25.next) {
|
|
2839
2859
|
case 0:
|
|
2840
|
-
if (
|
|
2860
|
+
if (this._isTypingIndicatorsEnabled()) {
|
|
2841
2861
|
_context25.next = 2;
|
|
2842
2862
|
break;
|
|
2843
2863
|
}
|
|
@@ -2867,6 +2887,17 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2867
2887
|
|
|
2868
2888
|
return stopTyping;
|
|
2869
2889
|
}()
|
|
2890
|
+
}, {
|
|
2891
|
+
key: "_isTypingIndicatorsEnabled",
|
|
2892
|
+
value: function _isTypingIndicatorsEnabled() {
|
|
2893
|
+
var _this$getConfig, _this$getClient$user$, _this$getClient$user, _this$getClient$user$2, _this$getClient$user$3;
|
|
2894
|
+
|
|
2895
|
+
if (!((_this$getConfig = this.getConfig()) !== null && _this$getConfig !== void 0 && _this$getConfig.typing_events)) {
|
|
2896
|
+
return false;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
return (_this$getClient$user$ = (_this$getClient$user = this.getClient().user) === null || _this$getClient$user === void 0 ? void 0 : (_this$getClient$user$2 = _this$getClient$user.privacy_settings) === null || _this$getClient$user$2 === void 0 ? void 0 : (_this$getClient$user$3 = _this$getClient$user$2.typing_indicators) === null || _this$getClient$user$3 === void 0 ? void 0 : _this$getClient$user$3.enabled) !== null && _this$getClient$user$ !== void 0 ? _this$getClient$user$ : true;
|
|
2900
|
+
}
|
|
2870
2901
|
/**
|
|
2871
2902
|
* lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted
|
|
2872
2903
|
*
|
|
@@ -2903,7 +2934,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2903
2934
|
key: "markRead",
|
|
2904
2935
|
value: function () {
|
|
2905
2936
|
var _markRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
|
|
2906
|
-
var _this$
|
|
2937
|
+
var _this$getConfig2;
|
|
2907
2938
|
|
|
2908
2939
|
var data,
|
|
2909
2940
|
_args26 = arguments;
|
|
@@ -2915,7 +2946,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2915
2946
|
|
|
2916
2947
|
this._checkInitialized();
|
|
2917
2948
|
|
|
2918
|
-
if (!(!((_this$
|
|
2949
|
+
if (!(!((_this$getConfig2 = this.getConfig()) !== null && _this$getConfig2 !== void 0 && _this$getConfig2.read_events) && !this.getClient()._isUsingServerAuth())) {
|
|
2919
2950
|
_context26.next = 4;
|
|
2920
2951
|
break;
|
|
2921
2952
|
}
|
|
@@ -2954,7 +2985,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2954
2985
|
key: "markUnread",
|
|
2955
2986
|
value: function () {
|
|
2956
2987
|
var _markUnread = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27(data) {
|
|
2957
|
-
var _this$
|
|
2988
|
+
var _this$getConfig3;
|
|
2958
2989
|
|
|
2959
2990
|
return _regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
2960
2991
|
while (1) {
|
|
@@ -2962,7 +2993,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2962
2993
|
case 0:
|
|
2963
2994
|
this._checkInitialized();
|
|
2964
2995
|
|
|
2965
|
-
if (!(!((_this$
|
|
2996
|
+
if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
|
|
2966
2997
|
_context27.next = 3;
|
|
2967
2998
|
break;
|
|
2968
2999
|
}
|
|
@@ -3882,7 +3913,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3882
3913
|
|
|
3883
3914
|
case 'message.read':
|
|
3884
3915
|
if ((_event$user3 = event.user) !== null && _event$user3 !== void 0 && _event$user3.id && event.created_at) {
|
|
3885
|
-
var _event$user4, _this$getClient$
|
|
3916
|
+
var _event$user4, _this$getClient$user2;
|
|
3886
3917
|
|
|
3887
3918
|
channelState.read[event.user.id] = {
|
|
3888
3919
|
last_read: new Date(event.created_at),
|
|
@@ -3891,7 +3922,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3891
3922
|
unread_messages: 0
|
|
3892
3923
|
};
|
|
3893
3924
|
|
|
3894
|
-
if (((_event$user4 = event.user) === null || _event$user4 === void 0 ? void 0 : _event$user4.id) === ((_this$getClient$
|
|
3925
|
+
if (((_event$user4 = event.user) === null || _event$user4 === void 0 ? void 0 : _event$user4.id) === ((_this$getClient$user2 = this.getClient().user) === null || _this$getClient$user2 === void 0 ? void 0 : _this$getClient$user2.id)) {
|
|
3895
3926
|
channelState.unreadCount = 0;
|
|
3896
3927
|
}
|
|
3897
3928
|
}
|
|
@@ -3929,10 +3960,10 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3929
3960
|
|
|
3930
3961
|
case 'message.new':
|
|
3931
3962
|
if (event.message) {
|
|
3932
|
-
var _event$user7, _this$getClient$
|
|
3963
|
+
var _event$user7, _this$getClient$user3, _event$user8;
|
|
3933
3964
|
|
|
3934
3965
|
/* if message belongs to current user, always assume timestamp is changed to filter it out and add again to avoid duplication */
|
|
3935
|
-
var ownMessage = ((_event$user7 = event.user) === null || _event$user7 === void 0 ? void 0 : _event$user7.id) === ((_this$getClient$
|
|
3966
|
+
var ownMessage = ((_event$user7 = event.user) === null || _event$user7 === void 0 ? void 0 : _event$user7.id) === ((_this$getClient$user3 = this.getClient().user) === null || _this$getClient$user3 === void 0 ? void 0 : _this$getClient$user3.id);
|
|
3936
3967
|
var isThreadMessage = event.message.parent_id && !event.message.show_in_channel;
|
|
3937
3968
|
|
|
3938
3969
|
if (this.state.isUpToDate || isThreadMessage) {
|
|
@@ -4039,9 +4070,9 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4039
4070
|
|
|
4040
4071
|
case 'notification.mark_unread':
|
|
4041
4072
|
{
|
|
4042
|
-
var _event$user10, _this$getClient$
|
|
4073
|
+
var _event$user10, _this$getClient$user4, _event$unread_message;
|
|
4043
4074
|
|
|
4044
|
-
var _ownMessage = ((_event$user10 = event.user) === null || _event$user10 === void 0 ? void 0 : _event$user10.id) === ((_this$getClient$
|
|
4075
|
+
var _ownMessage = ((_event$user10 = event.user) === null || _event$user10 === void 0 ? void 0 : _event$user10.id) === ((_this$getClient$user4 = this.getClient().user) === null || _this$getClient$user4 === void 0 ? void 0 : _this$getClient$user4.id);
|
|
4045
4076
|
|
|
4046
4077
|
if (!(_ownMessage && event.user)) break;
|
|
4047
4078
|
var unreadCount = (_event$unread_message = event.unread_messages) !== null && _event$unread_message !== void 0 ? _event$unread_message : 0;
|
|
@@ -11395,7 +11426,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11395
11426
|
}, {
|
|
11396
11427
|
key: "getUserAgent",
|
|
11397
11428
|
value: function getUserAgent() {
|
|
11398
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
11429
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.30.0");
|
|
11399
11430
|
}
|
|
11400
11431
|
}, {
|
|
11401
11432
|
key: "setUserAgent",
|