stream-chat 9.45.1 → 9.45.3
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/cjs/index.browser.js +24 -13
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +24 -13
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +24 -13
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/search/BaseSearchSource.d.ts +2 -0
- package/dist/types/search/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/channel.ts +0 -7
- package/src/search/BaseSearchSource.ts +17 -4
- package/src/search/UserSearchSource.ts +7 -1
- package/src/search/types.ts +4 -0
package/dist/esm/index.mjs
CHANGED
|
@@ -4205,7 +4205,9 @@ function isErrorResponse(res) {
|
|
|
4205
4205
|
// src/search/BaseSearchSource.ts
|
|
4206
4206
|
var DEFAULT_SEARCH_SOURCE_OPTIONS = {
|
|
4207
4207
|
debounceMs: 300,
|
|
4208
|
-
pageSize: 10
|
|
4208
|
+
pageSize: 10,
|
|
4209
|
+
allowEmptySearchString: false,
|
|
4210
|
+
resetOnNewSearchQuery: true
|
|
4209
4211
|
};
|
|
4210
4212
|
var BaseSearchSourceBase = class {
|
|
4211
4213
|
constructor(options) {
|
|
@@ -4220,10 +4222,15 @@ var BaseSearchSourceBase = class {
|
|
|
4220
4222
|
this.canExecuteQuery = (newSearchString) => {
|
|
4221
4223
|
const hasNewSearchQuery = typeof newSearchString !== "undefined";
|
|
4222
4224
|
const searchString = newSearchString ?? this.searchQuery;
|
|
4223
|
-
return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && searchString);
|
|
4225
|
+
return !!(this.isActive && !this.isLoading && (this.hasNext || hasNewSearchQuery) && (this.allowEmptySearchString || searchString));
|
|
4226
|
+
};
|
|
4227
|
+
const { pageSize, allowEmptySearchString, resetOnNewSearchQuery } = {
|
|
4228
|
+
...DEFAULT_SEARCH_SOURCE_OPTIONS,
|
|
4229
|
+
...options
|
|
4224
4230
|
};
|
|
4225
|
-
const { pageSize } = { ...DEFAULT_SEARCH_SOURCE_OPTIONS, ...options };
|
|
4226
4231
|
this.pageSize = pageSize;
|
|
4232
|
+
this.allowEmptySearchString = allowEmptySearchString;
|
|
4233
|
+
this.resetOnNewSearchQuery = resetOnNewSearchQuery;
|
|
4227
4234
|
this.state = new StateStore(this.initialState);
|
|
4228
4235
|
}
|
|
4229
4236
|
get lastQueryError() {
|
|
@@ -4266,10 +4273,14 @@ var BaseSearchSourceBase = class {
|
|
|
4266
4273
|
return this.state.getLatestValue().searchQuery;
|
|
4267
4274
|
}
|
|
4268
4275
|
getStateBeforeFirstQuery(newSearchString) {
|
|
4276
|
+
const initialState = this.initialState;
|
|
4277
|
+
const oldItems = this.items;
|
|
4278
|
+
const items = this.resetOnNewSearchQuery ? initialState.items : oldItems;
|
|
4269
4279
|
return {
|
|
4270
|
-
...
|
|
4280
|
+
...initialState,
|
|
4281
|
+
items,
|
|
4271
4282
|
isActive: this.isActive,
|
|
4272
|
-
isLoading: true,
|
|
4283
|
+
isLoading: this.resetOnNewSearchQuery ? true : !oldItems,
|
|
4273
4284
|
searchQuery: newSearchString
|
|
4274
4285
|
};
|
|
4275
4286
|
}
|
|
@@ -4779,7 +4790,13 @@ var UserSearchSource = class extends BaseSearchSource {
|
|
|
4779
4790
|
baseFilters: this.filters,
|
|
4780
4791
|
context: { searchQuery }
|
|
4781
4792
|
});
|
|
4782
|
-
|
|
4793
|
+
let sort;
|
|
4794
|
+
if (Array.isArray(this.sort)) {
|
|
4795
|
+
const hasIdSort = this.sort.some((entry) => "id" in entry);
|
|
4796
|
+
sort = hasIdSort ? this.sort : [...this.sort, { id: 1 }];
|
|
4797
|
+
} else {
|
|
4798
|
+
sort = { id: 1, ...this.sort };
|
|
4799
|
+
}
|
|
4783
4800
|
const options = { ...this.searchOptions, limit: this.pageSize, offset: this.offset };
|
|
4784
4801
|
const { users } = await this.client.queryUsers(filters, sort, options);
|
|
4785
4802
|
return { items: users };
|
|
@@ -10564,9 +10581,6 @@ var Channel = class {
|
|
|
10564
10581
|
...channelState.members,
|
|
10565
10582
|
[memberCopy.user.id]: memberCopy
|
|
10566
10583
|
};
|
|
10567
|
-
if (channel.data?.member_count && event.type === "member.added") {
|
|
10568
|
-
channel.data.member_count += 1;
|
|
10569
|
-
}
|
|
10570
10584
|
}
|
|
10571
10585
|
const currentUserId = this.getClient().userID;
|
|
10572
10586
|
if (typeof currentUserId === "string" && typeof memberCopy?.user?.id === "string" && memberCopy.user.id === currentUserId) {
|
|
@@ -10581,9 +10595,6 @@ var Channel = class {
|
|
|
10581
10595
|
};
|
|
10582
10596
|
delete newMembers[event.user.id];
|
|
10583
10597
|
channelState.members = newMembers;
|
|
10584
|
-
if (channel.data?.member_count) {
|
|
10585
|
-
channel.data.member_count = Math.max(channel.data.member_count - 1, 0);
|
|
10586
|
-
}
|
|
10587
10598
|
}
|
|
10588
10599
|
break;
|
|
10589
10600
|
case "notification.mark_unread": {
|
|
@@ -16415,7 +16426,7 @@ var StreamChat = class _StreamChat {
|
|
|
16415
16426
|
if (this.userAgent) {
|
|
16416
16427
|
return this.userAgent;
|
|
16417
16428
|
}
|
|
16418
|
-
const version = "9.45.
|
|
16429
|
+
const version = "9.45.3";
|
|
16419
16430
|
const clientBundle = "browser-esm";
|
|
16420
16431
|
let userAgentString = "";
|
|
16421
16432
|
if (this.sdkIdentifier) {
|