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