stream-chat 8.52.0 → 8.52.2
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 +46 -15
- 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 +46 -15
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +46 -15
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +46 -15
- package/dist/index.js.map +1 -1
- package/dist/types/client.d.ts +1 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client_state.d.ts +5 -1
- package/dist/types/client_state.d.ts.map +1 -1
- package/dist/types/poll_manager.d.ts.map +1 -1
- package/dist/types/types.d.ts +15 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +1 -1
- package/src/client.ts +21 -9
- package/src/client_state.ts +6 -3
- package/src/poll_manager.ts +3 -0
- package/src/types.ts +15 -2
package/dist/browser.es.js
CHANGED
|
@@ -4232,7 +4232,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4232
4232
|
delete this.getClient().activeChannels[tempChannelCid];
|
|
4233
4233
|
}
|
|
4234
4234
|
|
|
4235
|
-
if (!(this.cid in this.getClient().activeChannels)) {
|
|
4235
|
+
if (!(this.cid in this.getClient().activeChannels) && this.getClient()._cacheEnabled()) {
|
|
4236
4236
|
this.getClient().activeChannels[this.cid] = this;
|
|
4237
4237
|
}
|
|
4238
4238
|
}
|
|
@@ -5200,15 +5200,20 @@ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) le
|
|
|
5200
5200
|
* ClientState - A container class for the client state.
|
|
5201
5201
|
*/
|
|
5202
5202
|
var ClientState = /*#__PURE__*/function () {
|
|
5203
|
-
function ClientState() {
|
|
5203
|
+
function ClientState(_ref) {
|
|
5204
|
+
var client = _ref.client;
|
|
5205
|
+
|
|
5204
5206
|
_classCallCheck(this, ClientState);
|
|
5205
5207
|
|
|
5208
|
+
_defineProperty(this, "client", void 0);
|
|
5209
|
+
|
|
5206
5210
|
_defineProperty(this, "users", void 0);
|
|
5207
5211
|
|
|
5208
5212
|
_defineProperty(this, "userChannelReferences", void 0);
|
|
5209
5213
|
|
|
5210
5214
|
// show the status for a certain user...
|
|
5211
5215
|
// ie online, offline etc
|
|
5216
|
+
this.client = client;
|
|
5212
5217
|
this.users = {}; // store which channels contain references to the specified user...
|
|
5213
5218
|
|
|
5214
5219
|
this.userChannelReferences = {};
|
|
@@ -5234,14 +5239,14 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
5234
5239
|
}, {
|
|
5235
5240
|
key: "updateUser",
|
|
5236
5241
|
value: function updateUser(user) {
|
|
5237
|
-
if (user != null) {
|
|
5242
|
+
if (user != null && this.client._cacheEnabled()) {
|
|
5238
5243
|
this.users[user.id] = user;
|
|
5239
5244
|
}
|
|
5240
5245
|
}
|
|
5241
5246
|
}, {
|
|
5242
5247
|
key: "updateUserReference",
|
|
5243
5248
|
value: function updateUserReference(user, channelID) {
|
|
5244
|
-
if (user == null) {
|
|
5249
|
+
if (user == null || !this.client._cacheEnabled()) {
|
|
5245
5250
|
return;
|
|
5246
5251
|
}
|
|
5247
5252
|
|
|
@@ -10290,6 +10295,10 @@ var PollManager = /*#__PURE__*/function () {
|
|
|
10290
10295
|
});
|
|
10291
10296
|
|
|
10292
10297
|
_defineProperty(this, "setOrOverwriteInCache", function (pollResponse, overwriteState) {
|
|
10298
|
+
if (!_this.client._cacheEnabled()) {
|
|
10299
|
+
return;
|
|
10300
|
+
}
|
|
10301
|
+
|
|
10293
10302
|
var pollFromCache = _this.fromState(pollResponse.id);
|
|
10294
10303
|
|
|
10295
10304
|
if (!pollFromCache) {
|
|
@@ -10712,7 +10721,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10712
10721
|
|
|
10713
10722
|
_this.activeChannels = {}; // reset client state
|
|
10714
10723
|
|
|
10715
|
-
_this.state = new ClientState(
|
|
10724
|
+
_this.state = new ClientState({
|
|
10725
|
+
client: _this
|
|
10726
|
+
}); // reset thread manager
|
|
10716
10727
|
|
|
10717
10728
|
_this.threads.resetState(); // reset token manager
|
|
10718
10729
|
|
|
@@ -10979,10 +10990,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10979
10990
|
|
|
10980
10991
|
for (var _channelID3 in refMap) {
|
|
10981
10992
|
var _channel4 = _this.activeChannels[_channelID3];
|
|
10982
|
-
var state = _channel4.state;
|
|
10983
|
-
/** deleted the messages from this user. */
|
|
10984
10993
|
|
|
10985
|
-
|
|
10994
|
+
if (_channel4) {
|
|
10995
|
+
var state = _channel4.state;
|
|
10996
|
+
/** deleted the messages from this user. */
|
|
10997
|
+
|
|
10998
|
+
state === null || state === void 0 ? void 0 : state.deleteUserMessages(user, hardDelete);
|
|
10999
|
+
}
|
|
10986
11000
|
}
|
|
10987
11001
|
});
|
|
10988
11002
|
|
|
@@ -11156,7 +11170,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11156
11170
|
var channel = new Channel(_this, channelType, undefined, custom); // For the time being set the key as membersStr, since we don't know the cid yet.
|
|
11157
11171
|
// In channel.query, we will replace it with 'cid'.
|
|
11158
11172
|
|
|
11159
|
-
_this.
|
|
11173
|
+
if (_this._cacheEnabled()) {
|
|
11174
|
+
_this.activeChannels[tempCid] = channel;
|
|
11175
|
+
}
|
|
11176
|
+
|
|
11160
11177
|
return channel;
|
|
11161
11178
|
});
|
|
11162
11179
|
|
|
@@ -11168,7 +11185,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11168
11185
|
|
|
11169
11186
|
var cid = "".concat(channelType, ":").concat(channelID);
|
|
11170
11187
|
|
|
11171
|
-
if (cid in _this.activeChannels && !_this.activeChannels[cid].disconnected) {
|
|
11188
|
+
if (cid in _this.activeChannels && _this.activeChannels[cid] && !_this.activeChannels[cid].disconnected) {
|
|
11172
11189
|
var _channel6 = _this.activeChannels[cid];
|
|
11173
11190
|
|
|
11174
11191
|
if (Object.keys(custom).length > 0) {
|
|
@@ -11180,7 +11197,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11180
11197
|
}
|
|
11181
11198
|
|
|
11182
11199
|
var channel = new Channel(_this, channelType, channelID, custom);
|
|
11183
|
-
|
|
11200
|
+
|
|
11201
|
+
if (_this._cacheEnabled()) {
|
|
11202
|
+
_this.activeChannels[channel.cid] = channel;
|
|
11203
|
+
}
|
|
11204
|
+
|
|
11184
11205
|
return channel;
|
|
11185
11206
|
});
|
|
11186
11207
|
|
|
@@ -11196,6 +11217,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11196
11217
|
return !!_this.secret;
|
|
11197
11218
|
});
|
|
11198
11219
|
|
|
11220
|
+
_defineProperty(this, "_cacheEnabled", function () {
|
|
11221
|
+
return !_this._isUsingServerAuth() || !_this.options.disableCache;
|
|
11222
|
+
});
|
|
11223
|
+
|
|
11199
11224
|
_defineProperty(this, "_buildWSPayload", function (client_request_id) {
|
|
11200
11225
|
return JSON.stringify({
|
|
11201
11226
|
user_id: _this.userID,
|
|
@@ -11208,7 +11233,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11208
11233
|
// set the key
|
|
11209
11234
|
this.key = _key;
|
|
11210
11235
|
this.listeners = {};
|
|
11211
|
-
this.state = new ClientState(
|
|
11236
|
+
this.state = new ClientState({
|
|
11237
|
+
client: this
|
|
11238
|
+
}); // a list of channels to hide ws events from
|
|
11212
11239
|
|
|
11213
11240
|
this.mutedChannels = [];
|
|
11214
11241
|
this.mutedUsers = [];
|
|
@@ -11227,7 +11254,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11227
11254
|
withCredentials: false,
|
|
11228
11255
|
// making sure cookies are not sent
|
|
11229
11256
|
warmUp: false,
|
|
11230
|
-
recoverStateOnReconnect: true
|
|
11257
|
+
recoverStateOnReconnect: true,
|
|
11258
|
+
disableCache: false
|
|
11231
11259
|
}, inputOptions);
|
|
11232
11260
|
|
|
11233
11261
|
if (this.node && !this.options.httpsAgent) {
|
|
@@ -12955,7 +12983,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12955
12983
|
value: function _addChannelConfig(_ref8) {
|
|
12956
12984
|
var cid = _ref8.cid,
|
|
12957
12985
|
config = _ref8.config;
|
|
12958
|
-
|
|
12986
|
+
|
|
12987
|
+
if (this._cacheEnabled()) {
|
|
12988
|
+
this.configs[cid] = config;
|
|
12989
|
+
}
|
|
12959
12990
|
}
|
|
12960
12991
|
/**
|
|
12961
12992
|
* channel - Returns a new channel with the given type, id and custom data
|
|
@@ -14939,7 +14970,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14939
14970
|
}, {
|
|
14940
14971
|
key: "getUserAgent",
|
|
14941
14972
|
value: function getUserAgent() {
|
|
14942
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.52.
|
|
14973
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.52.2");
|
|
14943
14974
|
}
|
|
14944
14975
|
}, {
|
|
14945
14976
|
key: "setUserAgent",
|