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/index.js
CHANGED
|
@@ -4261,7 +4261,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4261
4261
|
delete this.getClient().activeChannels[tempChannelCid];
|
|
4262
4262
|
}
|
|
4263
4263
|
|
|
4264
|
-
if (!(this.cid in this.getClient().activeChannels)) {
|
|
4264
|
+
if (!(this.cid in this.getClient().activeChannels) && this.getClient()._cacheEnabled()) {
|
|
4265
4265
|
this.getClient().activeChannels[this.cid] = this;
|
|
4266
4266
|
}
|
|
4267
4267
|
}
|
|
@@ -5229,15 +5229,20 @@ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) le
|
|
|
5229
5229
|
* ClientState - A container class for the client state.
|
|
5230
5230
|
*/
|
|
5231
5231
|
var ClientState = /*#__PURE__*/function () {
|
|
5232
|
-
function ClientState() {
|
|
5232
|
+
function ClientState(_ref) {
|
|
5233
|
+
var client = _ref.client;
|
|
5234
|
+
|
|
5233
5235
|
_classCallCheck__default['default'](this, ClientState);
|
|
5234
5236
|
|
|
5237
|
+
_defineProperty__default['default'](this, "client", void 0);
|
|
5238
|
+
|
|
5235
5239
|
_defineProperty__default['default'](this, "users", void 0);
|
|
5236
5240
|
|
|
5237
5241
|
_defineProperty__default['default'](this, "userChannelReferences", void 0);
|
|
5238
5242
|
|
|
5239
5243
|
// show the status for a certain user...
|
|
5240
5244
|
// ie online, offline etc
|
|
5245
|
+
this.client = client;
|
|
5241
5246
|
this.users = {}; // store which channels contain references to the specified user...
|
|
5242
5247
|
|
|
5243
5248
|
this.userChannelReferences = {};
|
|
@@ -5263,14 +5268,14 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
5263
5268
|
}, {
|
|
5264
5269
|
key: "updateUser",
|
|
5265
5270
|
value: function updateUser(user) {
|
|
5266
|
-
if (user != null) {
|
|
5271
|
+
if (user != null && this.client._cacheEnabled()) {
|
|
5267
5272
|
this.users[user.id] = user;
|
|
5268
5273
|
}
|
|
5269
5274
|
}
|
|
5270
5275
|
}, {
|
|
5271
5276
|
key: "updateUserReference",
|
|
5272
5277
|
value: function updateUserReference(user, channelID) {
|
|
5273
|
-
if (user == null) {
|
|
5278
|
+
if (user == null || !this.client._cacheEnabled()) {
|
|
5274
5279
|
return;
|
|
5275
5280
|
}
|
|
5276
5281
|
|
|
@@ -10321,6 +10326,10 @@ var PollManager = /*#__PURE__*/function () {
|
|
|
10321
10326
|
});
|
|
10322
10327
|
|
|
10323
10328
|
_defineProperty__default['default'](this, "setOrOverwriteInCache", function (pollResponse, overwriteState) {
|
|
10329
|
+
if (!_this.client._cacheEnabled()) {
|
|
10330
|
+
return;
|
|
10331
|
+
}
|
|
10332
|
+
|
|
10324
10333
|
var pollFromCache = _this.fromState(pollResponse.id);
|
|
10325
10334
|
|
|
10326
10335
|
if (!pollFromCache) {
|
|
@@ -10743,7 +10752,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10743
10752
|
|
|
10744
10753
|
_this.activeChannels = {}; // reset client state
|
|
10745
10754
|
|
|
10746
|
-
_this.state = new ClientState(
|
|
10755
|
+
_this.state = new ClientState({
|
|
10756
|
+
client: _this
|
|
10757
|
+
}); // reset thread manager
|
|
10747
10758
|
|
|
10748
10759
|
_this.threads.resetState(); // reset token manager
|
|
10749
10760
|
|
|
@@ -11010,10 +11021,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11010
11021
|
|
|
11011
11022
|
for (var _channelID3 in refMap) {
|
|
11012
11023
|
var _channel4 = _this.activeChannels[_channelID3];
|
|
11013
|
-
var state = _channel4.state;
|
|
11014
|
-
/** deleted the messages from this user. */
|
|
11015
11024
|
|
|
11016
|
-
|
|
11025
|
+
if (_channel4) {
|
|
11026
|
+
var state = _channel4.state;
|
|
11027
|
+
/** deleted the messages from this user. */
|
|
11028
|
+
|
|
11029
|
+
state === null || state === void 0 ? void 0 : state.deleteUserMessages(user, hardDelete);
|
|
11030
|
+
}
|
|
11017
11031
|
}
|
|
11018
11032
|
});
|
|
11019
11033
|
|
|
@@ -11187,7 +11201,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11187
11201
|
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.
|
|
11188
11202
|
// In channel.query, we will replace it with 'cid'.
|
|
11189
11203
|
|
|
11190
|
-
_this.
|
|
11204
|
+
if (_this._cacheEnabled()) {
|
|
11205
|
+
_this.activeChannels[tempCid] = channel;
|
|
11206
|
+
}
|
|
11207
|
+
|
|
11191
11208
|
return channel;
|
|
11192
11209
|
});
|
|
11193
11210
|
|
|
@@ -11199,7 +11216,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11199
11216
|
|
|
11200
11217
|
var cid = "".concat(channelType, ":").concat(channelID);
|
|
11201
11218
|
|
|
11202
|
-
if (cid in _this.activeChannels && !_this.activeChannels[cid].disconnected) {
|
|
11219
|
+
if (cid in _this.activeChannels && _this.activeChannels[cid] && !_this.activeChannels[cid].disconnected) {
|
|
11203
11220
|
var _channel6 = _this.activeChannels[cid];
|
|
11204
11221
|
|
|
11205
11222
|
if (Object.keys(custom).length > 0) {
|
|
@@ -11211,7 +11228,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11211
11228
|
}
|
|
11212
11229
|
|
|
11213
11230
|
var channel = new Channel(_this, channelType, channelID, custom);
|
|
11214
|
-
|
|
11231
|
+
|
|
11232
|
+
if (_this._cacheEnabled()) {
|
|
11233
|
+
_this.activeChannels[channel.cid] = channel;
|
|
11234
|
+
}
|
|
11235
|
+
|
|
11215
11236
|
return channel;
|
|
11216
11237
|
});
|
|
11217
11238
|
|
|
@@ -11227,6 +11248,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11227
11248
|
return !!_this.secret;
|
|
11228
11249
|
});
|
|
11229
11250
|
|
|
11251
|
+
_defineProperty__default['default'](this, "_cacheEnabled", function () {
|
|
11252
|
+
return !_this._isUsingServerAuth() || !_this.options.disableCache;
|
|
11253
|
+
});
|
|
11254
|
+
|
|
11230
11255
|
_defineProperty__default['default'](this, "_buildWSPayload", function (client_request_id) {
|
|
11231
11256
|
return JSON.stringify({
|
|
11232
11257
|
user_id: _this.userID,
|
|
@@ -11239,7 +11264,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11239
11264
|
// set the key
|
|
11240
11265
|
this.key = _key;
|
|
11241
11266
|
this.listeners = {};
|
|
11242
|
-
this.state = new ClientState(
|
|
11267
|
+
this.state = new ClientState({
|
|
11268
|
+
client: this
|
|
11269
|
+
}); // a list of channels to hide ws events from
|
|
11243
11270
|
|
|
11244
11271
|
this.mutedChannels = [];
|
|
11245
11272
|
this.mutedUsers = [];
|
|
@@ -11258,7 +11285,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11258
11285
|
withCredentials: false,
|
|
11259
11286
|
// making sure cookies are not sent
|
|
11260
11287
|
warmUp: false,
|
|
11261
|
-
recoverStateOnReconnect: true
|
|
11288
|
+
recoverStateOnReconnect: true,
|
|
11289
|
+
disableCache: false
|
|
11262
11290
|
}, inputOptions);
|
|
11263
11291
|
|
|
11264
11292
|
if (this.node && !this.options.httpsAgent) {
|
|
@@ -12986,7 +13014,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12986
13014
|
value: function _addChannelConfig(_ref8) {
|
|
12987
13015
|
var cid = _ref8.cid,
|
|
12988
13016
|
config = _ref8.config;
|
|
12989
|
-
|
|
13017
|
+
|
|
13018
|
+
if (this._cacheEnabled()) {
|
|
13019
|
+
this.configs[cid] = config;
|
|
13020
|
+
}
|
|
12990
13021
|
}
|
|
12991
13022
|
/**
|
|
12992
13023
|
* channel - Returns a new channel with the given type, id and custom data
|
|
@@ -14970,7 +15001,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14970
15001
|
}, {
|
|
14971
15002
|
key: "getUserAgent",
|
|
14972
15003
|
value: function getUserAgent() {
|
|
14973
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.52.
|
|
15004
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.52.2");
|
|
14974
15005
|
}
|
|
14975
15006
|
}, {
|
|
14976
15007
|
key: "setUserAgent",
|