stream-chat 9.47.0 → 9.48.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/cjs/index.browser.js +42 -18
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +42 -18
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +42 -18
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/channel.d.ts +2 -2
- package/dist/types/custom_types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/thread.d.ts +2 -0
- package/dist/types/types.d.ts +49 -14
- package/package.json +2 -2
- package/src/channel.ts +2 -2
- package/src/custom_types.ts +1 -0
- package/src/index.ts +1 -0
- package/src/messageComposer/middleware/textComposer/commands.ts +21 -19
- package/src/thread.ts +29 -0
- package/src/thread_manager.ts +1 -0
- package/src/types.ts +62 -14
package/dist/types/channel.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { CooldownTimer } from './CooldownTimer';
|
|
|
4
4
|
import { MessageComposer } from './messageComposer';
|
|
5
5
|
import { MessageReceiptsTracker } from './messageDelivery';
|
|
6
6
|
import type { StreamChat } from './client';
|
|
7
|
-
import type { AIState, APIResponse, AscDesc, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateDraftResponse, DeleteChannelAPIResponse, DraftMessagePayload, Event, EventAPIResponse, EventHandler, EventTypes, GetDraftResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, LiveLocationPayload, LocalMessage, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessageOptions, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PartialUpdateMemberAPIResponse, PinnedMessagePaginationOptions, PinnedMessagesSort, PollVoteData,
|
|
7
|
+
import type { AIState, APIResponse, AscDesc, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelPushPreference, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateDraftResponse, DeleteChannelAPIResponse, DraftMessagePayload, Event, EventAPIResponse, EventHandler, EventTypes, GetDraftResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, LiveLocationPayload, LocalMessage, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessageOptions, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PartialUpdateMemberAPIResponse, PinnedMessagePaginationOptions, PinnedMessagesSort, PollVoteData, QueryChannelAPIResponse, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, SendMessageOptions, SendReactionOptions, StaticLocationPayload, TruncateChannelAPIResponse, TruncateOptions, UnBanUserOptions, UpdateChannelAPIResponse, UpdateChannelOptions, UpdateLocationPayload, UserResponse } from './types';
|
|
8
8
|
import type { Role } from './permissions';
|
|
9
9
|
/**
|
|
10
10
|
* Channel - The Channel class manages it's own state.
|
|
@@ -40,7 +40,7 @@ export declare class Channel {
|
|
|
40
40
|
lastTypingEvent: Date | null;
|
|
41
41
|
isTyping: boolean;
|
|
42
42
|
disconnected: boolean;
|
|
43
|
-
push_preferences?:
|
|
43
|
+
push_preferences?: ChannelPushPreference;
|
|
44
44
|
readonly messageComposer: MessageComposer;
|
|
45
45
|
readonly messageReceiptsTracker: MessageReceiptsTracker;
|
|
46
46
|
readonly cooldownTimer: CooldownTimer;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -32,6 +32,6 @@ export * from './uploadManager';
|
|
|
32
32
|
export * from './channel_manager';
|
|
33
33
|
export * from './offline-support';
|
|
34
34
|
export * from './LiveLocationManager';
|
|
35
|
-
export type { CustomAttachmentData, CustomChannelData, CustomCommandData, CustomEventData, CustomMemberData, CustomMessageComposerData, CustomMessageData, CustomPollOptionData, CustomPollData, CustomReactionData, CustomUserData, CustomThreadData, } from './custom_types';
|
|
35
|
+
export type { CustomAttachmentData, CustomChannelData, CustomCommandData, CustomEventData, CustomEventTypes, CustomMemberData, CustomMessageComposerData, CustomMessageData, CustomPollOptionData, CustomPollData, CustomReactionData, CustomUserData, CustomThreadData, } from './custom_types';
|
|
36
36
|
export { isOwnUser, chatCodes, logChatPromiseExecution, localMessageToNewMessagePayload, formatMessage, promoteChannel, } from './utils';
|
|
37
37
|
export { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
|
package/dist/types/thread.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export type ThreadUserReadState = {
|
|
|
49
49
|
unreadMessageCount: number;
|
|
50
50
|
user: UserResponse;
|
|
51
51
|
lastReadMessageId?: string;
|
|
52
|
+
firstUnreadMessageId?: string;
|
|
52
53
|
};
|
|
53
54
|
export type ThreadReadState = Record<string, ThreadUserReadState | undefined>;
|
|
54
55
|
export declare const THREAD_RESPONSE_RESERVED_KEYS: Record<keyof ThreadResponse, true>;
|
|
@@ -74,6 +75,7 @@ export declare class Thread extends WithSubscriptions {
|
|
|
74
75
|
private subscribeMarkActiveThreadRead;
|
|
75
76
|
private subscribeReloadActiveStaleThread;
|
|
76
77
|
private subscribeMarkThreadStale;
|
|
78
|
+
private subscribeRepliesUnread;
|
|
77
79
|
private subscribeNewReplies;
|
|
78
80
|
private subscribeRepliesRead;
|
|
79
81
|
private subscribeMessageDeleted;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Channel } from './channel';
|
|
|
3
3
|
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
4
4
|
import type { StableWSConnection } from './connection';
|
|
5
5
|
import type { Role } from './permissions';
|
|
6
|
-
import type { CustomAttachmentData, CustomChannelData, CustomCommandData, CustomEventData, CustomMemberData, CustomMessageData, CustomPollData, CustomPollOptionData, CustomReactionData, CustomThreadData, CustomUserData } from './custom_types';
|
|
6
|
+
import type { CustomAttachmentData, CustomChannelData, CustomCommandData, CustomEventData, CustomEventTypes, CustomMemberData, CustomMessageData, CustomPollData, CustomPollOptionData, CustomReactionData, CustomThreadData, CustomUserData } from './custom_types';
|
|
7
7
|
import type { NotificationManager } from './notifications';
|
|
8
8
|
import type { RESERVED_UPDATED_MESSAGE_FIELDS } from './constants';
|
|
9
9
|
/**
|
|
@@ -49,6 +49,8 @@ export type AppSettingsAPIResponse = APIResponse & {
|
|
|
49
49
|
app?: {
|
|
50
50
|
id?: string | number;
|
|
51
51
|
allow_multi_user_devices?: boolean;
|
|
52
|
+
feed_audit_logs_enabled?: boolean;
|
|
53
|
+
moderation_onboarding_complete?: boolean | null;
|
|
52
54
|
call_types: any;
|
|
53
55
|
channel_configs: Record<string, {
|
|
54
56
|
reminders: boolean;
|
|
@@ -312,7 +314,7 @@ export type ChannelAPIResponse = {
|
|
|
312
314
|
hidden?: boolean;
|
|
313
315
|
membership?: ChannelMemberResponse | null;
|
|
314
316
|
pending_messages?: PendingMessageResponse[];
|
|
315
|
-
push_preferences?:
|
|
317
|
+
push_preferences?: ChannelPushPreference;
|
|
316
318
|
read?: ReadResponse[];
|
|
317
319
|
threads?: ThreadResponse[];
|
|
318
320
|
watcher_count?: number;
|
|
@@ -569,21 +571,51 @@ export type GetUnreadCountAPIResponse = APIResponse & {
|
|
|
569
571
|
total_unread_threads_count: number;
|
|
570
572
|
total_unread_count_by_team?: Record<string, number>;
|
|
571
573
|
};
|
|
572
|
-
export type ChatLevelPushPreference = 'all' | 'none' | '
|
|
574
|
+
export type ChatLevelPushPreference = 'all' | 'mentions' | 'direct_mentions' | 'all_mentions' | 'none' | 'default' | (string & {});
|
|
575
|
+
export type CallLevelPushPreference = 'all' | 'none' | 'default' | (string & {});
|
|
576
|
+
/** Granular all/none toggle used by the chat sub-preferences. */
|
|
577
|
+
export type PushPreferenceLevel = 'all' | 'none' | (string & {});
|
|
578
|
+
/** Per-mention-type chat push preferences (matches OpenAPI `ChatPreferencesInput`). */
|
|
579
|
+
export type ChatPreferences = {
|
|
580
|
+
channel_mentions?: PushPreferenceLevel;
|
|
581
|
+
default_preference?: PushPreferenceLevel;
|
|
582
|
+
direct_mentions?: PushPreferenceLevel;
|
|
583
|
+
group_mentions?: PushPreferenceLevel;
|
|
584
|
+
here_mentions?: PushPreferenceLevel;
|
|
585
|
+
role_mentions?: PushPreferenceLevel;
|
|
586
|
+
thread_replies?: PushPreferenceLevel;
|
|
587
|
+
};
|
|
588
|
+
/**
|
|
589
|
+
* Input accepted by {@link StreamChat.setPushPreferences} (matches OpenAPI `PushPreferenceInput`).
|
|
590
|
+
*
|
|
591
|
+
* Set `channel_cid` to scope the preference to a single channel; leave it empty to
|
|
592
|
+
* set the user-level default. `user_id` is required for server-side auth and
|
|
593
|
+
* defaults to the connected user for client-side auth.
|
|
594
|
+
*/
|
|
573
595
|
export type PushPreference = {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
596
|
+
call_level?: CallLevelPushPreference;
|
|
597
|
+
channel_cid?: string;
|
|
598
|
+
chat_level?: ChatLevelPushPreference;
|
|
599
|
+
chat_preferences?: ChatPreferences;
|
|
600
|
+
disabled_until?: string;
|
|
601
|
+
remove_disable?: boolean;
|
|
602
|
+
user_id?: string;
|
|
578
603
|
};
|
|
604
|
+
/** Per-user push preferences returned by the API (matches OpenAPI `PushPreferencesResponse`). */
|
|
605
|
+
export type PushPreferencesResponse = {
|
|
606
|
+
call_level?: CallLevelPushPreference;
|
|
607
|
+
chat_level?: ChatLevelPushPreference;
|
|
608
|
+
chat_preferences?: ChatPreferences;
|
|
609
|
+
disabled_until?: string;
|
|
610
|
+
};
|
|
611
|
+
/** Per-channel push preferences returned by the API (matches OpenAPI `ChannelPushPreferencesResponse`). */
|
|
579
612
|
export type ChannelPushPreference = {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
removeDisable?: boolean;
|
|
613
|
+
chat_level?: ChatLevelPushPreference;
|
|
614
|
+
disabled_until?: string;
|
|
583
615
|
};
|
|
584
616
|
export type UpsertPushPreferencesResponse = APIResponse & {
|
|
585
|
-
|
|
586
|
-
|
|
617
|
+
user_channel_preferences: Record<string, Record<string, ChannelPushPreference>>;
|
|
618
|
+
user_preferences: Record<string, PushPreferencesResponse>;
|
|
587
619
|
};
|
|
588
620
|
export type GetUnreadCountBatchAPIResponse = APIResponse & {
|
|
589
621
|
counts_by_user: {
|
|
@@ -729,7 +761,7 @@ export type OwnUserBase = {
|
|
|
729
761
|
unread_threads: number;
|
|
730
762
|
invisible?: boolean;
|
|
731
763
|
privacy_settings?: PrivacySettings;
|
|
732
|
-
push_preferences?:
|
|
764
|
+
push_preferences?: PushPreferencesResponse;
|
|
733
765
|
roles?: string[];
|
|
734
766
|
total_unread_count_by_team?: Record<string, number> | null;
|
|
735
767
|
};
|
|
@@ -1471,12 +1503,13 @@ export type Event = CustomEventData & {
|
|
|
1471
1503
|
watcher_count?: number;
|
|
1472
1504
|
channel_last_message_at?: string;
|
|
1473
1505
|
app?: Record<string, unknown>;
|
|
1506
|
+
thread_id?: string;
|
|
1474
1507
|
};
|
|
1475
1508
|
export type UserCustomEvent = CustomEventData & {
|
|
1476
1509
|
type: string;
|
|
1477
1510
|
};
|
|
1478
1511
|
export type EventHandler = (event: Event) => void;
|
|
1479
|
-
export type EventTypes = 'all' | keyof typeof EVENT_MAP;
|
|
1512
|
+
export type EventTypes = 'all' | keyof typeof EVENT_MAP | keyof CustomEventTypes;
|
|
1480
1513
|
/**
|
|
1481
1514
|
* Filter Types
|
|
1482
1515
|
*/
|
|
@@ -1990,6 +2023,7 @@ export type BlockList = {
|
|
|
1990
2023
|
team?: string;
|
|
1991
2024
|
type?: string;
|
|
1992
2025
|
validate?: boolean;
|
|
2026
|
+
is_confusable_folding_enabled?: boolean;
|
|
1993
2027
|
is_leet_check_enabled?: boolean;
|
|
1994
2028
|
is_plural_check_enabled?: boolean;
|
|
1995
2029
|
};
|
|
@@ -2111,6 +2145,7 @@ export type ConnectionOpen = {
|
|
|
2111
2145
|
connection_id: string;
|
|
2112
2146
|
cid?: string;
|
|
2113
2147
|
created_at?: string;
|
|
2148
|
+
received_at?: string;
|
|
2114
2149
|
me?: OwnUserResponse;
|
|
2115
2150
|
type?: string;
|
|
2116
2151
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.48.0",
|
|
4
4
|
"description": "JS SDK for the Stream Chat API",
|
|
5
5
|
"homepage": "https://getstream.io/chat/",
|
|
6
6
|
"author": {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"test": "yarn test-unit",
|
|
99
99
|
"test-types": "yarn run-test-types && yarn run-types-gen",
|
|
100
100
|
"run-test-types": "node test/typescript/index.js",
|
|
101
|
-
"run-types-gen": "tsc
|
|
101
|
+
"run-types-gen": "tsc -p test/typescript/tsconfig.json",
|
|
102
102
|
"test-unit": "vitest",
|
|
103
103
|
"test-coverage": "vitest run --coverage",
|
|
104
104
|
"fix-staged": "lint-staged --config .lintstagedrc.fix.json --concurrent 1",
|
package/src/channel.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
ChannelFilters,
|
|
22
22
|
ChannelMemberAPIResponse,
|
|
23
23
|
ChannelMemberResponse,
|
|
24
|
+
ChannelPushPreference,
|
|
24
25
|
ChannelQueryOptions,
|
|
25
26
|
ChannelResponse,
|
|
26
27
|
ChannelUpdateOptions,
|
|
@@ -56,7 +57,6 @@ import type {
|
|
|
56
57
|
PinnedMessagePaginationOptions,
|
|
57
58
|
PinnedMessagesSort,
|
|
58
59
|
PollVoteData,
|
|
59
|
-
PushPreference,
|
|
60
60
|
QueryChannelAPIResponse,
|
|
61
61
|
QueryMembersOptions,
|
|
62
62
|
Reaction,
|
|
@@ -112,7 +112,7 @@ export class Channel {
|
|
|
112
112
|
lastTypingEvent: Date | null;
|
|
113
113
|
isTyping: boolean;
|
|
114
114
|
disconnected: boolean;
|
|
115
|
-
push_preferences?:
|
|
115
|
+
push_preferences?: ChannelPushPreference;
|
|
116
116
|
public readonly messageComposer: MessageComposer;
|
|
117
117
|
public readonly messageReceiptsTracker: MessageReceiptsTracker;
|
|
118
118
|
public readonly cooldownTimer: CooldownTimer;
|
package/src/custom_types.ts
CHANGED
|
@@ -2,6 +2,7 @@ export interface CustomAttachmentData {}
|
|
|
2
2
|
export interface CustomChannelData {}
|
|
3
3
|
export interface CustomCommandData {}
|
|
4
4
|
export interface CustomEventData {}
|
|
5
|
+
export interface CustomEventTypes {}
|
|
5
6
|
export interface CustomMemberData {}
|
|
6
7
|
export interface CustomMessageData {}
|
|
7
8
|
export interface CustomPollOptionData {}
|
package/src/index.ts
CHANGED
|
@@ -48,28 +48,30 @@ export class CommandSearchSource extends BaseSearchSourceSync<CommandSuggestion>
|
|
|
48
48
|
),
|
|
49
49
|
);
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
nameA
|
|
57
|
-
|
|
58
|
-
if (nameB?.indexOf(searchQuery) === 0) {
|
|
59
|
-
nameB = `0${nameB}`;
|
|
60
|
-
}
|
|
61
|
-
// Should confirm possible null / undefined when TS is fully implemented
|
|
62
|
-
if (nameA != null && nameB != null) {
|
|
63
|
-
if (nameA < nameB) {
|
|
64
|
-
return -1;
|
|
51
|
+
if (searchQuery) {
|
|
52
|
+
// sort alphabetically unless you're matching the first char
|
|
53
|
+
selectedCommands.sort((a, b) => {
|
|
54
|
+
let nameA = a.name?.toLowerCase();
|
|
55
|
+
let nameB = b.name?.toLowerCase();
|
|
56
|
+
if (nameA?.indexOf(searchQuery) === 0) {
|
|
57
|
+
nameA = `0${nameA}`;
|
|
65
58
|
}
|
|
66
|
-
if (
|
|
67
|
-
|
|
59
|
+
if (nameB?.indexOf(searchQuery) === 0) {
|
|
60
|
+
nameB = `0${nameB}`;
|
|
61
|
+
}
|
|
62
|
+
// Should confirm possible null / undefined when TS is fully implemented
|
|
63
|
+
if (nameA != null && nameB != null) {
|
|
64
|
+
if (nameA < nameB) {
|
|
65
|
+
return -1;
|
|
66
|
+
}
|
|
67
|
+
if (nameA > nameB) {
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
68
70
|
}
|
|
69
|
-
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
return 0;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
73
75
|
|
|
74
76
|
return {
|
|
75
77
|
items: selectedCommands.map((command) => ({
|
package/src/thread.ts
CHANGED
|
@@ -63,6 +63,7 @@ export type ThreadUserReadState = {
|
|
|
63
63
|
unreadMessageCount: number;
|
|
64
64
|
user: UserResponse;
|
|
65
65
|
lastReadMessageId?: string;
|
|
66
|
+
firstUnreadMessageId?: string;
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
export type ThreadReadState = Record<string, ThreadUserReadState | undefined>;
|
|
@@ -272,6 +273,7 @@ export class Thread extends WithSubscriptions {
|
|
|
272
273
|
this.addUnsubscribeFunction(this.subscribeMarkThreadStale());
|
|
273
274
|
this.addUnsubscribeFunction(this.subscribeNewReplies());
|
|
274
275
|
this.addUnsubscribeFunction(this.subscribeRepliesRead());
|
|
276
|
+
this.addUnsubscribeFunction(this.subscribeRepliesUnread());
|
|
275
277
|
this.addUnsubscribeFunction(this.subscribeMessageDeleted());
|
|
276
278
|
this.addUnsubscribeFunction(this.subscribeMessageUpdated());
|
|
277
279
|
};
|
|
@@ -330,6 +332,33 @@ export class Thread extends WithSubscriptions {
|
|
|
330
332
|
this.state.partialNext({ isStateStale: true });
|
|
331
333
|
}).unsubscribe;
|
|
332
334
|
|
|
335
|
+
private subscribeRepliesUnread = () =>
|
|
336
|
+
this.client.on('notification.mark_unread', (event) => {
|
|
337
|
+
if (!event.user || !event.created_at || !event.thread_id) return;
|
|
338
|
+
if (event.thread_id !== this.id) return;
|
|
339
|
+
|
|
340
|
+
const userId = event.user.id;
|
|
341
|
+
const createdAt = event.created_at;
|
|
342
|
+
const user = event.user;
|
|
343
|
+
|
|
344
|
+
this.state.next((current) => ({
|
|
345
|
+
...current,
|
|
346
|
+
read: {
|
|
347
|
+
...current.read,
|
|
348
|
+
[userId]: {
|
|
349
|
+
...current.read[userId],
|
|
350
|
+
lastReadAt:
|
|
351
|
+
typeof event.last_read_at !== 'undefined'
|
|
352
|
+
? new Date(event.last_read_at)
|
|
353
|
+
: new Date(createdAt),
|
|
354
|
+
user,
|
|
355
|
+
firstUnreadMessageId: event.first_unread_message_id,
|
|
356
|
+
unreadMessageCount: event.unread_messages ?? 0,
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
}));
|
|
360
|
+
}).unsubscribe;
|
|
361
|
+
|
|
333
362
|
private subscribeNewReplies = () =>
|
|
334
363
|
this.client.on('message.new', (event) => {
|
|
335
364
|
if (!this.client.userID || event.message?.parent_id !== this.id) {
|
package/src/thread_manager.ts
CHANGED
|
@@ -117,6 +117,7 @@ export class ThreadManager extends WithSubscriptions {
|
|
|
117
117
|
const unsubscribeFunctions = [
|
|
118
118
|
'health.check',
|
|
119
119
|
'notification.mark_read',
|
|
120
|
+
'notification.mark_unread',
|
|
120
121
|
'notification.thread_message_new',
|
|
121
122
|
'notification.channel_deleted',
|
|
122
123
|
].map(
|
package/src/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
CustomChannelData,
|
|
9
9
|
CustomCommandData,
|
|
10
10
|
CustomEventData,
|
|
11
|
+
CustomEventTypes,
|
|
11
12
|
CustomMemberData,
|
|
12
13
|
CustomMessageData,
|
|
13
14
|
CustomPollData,
|
|
@@ -83,6 +84,8 @@ export type AppSettingsAPIResponse = APIResponse & {
|
|
|
83
84
|
app?: {
|
|
84
85
|
id?: string | number;
|
|
85
86
|
allow_multi_user_devices?: boolean;
|
|
87
|
+
feed_audit_logs_enabled?: boolean;
|
|
88
|
+
moderation_onboarding_complete?: boolean | null;
|
|
86
89
|
// TODO
|
|
87
90
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
91
|
call_types: any;
|
|
@@ -377,7 +380,7 @@ export type ChannelAPIResponse = {
|
|
|
377
380
|
hidden?: boolean;
|
|
378
381
|
membership?: ChannelMemberResponse | null;
|
|
379
382
|
pending_messages?: PendingMessageResponse[];
|
|
380
|
-
push_preferences?:
|
|
383
|
+
push_preferences?: ChannelPushPreference;
|
|
381
384
|
read?: ReadResponse[];
|
|
382
385
|
threads?: ThreadResponse[];
|
|
383
386
|
watcher_count?: number;
|
|
@@ -682,25 +685,67 @@ export type GetUnreadCountAPIResponse = APIResponse & {
|
|
|
682
685
|
total_unread_count_by_team?: Record<string, number>;
|
|
683
686
|
};
|
|
684
687
|
|
|
685
|
-
export type ChatLevelPushPreference =
|
|
688
|
+
export type ChatLevelPushPreference =
|
|
689
|
+
| 'all'
|
|
690
|
+
| 'mentions' // deprecated by the API in favor of 'direct_mentions'
|
|
691
|
+
| 'direct_mentions'
|
|
692
|
+
| 'all_mentions'
|
|
693
|
+
| 'none'
|
|
694
|
+
| 'default'
|
|
695
|
+
| (string & {});
|
|
696
|
+
|
|
697
|
+
export type CallLevelPushPreference = 'all' | 'none' | 'default' | (string & {});
|
|
698
|
+
|
|
699
|
+
/** Granular all/none toggle used by the chat sub-preferences. */
|
|
700
|
+
export type PushPreferenceLevel = 'all' | 'none' | (string & {});
|
|
686
701
|
|
|
702
|
+
/** Per-mention-type chat push preferences (matches OpenAPI `ChatPreferencesInput`). */
|
|
703
|
+
export type ChatPreferences = {
|
|
704
|
+
channel_mentions?: PushPreferenceLevel;
|
|
705
|
+
default_preference?: PushPreferenceLevel;
|
|
706
|
+
direct_mentions?: PushPreferenceLevel;
|
|
707
|
+
group_mentions?: PushPreferenceLevel;
|
|
708
|
+
here_mentions?: PushPreferenceLevel;
|
|
709
|
+
role_mentions?: PushPreferenceLevel;
|
|
710
|
+
thread_replies?: PushPreferenceLevel;
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Input accepted by {@link StreamChat.setPushPreferences} (matches OpenAPI `PushPreferenceInput`).
|
|
715
|
+
*
|
|
716
|
+
* Set `channel_cid` to scope the preference to a single channel; leave it empty to
|
|
717
|
+
* set the user-level default. `user_id` is required for server-side auth and
|
|
718
|
+
* defaults to the connected user for client-side auth.
|
|
719
|
+
*/
|
|
687
720
|
export type PushPreference = {
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
721
|
+
call_level?: CallLevelPushPreference;
|
|
722
|
+
channel_cid?: string;
|
|
723
|
+
chat_level?: ChatLevelPushPreference;
|
|
724
|
+
chat_preferences?: ChatPreferences;
|
|
725
|
+
disabled_until?: string; // snooze until this time
|
|
726
|
+
remove_disable?: boolean; // stop snoozing (clears disabled_until)
|
|
727
|
+
user_id?: string;
|
|
692
728
|
};
|
|
693
729
|
|
|
730
|
+
/** Per-user push preferences returned by the API (matches OpenAPI `PushPreferencesResponse`). */
|
|
731
|
+
export type PushPreferencesResponse = {
|
|
732
|
+
call_level?: CallLevelPushPreference;
|
|
733
|
+
chat_level?: ChatLevelPushPreference;
|
|
734
|
+
chat_preferences?: ChatPreferences;
|
|
735
|
+
disabled_until?: string;
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
/** Per-channel push preferences returned by the API (matches OpenAPI `ChannelPushPreferencesResponse`). */
|
|
694
739
|
export type ChannelPushPreference = {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
removeDisable?: boolean; // Temporary flag for resetting disabledUntil
|
|
740
|
+
chat_level?: ChatLevelPushPreference; // "all", "mentions", "direct_mentions", "all_mentions", "none", "default" or other custom strings
|
|
741
|
+
disabled_until?: string;
|
|
698
742
|
};
|
|
699
743
|
|
|
700
744
|
export type UpsertPushPreferencesResponse = APIResponse & {
|
|
701
|
-
// Mapping of user
|
|
702
|
-
|
|
703
|
-
|
|
745
|
+
// Mapping of user id -> channel cid -> channel push preferences
|
|
746
|
+
user_channel_preferences: Record<string, Record<string, ChannelPushPreference>>;
|
|
747
|
+
// Mapping of user id -> user push preferences
|
|
748
|
+
user_preferences: Record<string, PushPreferencesResponse>;
|
|
704
749
|
};
|
|
705
750
|
|
|
706
751
|
export type GetUnreadCountBatchAPIResponse = APIResponse & {
|
|
@@ -859,7 +904,7 @@ export type OwnUserBase = {
|
|
|
859
904
|
unread_threads: number;
|
|
860
905
|
invisible?: boolean;
|
|
861
906
|
privacy_settings?: PrivacySettings;
|
|
862
|
-
push_preferences?:
|
|
907
|
+
push_preferences?: PushPreferencesResponse;
|
|
863
908
|
roles?: string[];
|
|
864
909
|
total_unread_count_by_team?: Record<string, number> | null;
|
|
865
910
|
};
|
|
@@ -1692,6 +1737,7 @@ export type Event = CustomEventData & {
|
|
|
1692
1737
|
watcher_count?: number;
|
|
1693
1738
|
channel_last_message_at?: string;
|
|
1694
1739
|
app?: Record<string, unknown>; // TODO: further specify type
|
|
1740
|
+
thread_id?: string;
|
|
1695
1741
|
};
|
|
1696
1742
|
|
|
1697
1743
|
export type UserCustomEvent = CustomEventData & {
|
|
@@ -1700,7 +1746,7 @@ export type UserCustomEvent = CustomEventData & {
|
|
|
1700
1746
|
|
|
1701
1747
|
export type EventHandler = (event: Event) => void;
|
|
1702
1748
|
|
|
1703
|
-
export type EventTypes = 'all' | keyof typeof EVENT_MAP;
|
|
1749
|
+
export type EventTypes = 'all' | keyof typeof EVENT_MAP | keyof CustomEventTypes;
|
|
1704
1750
|
|
|
1705
1751
|
/**
|
|
1706
1752
|
* Filter Types
|
|
@@ -2533,6 +2579,7 @@ export type BlockList = {
|
|
|
2533
2579
|
team?: string;
|
|
2534
2580
|
type?: string;
|
|
2535
2581
|
validate?: boolean;
|
|
2582
|
+
is_confusable_folding_enabled?: boolean;
|
|
2536
2583
|
is_leet_check_enabled?: boolean;
|
|
2537
2584
|
is_plural_check_enabled?: boolean;
|
|
2538
2585
|
};
|
|
@@ -2692,6 +2739,7 @@ export type ConnectionOpen = {
|
|
|
2692
2739
|
connection_id: string;
|
|
2693
2740
|
cid?: string;
|
|
2694
2741
|
created_at?: string;
|
|
2742
|
+
received_at?: string;
|
|
2695
2743
|
me?: OwnUserResponse;
|
|
2696
2744
|
type?: string;
|
|
2697
2745
|
};
|