stream-chat 9.43.0 → 9.43.1
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 +9 -12
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +9 -12
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +9 -12
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/client.d.ts +4 -2
- package/dist/types/messageComposer/attachmentManager.d.ts +1 -1
- package/dist/types/types.d.ts +19 -4
- package/dist/types/utils.d.ts +4 -2
- package/package.json +1 -1
- package/src/client.ts +0 -8
- package/src/connection.ts +5 -4
- package/src/messageComposer/MessageComposerEffectHandlers.ts +2 -0
- package/src/messageComposer/attachmentManager.ts +1 -2
- package/src/types.ts +27 -4
package/dist/types/client.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
import type WebSocket from 'isomorphic-ws';
|
|
3
2
|
import { Channel } from './channel';
|
|
4
3
|
import { ClientState } from './client_state';
|
|
5
4
|
import { StableWSConnection } from './connection';
|
|
@@ -409,7 +408,6 @@ export declare class StreamChat {
|
|
|
409
408
|
errorFromResponse(response: AxiosResponse<APIErrorResponse>): ErrorFromResponse<APIErrorResponse>;
|
|
410
409
|
handleResponse<T>(response: AxiosResponse<T>): T;
|
|
411
410
|
dispatchEvent: (event: Event) => void;
|
|
412
|
-
handleEvent: (messageEvent: WebSocket.MessageEvent) => void;
|
|
413
411
|
/**
|
|
414
412
|
* Updates the members, watchers and read references of the currently active channels that contain this user
|
|
415
413
|
*
|
|
@@ -1033,6 +1031,8 @@ export declare class StreamChat {
|
|
|
1033
1031
|
member?: import("./types").ChannelMemberResponse;
|
|
1034
1032
|
mentioned_users?: UserResponse[];
|
|
1035
1033
|
mentioned_channel?: boolean;
|
|
1034
|
+
mentioned_here?: boolean;
|
|
1035
|
+
mentioned_roles?: string[];
|
|
1036
1036
|
message_text_updated_at?: string;
|
|
1037
1037
|
moderation?: import("./types").ModerationResponse;
|
|
1038
1038
|
moderation_details?: import("./types").ModerationDetailsResponse;
|
|
@@ -1730,6 +1730,8 @@ export declare class StreamChat {
|
|
|
1730
1730
|
member?: import("./types").ChannelMemberResponse;
|
|
1731
1731
|
mentioned_users?: UserResponse[];
|
|
1732
1732
|
mentioned_channel?: boolean;
|
|
1733
|
+
mentioned_here?: boolean;
|
|
1734
|
+
mentioned_roles?: string[];
|
|
1733
1735
|
message_text_updated_at?: string;
|
|
1734
1736
|
moderation?: import("./types").ModerationResponse;
|
|
1735
1737
|
moderation_details?: import("./types").ModerationDetailsResponse;
|
|
@@ -42,7 +42,7 @@ export declare class AttachmentManager {
|
|
|
42
42
|
get pendingUploadsCount(): number;
|
|
43
43
|
get availableUploadSlots(): number;
|
|
44
44
|
getUploadsByState(state: AttachmentLoadingState): LocalAttachment[];
|
|
45
|
-
|
|
45
|
+
cancelAttachmentUploads: (attachments?: LocalAttachment[]) => void;
|
|
46
46
|
private normalizeSnapshotAttachment;
|
|
47
47
|
initState: ({ message }?: {
|
|
48
48
|
message?: DraftMessage | LocalMessage;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export type AppSettingsAPIResponse = APIResponse & {
|
|
|
81
81
|
uploads?: boolean;
|
|
82
82
|
url_enrichment?: boolean;
|
|
83
83
|
user_message_reminders?: boolean;
|
|
84
|
+
push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none' | '';
|
|
84
85
|
}>;
|
|
85
86
|
reminders_interval: number;
|
|
86
87
|
async_moderation_config?: AsyncModerationOptions;
|
|
@@ -115,9 +116,11 @@ export type AppSettingsAPIResponse = APIResponse & {
|
|
|
115
116
|
max_aggregated_activities_length?: number;
|
|
116
117
|
moderation_bulk_submit_action_enabled?: boolean;
|
|
117
118
|
moderation_dashboard_preferences?: Record<string, unknown> | null;
|
|
119
|
+
moderation_audio_call_moderation_enabled?: boolean;
|
|
118
120
|
moderation_enabled?: boolean;
|
|
119
121
|
moderation_llm_configurability_enabled?: boolean;
|
|
120
122
|
moderation_multitenant_blocklist_enabled?: boolean;
|
|
123
|
+
moderation_video_call_moderation_enabled?: boolean;
|
|
121
124
|
moderation_webhook_url?: string;
|
|
122
125
|
multi_tenant_enabled?: boolean;
|
|
123
126
|
name?: string;
|
|
@@ -450,8 +453,8 @@ export type LocalMessageBase = Omit<MessageResponseBase, 'created_at' | 'deleted
|
|
|
450
453
|
updated_at: Date;
|
|
451
454
|
};
|
|
452
455
|
export type LocalMessage = LocalMessageBase & {
|
|
453
|
-
error?: ErrorFromResponse<APIErrorResponse
|
|
454
|
-
quoted_message?: LocalMessageBase;
|
|
456
|
+
error?: ErrorFromResponse<APIErrorResponse> | null;
|
|
457
|
+
quoted_message?: LocalMessageBase | null;
|
|
455
458
|
};
|
|
456
459
|
/**
|
|
457
460
|
* @deprecated in favor of LocalMessage
|
|
@@ -627,6 +630,8 @@ export type MessageResponseBase = MessageBase & {
|
|
|
627
630
|
member?: ChannelMemberResponse;
|
|
628
631
|
mentioned_users?: UserResponse[];
|
|
629
632
|
mentioned_channel?: boolean;
|
|
633
|
+
mentioned_here?: boolean;
|
|
634
|
+
mentioned_roles?: string[];
|
|
630
635
|
message_text_updated_at?: string;
|
|
631
636
|
moderation?: ModerationResponse;
|
|
632
637
|
moderation_details?: ModerationDetailsResponse;
|
|
@@ -658,6 +663,12 @@ export type ReactionGroupResponse = {
|
|
|
658
663
|
sum_scores: number;
|
|
659
664
|
first_reaction_at?: string;
|
|
660
665
|
last_reaction_at?: string;
|
|
666
|
+
latest_reactions_by?: ReactionGroupUserResponse[];
|
|
667
|
+
};
|
|
668
|
+
export type ReactionGroupUserResponse = {
|
|
669
|
+
created_at: string;
|
|
670
|
+
user_id: string;
|
|
671
|
+
user?: UserResponse;
|
|
661
672
|
};
|
|
662
673
|
export type ModerationDetailsResponse = {
|
|
663
674
|
action: 'MESSAGE_RESPONSE_ACTION_BOUNCE' | (string & {});
|
|
@@ -1964,6 +1975,7 @@ export type ChannelConfigFields = {
|
|
|
1964
1975
|
uploads?: boolean;
|
|
1965
1976
|
url_enrichment?: boolean;
|
|
1966
1977
|
user_message_reminders?: boolean;
|
|
1978
|
+
push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none' | '';
|
|
1967
1979
|
};
|
|
1968
1980
|
export type ChannelConfigWithInfo = ChannelConfigFields & CreatedAtUpdatedAt & {
|
|
1969
1981
|
commands?: CommandResponse[];
|
|
@@ -2184,9 +2196,12 @@ export type Mute = {
|
|
|
2184
2196
|
updated_at: string;
|
|
2185
2197
|
user: UserResponse;
|
|
2186
2198
|
};
|
|
2199
|
+
export type PartialUpdateChannelFields = Partial<ChannelResponse> & {
|
|
2200
|
+
config_overrides?: Partial<ChannelConfigFields>;
|
|
2201
|
+
};
|
|
2187
2202
|
export type PartialUpdateChannel = {
|
|
2188
|
-
set?:
|
|
2189
|
-
unset?: Array<keyof
|
|
2203
|
+
set?: PartialUpdateChannelFields;
|
|
2204
|
+
unset?: Array<keyof PartialUpdateChannelFields>;
|
|
2190
2205
|
};
|
|
2191
2206
|
export type PartialUpdateMember = {
|
|
2192
2207
|
set?: ChannelMemberUpdates;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -122,6 +122,8 @@ export declare const toDeletedMessage: ({ message, deletedAt, hardDelete, }: {
|
|
|
122
122
|
deleted_reply_count?: number | undefined;
|
|
123
123
|
member?: import("./types").ChannelMemberResponse | undefined;
|
|
124
124
|
mentioned_channel?: boolean | undefined;
|
|
125
|
+
mentioned_here?: boolean | undefined;
|
|
126
|
+
mentioned_roles?: string[] | undefined;
|
|
125
127
|
message_text_updated_at?: string | undefined;
|
|
126
128
|
moderation?: import("./types").ModerationResponse | undefined;
|
|
127
129
|
moderation_details?: import("./types").ModerationDetailsResponse | undefined;
|
|
@@ -142,8 +144,8 @@ export declare const toDeletedMessage: ({ message, deletedAt, hardDelete, }: {
|
|
|
142
144
|
pinned_at: Date | null;
|
|
143
145
|
status: string;
|
|
144
146
|
updated_at: Date;
|
|
145
|
-
error?: import("./types").ErrorFromResponse<import("./types").APIErrorResponse
|
|
146
|
-
quoted_message?: LocalMessageBase;
|
|
147
|
+
error?: import("./types").ErrorFromResponse<import("./types").APIErrorResponse> | null;
|
|
148
|
+
quoted_message?: LocalMessageBase | null;
|
|
147
149
|
};
|
|
148
150
|
export declare const deleteUserMessages: ({ messages, user, hardDelete, deletedAt, }: {
|
|
149
151
|
messages: Array<LocalMessage>;
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import https from 'https';
|
|
7
|
-
import type WebSocket from 'isomorphic-ws';
|
|
8
7
|
|
|
9
8
|
import { Channel } from './channel';
|
|
10
9
|
import { ClientState } from './client_state';
|
|
@@ -1381,13 +1380,6 @@ export class StreamChat {
|
|
|
1381
1380
|
});
|
|
1382
1381
|
};
|
|
1383
1382
|
|
|
1384
|
-
handleEvent = (messageEvent: WebSocket.MessageEvent) => {
|
|
1385
|
-
// dispatch the event to the channel listeners
|
|
1386
|
-
const jsonString = messageEvent.data as string;
|
|
1387
|
-
const event = JSON.parse(jsonString) as Event;
|
|
1388
|
-
this.dispatchEvent(event);
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
1383
|
/**
|
|
1392
1384
|
* Updates the members, watchers and read references of the currently active channels that contain this user
|
|
1393
1385
|
*
|
package/src/connection.ts
CHANGED
|
@@ -477,12 +477,13 @@ export class StableWSConnection {
|
|
|
477
477
|
if (this.wsID !== wsID) return;
|
|
478
478
|
|
|
479
479
|
this._log('onmessage() - onmessage callback', { event, wsID });
|
|
480
|
-
|
|
480
|
+
if (typeof event.data !== 'string') return;
|
|
481
|
+
const data = JSON.parse(event.data);
|
|
481
482
|
|
|
482
483
|
// we wait till the first message before we consider the connection open..
|
|
483
484
|
// the reason for this is that auth errors and similar errors trigger a ws.onopen and immediately
|
|
484
485
|
// after that a ws.onclose..
|
|
485
|
-
if (!this.isResolved
|
|
486
|
+
if (!this.isResolved) {
|
|
486
487
|
this.isResolved = true;
|
|
487
488
|
if (data.error) {
|
|
488
489
|
this.rejectPromise?.(this._errorFromWSEvent(data, false));
|
|
@@ -496,11 +497,11 @@ export class StableWSConnection {
|
|
|
496
497
|
// trigger the event..
|
|
497
498
|
this.lastEvent = new Date();
|
|
498
499
|
|
|
499
|
-
if (data
|
|
500
|
+
if (data.type === 'health.check') {
|
|
500
501
|
this.scheduleNextPing();
|
|
501
502
|
}
|
|
502
503
|
|
|
503
|
-
this.client.
|
|
504
|
+
this.client.dispatchEvent(data);
|
|
504
505
|
this.scheduleConnectionCheck();
|
|
505
506
|
};
|
|
506
507
|
|
|
@@ -34,7 +34,9 @@ const applyCommandActivationEffect: MessageComposerEffectHandler<
|
|
|
34
34
|
selection: { start: 0, end: 0 },
|
|
35
35
|
text: '',
|
|
36
36
|
});
|
|
37
|
+
const attachmentsToCancel = composer.attachmentManager.attachments;
|
|
37
38
|
composer.attachmentManager.initState();
|
|
39
|
+
composer.attachmentManager.cancelAttachmentUploads(attachmentsToCancel);
|
|
38
40
|
composer.linkPreviewsManager.initState();
|
|
39
41
|
composer.locationComposer.initState();
|
|
40
42
|
composer.pollComposer.initState();
|
|
@@ -210,7 +210,7 @@ export class AttachmentManager {
|
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
cancelAttachmentUploads = (attachments: LocalAttachment[] = this.attachments) => {
|
|
214
214
|
for (const { localMetadata } of attachments) {
|
|
215
215
|
this.client.uploadManager.deleteUploadRecord(localMetadata.id);
|
|
216
216
|
}
|
|
@@ -232,7 +232,6 @@ export class AttachmentManager {
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
initState = ({ message }: { message?: DraftMessage | LocalMessage } = {}) => {
|
|
235
|
-
this.cancelAttachmentUploads(this.attachments);
|
|
236
235
|
this.state.next(initState({ message }));
|
|
237
236
|
};
|
|
238
237
|
|
package/src/types.ts
CHANGED
|
@@ -119,6 +119,13 @@ export type AppSettingsAPIResponse = APIResponse & {
|
|
|
119
119
|
uploads?: boolean;
|
|
120
120
|
url_enrichment?: boolean;
|
|
121
121
|
user_message_reminders?: boolean;
|
|
122
|
+
push_level?:
|
|
123
|
+
| 'all'
|
|
124
|
+
| 'all_mentions'
|
|
125
|
+
| 'direct_mentions'
|
|
126
|
+
| 'mentions'
|
|
127
|
+
| 'none'
|
|
128
|
+
| '';
|
|
122
129
|
}
|
|
123
130
|
>;
|
|
124
131
|
reminders_interval: number;
|
|
@@ -154,9 +161,11 @@ export type AppSettingsAPIResponse = APIResponse & {
|
|
|
154
161
|
max_aggregated_activities_length?: number;
|
|
155
162
|
moderation_bulk_submit_action_enabled?: boolean;
|
|
156
163
|
moderation_dashboard_preferences?: Record<string, unknown> | null;
|
|
164
|
+
moderation_audio_call_moderation_enabled?: boolean;
|
|
157
165
|
moderation_enabled?: boolean;
|
|
158
166
|
moderation_llm_configurability_enabled?: boolean;
|
|
159
167
|
moderation_multitenant_blocklist_enabled?: boolean;
|
|
168
|
+
moderation_video_call_moderation_enabled?: boolean;
|
|
160
169
|
moderation_webhook_url?: string;
|
|
161
170
|
multi_tenant_enabled?: boolean;
|
|
162
171
|
name?: string;
|
|
@@ -535,8 +544,8 @@ export type LocalMessageBase = Omit<
|
|
|
535
544
|
};
|
|
536
545
|
|
|
537
546
|
export type LocalMessage = LocalMessageBase & {
|
|
538
|
-
error?: ErrorFromResponse<APIErrorResponse
|
|
539
|
-
quoted_message?: LocalMessageBase;
|
|
547
|
+
error?: ErrorFromResponse<APIErrorResponse> | null;
|
|
548
|
+
quoted_message?: LocalMessageBase | null;
|
|
540
549
|
};
|
|
541
550
|
|
|
542
551
|
/**
|
|
@@ -744,6 +753,8 @@ export type MessageResponseBase = MessageBase & {
|
|
|
744
753
|
member?: ChannelMemberResponse;
|
|
745
754
|
mentioned_users?: UserResponse[];
|
|
746
755
|
mentioned_channel?: boolean;
|
|
756
|
+
mentioned_here?: boolean;
|
|
757
|
+
mentioned_roles?: string[];
|
|
747
758
|
message_text_updated_at?: string;
|
|
748
759
|
moderation?: ModerationResponse; // present only with Moderation v2
|
|
749
760
|
moderation_details?: ModerationDetailsResponse; // present only with Moderation v1
|
|
@@ -770,6 +781,13 @@ export type ReactionGroupResponse = {
|
|
|
770
781
|
sum_scores: number;
|
|
771
782
|
first_reaction_at?: string;
|
|
772
783
|
last_reaction_at?: string;
|
|
784
|
+
latest_reactions_by?: ReactionGroupUserResponse[];
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
export type ReactionGroupUserResponse = {
|
|
788
|
+
created_at: string;
|
|
789
|
+
user_id: string;
|
|
790
|
+
user?: UserResponse;
|
|
773
791
|
};
|
|
774
792
|
|
|
775
793
|
export type ModerationDetailsResponse = {
|
|
@@ -2500,6 +2518,7 @@ export type ChannelConfigFields = {
|
|
|
2500
2518
|
uploads?: boolean;
|
|
2501
2519
|
url_enrichment?: boolean;
|
|
2502
2520
|
user_message_reminders?: boolean; // Feature flag for user message reminders
|
|
2521
|
+
push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none' | '';
|
|
2503
2522
|
};
|
|
2504
2523
|
|
|
2505
2524
|
export type ChannelConfigWithInfo = ChannelConfigFields &
|
|
@@ -2920,9 +2939,13 @@ export type Mute = {
|
|
|
2920
2939
|
user: UserResponse;
|
|
2921
2940
|
};
|
|
2922
2941
|
|
|
2942
|
+
export type PartialUpdateChannelFields = Partial<ChannelResponse> & {
|
|
2943
|
+
config_overrides?: Partial<ChannelConfigFields>;
|
|
2944
|
+
};
|
|
2945
|
+
|
|
2923
2946
|
export type PartialUpdateChannel = {
|
|
2924
|
-
set?:
|
|
2925
|
-
unset?: Array<keyof
|
|
2947
|
+
set?: PartialUpdateChannelFields;
|
|
2948
|
+
unset?: Array<keyof PartialUpdateChannelFields>;
|
|
2926
2949
|
};
|
|
2927
2950
|
|
|
2928
2951
|
export type PartialUpdateMember = {
|