stream-chat 9.44.2 → 9.45.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 +3460 -2659
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +3469 -2659
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +3460 -2659
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/channel_state.d.ts +1 -1
- package/dist/types/client.d.ts +81 -3
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/configuration/commands.configuration.d.ts +6 -0
- package/dist/types/messageComposer/configuration/configuration.d.ts +1 -2
- package/dist/types/messageComposer/configuration/index.d.ts +4 -0
- package/dist/types/messageComposer/configuration/types.d.ts +21 -0
- package/dist/types/messageComposer/fileUtils.d.ts +1 -1
- package/dist/types/messageComposer/messageComposer.d.ts +6 -4
- package/dist/types/messageComposer/middleware/messageComposer/compositionValidation.d.ts +2 -1
- package/dist/types/messageComposer/middleware/messageComposer/textComposer.d.ts +1 -1
- package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +10 -1
- package/dist/types/messageComposer/middleware/textComposer/mentionUtils.d.ts +8 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +77 -15
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +51 -2
- package/dist/types/messageComposer/pollComposer.d.ts +2 -2
- package/dist/types/messageComposer/textComposer.d.ts +17 -3
- package/dist/types/pagination/UserGroupPaginator.d.ts +21 -0
- package/dist/types/pagination/index.d.ts +1 -0
- package/dist/types/types.d.ts +123 -2
- package/dist/types/utils.d.ts +2 -0
- package/package.json +38 -31
- package/src/client.ts +143 -2
- package/src/constants.ts +1 -0
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
- package/src/messageComposer/configuration/commands.configuration.ts +55 -0
- package/src/messageComposer/configuration/configuration.ts +3 -1
- package/src/messageComposer/configuration/index.ts +4 -0
- package/src/messageComposer/configuration/types.ts +27 -0
- package/src/messageComposer/messageComposer.ts +73 -22
- package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +23 -15
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +151 -31
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +68 -1
- package/src/messageComposer/middleware/textComposer/commands.ts +6 -2
- package/src/messageComposer/middleware/textComposer/mentionUtils.ts +33 -0
- package/src/messageComposer/middleware/textComposer/mentions.ts +596 -66
- package/src/messageComposer/middleware/textComposer/types.ts +70 -2
- package/src/messageComposer/textComposer.ts +154 -10
- package/src/pagination/UserGroupPaginator.ts +93 -0
- package/src/pagination/index.ts +1 -0
- package/src/permissions.ts +1 -0
- package/src/types.ts +152 -2
- package/src/utils.ts +1 -0
|
@@ -111,7 +111,7 @@ export declare class ChannelState {
|
|
|
111
111
|
*
|
|
112
112
|
*/
|
|
113
113
|
removePinnedMessage(message: MessageResponse): void;
|
|
114
|
-
addReaction(reaction: ReactionResponse, message?: MessageResponse, enforce_unique?: boolean):
|
|
114
|
+
addReaction(reaction: ReactionResponse, message?: MessageResponse, enforce_unique?: boolean): MessageResponse | LocalMessage | undefined;
|
|
115
115
|
_addReactionToState(messageFromState: LocalMessage, reaction: ReactionResponse, enforce_unique?: boolean): LocalMessage;
|
|
116
116
|
_addOwnReactionToMessage(ownReactions: ReactionResponse[] | null | undefined, reaction: ReactionResponse, enforce_unique?: boolean): ReactionResponse[];
|
|
117
117
|
_removeOwnReactionFromMessage(ownReactions: ReactionResponse[] | null | undefined, reaction: ReactionResponse): ReactionResponse[] | null | undefined;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { WSConnectionFallback } from './connection_fallback';
|
|
|
8
8
|
import { Campaign } from './campaign';
|
|
9
9
|
import { ChannelBatchUpdater } from './channel_batch_updater';
|
|
10
10
|
import { Segment } from './segment';
|
|
11
|
-
import type { ActiveLiveLocationsAPIResponse, APIErrorResponse, APIResponse, AppSettings, AppSettingsAPIResponse, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BaseDeviceFields, BlockList, BlockListResponse, BlockUserAPIResponse, CampaignData, CampaignFilters, CampaignQueryOptions, CampaignResponse, CampaignSort, CastVoteAPIResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelResponse, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CreateImportOptions, CreateImportResponse, CreateImportURLResponse, CreatePollAPIResponse, CreatePollData, CreatePollOptionAPIResponse, CreatePredefinedFilterOptions, CreateReminderOptions, CustomPermissionOptions, DeactivateUsersOptions, DeleteCommandResponse, DeleteMessageOptions, DeleteUserOptions, Device, DeviceIdentifier, DraftFilters, DraftSort, EndpointName, Event, EventAPIResponse, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, ExportUsersRequest, ExportUsersResponse, FlagMessageResponse, FlagReportsFilters, FlagReportsPaginationOptions, FlagReportsResponse, FlagsFilters, FlagsPaginationOptions, FlagsResponse, FlagUserResponse, FutureChannelBansResponse, GetBlockedUsersAPIResponse, GetCampaignOptions, GetChannelTypeResponse, GetCommandResponse, GetHookEventsResponse, GetImportResponse, GetMessageOptions, GetPollAPIResponse, GetRateLimitsResponse, GetRetentionPolicyResponse, GetRetentionPolicyRunsOptions, GetRetentionPolicyRunsResponse, GetThreadAPIResponse, GetThreadOptions, GetUnreadCountAPIResponse, GetUnreadCountBatchAPIResponse, ListChannelResponse, ListCommandsResponse, ListImportsPaginationOptions, ListImportsResponse, ListPredefinedFiltersOptions, ListPredefinedFiltersResponse, LocalMessage, Logger, MarkChannelsReadOptions, MarkDeliveredOptions, MessageFilters, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OGAttachment, OwnUserResponse, Pager, PartialMessageUpdate, PartialPollUpdate, PartialThreadUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PollAnswersAPIResponse, PollData, PollOptionData, PollSort, PollVote, PollVoteData, PollVotesAPIResponse, PredefinedFilterResponse, Product, PushPreference, PushProvider, PushProviderConfig, PushProviderID, PushProviderListResponse, PushProviderUpsertResponse, QueryChannelsAPIResponse, QueryDraftsResponse, QueryFutureChannelBansOptions, QueryMessageHistoryFilters, QueryMessageHistoryOptions, QueryMessageHistoryResponse, QueryMessageHistorySort, QueryPollsFilters, QueryPollsOptions, QueryPollsResponse, QueryReactionsAPIResponse, QueryReactionsOptions, QueryRemindersOptions, QueryRemindersResponse, QuerySegmentsOptions, QuerySegmentTargetsFilter, QueryTeamUsageStatsOptions, QueryTeamUsageStatsResponse, QueryThreadsOptions, QueryVotesFilters, QueryVotesOptions, ReactionFilters, ReactionResponse, ReactionSort, ReactivateUserOptions, ReactivateUsersOptions, ReminderAPIResponse, ReviewFlagReportOptions, ReviewFlagReportResponse, SdkIdentifier, SearchAPIResponse, SearchOptions, SegmentData, SegmentResponse, SegmentTargetsResponse, SegmentType, SendFileAPIResponse, SetRetentionPolicyResponse, SharedLocationResponse, SortParam, StreamChatOptions, SyncOptions, SyncResponse, TaskResponse, TaskStatus, TestPushDataInput, TestSNSDataInput, TestSQSDataInput, TokenOrProvider, TranslateResponse, UnBanUserOptions, UpdateChannelsBatchOptions, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, UpdateCommandResponse, UpdateLocationPayload, UpdateMessageAPIResponse, UpdateMessageOptions, UpdatePollAPIResponse, UpdatePredefinedFilterOptions, UpdateReminderOptions, UpdateSegmentData, UpdateUsersAPIResponse, UpsertPushPreferencesResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, VoteSort } from './types';
|
|
11
|
+
import type { ActiveLiveLocationsAPIResponse, AddUserGroupMembersOptions, AddUserGroupMembersResponse, APIErrorResponse, APIResponse, AppSettings, AppSettingsAPIResponse, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BaseDeviceFields, BlockList, BlockListResponse, BlockUserAPIResponse, CampaignData, CampaignFilters, CampaignQueryOptions, CampaignResponse, CampaignSort, CastVoteAPIResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelResponse, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CreateImportOptions, CreateImportResponse, CreateImportURLResponse, CreatePollAPIResponse, CreatePollData, CreatePollOptionAPIResponse, CreatePredefinedFilterOptions, CreateReminderOptions, CreateRoleAPIResponse, CreateUserGroupOptions, CreateUserGroupResponse, CustomPermissionOptions, DeactivateUsersOptions, DeleteCommandResponse, DeleteMessageOptions, DeleteUserGroupOptions, DeleteUserOptions, Device, DeviceIdentifier, DraftFilters, DraftSort, EndpointName, Event, EventAPIResponse, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, ExportUsersRequest, ExportUsersResponse, FlagMessageResponse, FlagReportsFilters, FlagReportsPaginationOptions, FlagReportsResponse, FlagsFilters, FlagsPaginationOptions, FlagsResponse, FlagUserResponse, FutureChannelBansResponse, GetBlockedUsersAPIResponse, GetCampaignOptions, GetChannelTypeResponse, GetCommandResponse, GetHookEventsResponse, GetImportResponse, GetMessageOptions, GetPollAPIResponse, GetRateLimitsResponse, GetRetentionPolicyResponse, GetRetentionPolicyRunsOptions, GetRetentionPolicyRunsResponse, GetThreadAPIResponse, GetThreadOptions, GetUnreadCountAPIResponse, GetUnreadCountBatchAPIResponse, GetUserGroupOptions, GetUserGroupResponse, ListChannelResponse, ListCommandsResponse, ListImportsPaginationOptions, ListImportsResponse, ListPredefinedFiltersOptions, ListPredefinedFiltersResponse, ListRolesAPIResponse, LocalMessage, Logger, MarkChannelsReadOptions, MarkDeliveredOptions, MessageFilters, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OGAttachment, OwnUserResponse, Pager, PartialMessageUpdate, PartialPollUpdate, PartialThreadUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PollAnswersAPIResponse, PollData, PollOptionData, PollSort, PollVote, PollVoteData, PollVotesAPIResponse, PredefinedFilterResponse, Product, PushPreference, PushProvider, PushProviderConfig, PushProviderID, PushProviderListResponse, PushProviderUpsertResponse, QueryChannelsAPIResponse, QueryDraftsResponse, QueryFutureChannelBansOptions, QueryMessageHistoryFilters, QueryMessageHistoryOptions, QueryMessageHistoryResponse, QueryMessageHistorySort, QueryPollsFilters, QueryPollsOptions, QueryPollsResponse, QueryReactionsAPIResponse, QueryReactionsOptions, QueryRemindersOptions, QueryRemindersResponse, QuerySegmentsOptions, QuerySegmentTargetsFilter, QueryTeamUsageStatsOptions, QueryTeamUsageStatsResponse, QueryThreadsOptions, QueryUserGroupsOptions, QueryUserGroupsResponse, QueryVotesFilters, QueryVotesOptions, ReactionFilters, ReactionResponse, ReactionSort, ReactivateUserOptions, ReactivateUsersOptions, ReminderAPIResponse, RemoveUserGroupMembersOptions, RemoveUserGroupMembersResponse, ReviewFlagReportOptions, ReviewFlagReportResponse, SdkIdentifier, SearchAPIResponse, SearchOptions, SearchRolesAPIResponse, SearchRolesOptions, SearchUserGroupsOptions, SearchUserGroupsResponse, SegmentData, SegmentResponse, SegmentTargetsResponse, SegmentType, SendFileAPIResponse, SetRetentionPolicyResponse, SharedLocationResponse, SortParam, StreamChatOptions, SyncOptions, SyncResponse, TaskResponse, TaskStatus, TestPushDataInput, TestSNSDataInput, TestSQSDataInput, TokenOrProvider, TranslateResponse, UnBanUserOptions, UpdateChannelsBatchOptions, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, UpdateCommandResponse, UpdateLocationPayload, UpdateMessageAPIResponse, UpdateMessageOptions, UpdatePollAPIResponse, UpdatePredefinedFilterOptions, UpdateReminderOptions, UpdateSegmentData, UpdateUserGroupOptions, UpdateUserGroupResponse, UpdateUsersAPIResponse, UpsertPushPreferencesResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, VoteSort } from './types';
|
|
12
12
|
import { ErrorFromResponse } from './types';
|
|
13
13
|
import { InsightMetrics } from './insights';
|
|
14
14
|
import { Thread } from './thread';
|
|
@@ -489,6 +489,75 @@ export declare class StreamChat {
|
|
|
489
489
|
queryUsers(filterConditions: UserFilters, sort?: UserSort, options?: UserOptions): Promise<APIResponse & {
|
|
490
490
|
users: Array<UserResponse>;
|
|
491
491
|
}>;
|
|
492
|
+
/**
|
|
493
|
+
* queryUserGroups - List user groups with cursor-based pagination.
|
|
494
|
+
*
|
|
495
|
+
* @param {QueryUserGroupsOptions} options The query options
|
|
496
|
+
*
|
|
497
|
+
* @return {Promise<QueryUserGroupsResponse>} User Group Query Response
|
|
498
|
+
*/
|
|
499
|
+
queryUserGroups(options?: QueryUserGroupsOptions): Promise<QueryUserGroupsResponse>;
|
|
500
|
+
/**
|
|
501
|
+
* createUserGroup - Create a user group
|
|
502
|
+
*
|
|
503
|
+
* @param {CreateUserGroupOptions} options The create options
|
|
504
|
+
*
|
|
505
|
+
* @return {Promise<CreateUserGroupResponse>} User Group Create Response
|
|
506
|
+
*/
|
|
507
|
+
createUserGroup(options: CreateUserGroupOptions): Promise<CreateUserGroupResponse>;
|
|
508
|
+
/**
|
|
509
|
+
* getUserGroup - Get a user group by ID
|
|
510
|
+
*
|
|
511
|
+
* @param {string} id The user group ID
|
|
512
|
+
* @param {GetUserGroupOptions} options Optional query options
|
|
513
|
+
*
|
|
514
|
+
* @return {Promise<GetUserGroupResponse>} User Group Get Response
|
|
515
|
+
*/
|
|
516
|
+
getUserGroup(id: string, options?: GetUserGroupOptions): Promise<GetUserGroupResponse>;
|
|
517
|
+
/**
|
|
518
|
+
* searchUserGroups - Search user groups by prefix for autocomplete
|
|
519
|
+
*
|
|
520
|
+
* @param {SearchUserGroupsOptions} options The search options
|
|
521
|
+
*
|
|
522
|
+
* @return {Promise<SearchUserGroupsResponse>} User Group Search Response
|
|
523
|
+
*/
|
|
524
|
+
searchUserGroups(options: SearchUserGroupsOptions): Promise<SearchUserGroupsResponse>;
|
|
525
|
+
/**
|
|
526
|
+
* updateUserGroup - Update a user group by ID
|
|
527
|
+
*
|
|
528
|
+
* @param {string} id The user group ID
|
|
529
|
+
* @param {UpdateUserGroupOptions} options The update options
|
|
530
|
+
*
|
|
531
|
+
* @return {Promise<UpdateUserGroupResponse>} User Group Update Response
|
|
532
|
+
*/
|
|
533
|
+
updateUserGroup(id: string, options: UpdateUserGroupOptions): Promise<UpdateUserGroupResponse>;
|
|
534
|
+
/**
|
|
535
|
+
* deleteUserGroup - Delete a user group by ID
|
|
536
|
+
*
|
|
537
|
+
* @param {string} id The user group ID
|
|
538
|
+
* @param {DeleteUserGroupOptions} options Optional query options
|
|
539
|
+
*
|
|
540
|
+
* @return {Promise<APIResponse>} User Group Delete Response
|
|
541
|
+
*/
|
|
542
|
+
deleteUserGroup(id: string, options?: DeleteUserGroupOptions): Promise<APIResponse>;
|
|
543
|
+
/**
|
|
544
|
+
* addUserGroupMembers - Add members to a user group
|
|
545
|
+
*
|
|
546
|
+
* @param {string} id The user group ID
|
|
547
|
+
* @param {AddUserGroupMembersOptions} options The add-members options
|
|
548
|
+
*
|
|
549
|
+
* @return {Promise<AddUserGroupMembersResponse>} User Group Add Members Response
|
|
550
|
+
*/
|
|
551
|
+
addUserGroupMembers(id: string, options: AddUserGroupMembersOptions): Promise<AddUserGroupMembersResponse>;
|
|
552
|
+
/**
|
|
553
|
+
* removeUserGroupMembers - Remove members from a user group
|
|
554
|
+
*
|
|
555
|
+
* @param {string} id The user group ID
|
|
556
|
+
* @param {RemoveUserGroupMembersOptions} options The remove-members options
|
|
557
|
+
*
|
|
558
|
+
* @return {Promise<RemoveUserGroupMembersResponse>} User Group Remove Members Response
|
|
559
|
+
*/
|
|
560
|
+
removeUserGroupMembers(id: string, options: RemoveUserGroupMembersOptions): Promise<RemoveUserGroupMembersResponse>;
|
|
492
561
|
/**
|
|
493
562
|
* queryBannedUsers - Query user bans
|
|
494
563
|
*
|
|
@@ -1061,6 +1130,8 @@ export declare class StreamChat {
|
|
|
1061
1130
|
mentioned_users?: UserResponse[];
|
|
1062
1131
|
mentioned_channel?: boolean;
|
|
1063
1132
|
mentioned_here?: boolean;
|
|
1133
|
+
mentioned_group_ids?: string[];
|
|
1134
|
+
mentioned_groups?: import("./types").UserGroupResponse[];
|
|
1064
1135
|
mentioned_roles?: string[];
|
|
1065
1136
|
message_text_updated_at?: string;
|
|
1066
1137
|
moderation?: import("./types").ModerationResponse;
|
|
@@ -1342,12 +1413,17 @@ export declare class StreamChat {
|
|
|
1342
1413
|
* @param {string} name the new role name
|
|
1343
1414
|
* @returns {Promise<APIResponse>}
|
|
1344
1415
|
*/
|
|
1345
|
-
createRole(name: string): Promise<
|
|
1416
|
+
createRole(name: string): Promise<CreateRoleAPIResponse>;
|
|
1417
|
+
/** listRoles - returns the list of all roles for this application
|
|
1418
|
+
*
|
|
1419
|
+
* @returns {Promise<APIResponse>}
|
|
1420
|
+
*/
|
|
1421
|
+
listRoles(): Promise<ListRolesAPIResponse>;
|
|
1346
1422
|
/** listRoles - returns the list of all roles for this application
|
|
1347
1423
|
*
|
|
1348
1424
|
* @returns {Promise<APIResponse>}
|
|
1349
1425
|
*/
|
|
1350
|
-
|
|
1426
|
+
searchRoles(options: SearchRolesOptions): Promise<SearchRolesAPIResponse>;
|
|
1351
1427
|
/** deleteRole - deletes a custom role
|
|
1352
1428
|
*
|
|
1353
1429
|
* @param {string} name the role name
|
|
@@ -1792,6 +1868,8 @@ export declare class StreamChat {
|
|
|
1792
1868
|
mentioned_users?: UserResponse[];
|
|
1793
1869
|
mentioned_channel?: boolean;
|
|
1794
1870
|
mentioned_here?: boolean;
|
|
1871
|
+
mentioned_group_ids?: string[];
|
|
1872
|
+
mentioned_groups?: import("./types").UserGroupResponse[];
|
|
1795
1873
|
mentioned_roles?: string[];
|
|
1796
1874
|
message_text_updated_at?: string;
|
|
1797
1875
|
moderation?: import("./types").ModerationResponse;
|
|
@@ -22,7 +22,7 @@ export declare class LocationComposer {
|
|
|
22
22
|
readonly composer: MessageComposer;
|
|
23
23
|
private _deviceId;
|
|
24
24
|
constructor({ composer, message }: LocationComposerOptions);
|
|
25
|
-
get config(): import("
|
|
25
|
+
get config(): import("..").LocationComposerConfig;
|
|
26
26
|
get deviceId(): string;
|
|
27
27
|
get location(): StaticLocationPayload | LiveLocationPreview | null;
|
|
28
28
|
get validLocation(): StaticLocationPayload | LiveLocationPayload | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandsConfig, CommandSendValidator, MessageComposerConfig } from './types';
|
|
2
|
+
import type { DeepPartial } from '../../types.utility';
|
|
3
|
+
export declare const MENTION_ONLY_COMMANDS: Set<string>;
|
|
4
|
+
export declare const defaultCommandSendabilityValidator: CommandSendValidator;
|
|
5
|
+
export declare const DEFAULT_COMMANDS_CONFIG: CommandsConfig;
|
|
6
|
+
export declare const applyCommandValidatorOverride: (targetConfig: MessageComposerConfig, sourceConfig?: DeepPartial<MessageComposerConfig>) => MessageComposerConfig;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AttachmentManagerConfig, LinkPreviewsManagerConfig, LocationComposerConfig, MessageComposerConfig } from './types';
|
|
2
|
-
import type { TextComposerConfig } from './types';
|
|
1
|
+
import type { AttachmentManagerConfig, LinkPreviewsManagerConfig, LocationComposerConfig, MessageComposerConfig, TextComposerConfig } from './types';
|
|
3
2
|
export declare const DEFAULT_LINK_PREVIEW_MANAGER_CONFIG: LinkPreviewsManagerConfig;
|
|
4
3
|
export declare const DEFAULT_ATTACHMENT_MANAGER_CONFIG: AttachmentManagerConfig;
|
|
5
4
|
export declare const DEFAULT_TEXT_COMPOSER_CONFIG: TextComposerConfig;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export * from './configuration';
|
|
2
2
|
export * from './types';
|
|
3
|
+
export { applyCommandValidatorOverride } from './commands.configuration';
|
|
4
|
+
export { DEFAULT_COMMANDS_CONFIG } from './commands.configuration';
|
|
5
|
+
export { defaultCommandSendabilityValidator } from './commands.configuration';
|
|
6
|
+
export { MENTION_ONLY_COMMANDS } from './commands.configuration';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LinkPreview } from '../linkPreviewsManager';
|
|
2
2
|
import type { FileUploadFilter } from '../attachmentManager';
|
|
3
|
+
import type { MessageComposer } from '../messageComposer';
|
|
3
4
|
import type { FileLike, FileReference } from '../types';
|
|
5
|
+
import type { CommandResponse, UserResponse } from '../../types';
|
|
4
6
|
export type MinimumUploadRequestResult = {
|
|
5
7
|
file: string;
|
|
6
8
|
thumb_url?: string;
|
|
@@ -30,6 +32,23 @@ export type TextComposerConfig = {
|
|
|
30
32
|
/** Prevents sending a message longer than this length */
|
|
31
33
|
maxLengthOnSend?: number;
|
|
32
34
|
};
|
|
35
|
+
export type CommandSendability = {
|
|
36
|
+
command: CommandResponse;
|
|
37
|
+
ready: boolean;
|
|
38
|
+
reason?: string & {};
|
|
39
|
+
metadata?: Record<string, unknown>;
|
|
40
|
+
};
|
|
41
|
+
export type CommandSendValidationContext = {
|
|
42
|
+
command: CommandResponse;
|
|
43
|
+
composer: MessageComposer;
|
|
44
|
+
commandArgsText: string;
|
|
45
|
+
mentionedUsersInText: UserResponse[];
|
|
46
|
+
rawText: string;
|
|
47
|
+
};
|
|
48
|
+
export type CommandSendValidator = (context: CommandSendValidationContext) => CommandSendability | undefined;
|
|
49
|
+
export type CommandsConfig = {
|
|
50
|
+
sendValidator: CommandSendValidator;
|
|
51
|
+
};
|
|
33
52
|
export type AttachmentManagerConfig = {
|
|
34
53
|
/**
|
|
35
54
|
* Function that allows to prevent uploading files based on the functions output.
|
|
@@ -74,6 +93,8 @@ export type LocationComposerConfig = {
|
|
|
74
93
|
export type MessageComposerConfig = {
|
|
75
94
|
/** If true, enables creating drafts on the server */
|
|
76
95
|
drafts: DraftsConfiguration;
|
|
96
|
+
/** Configuration for command sendability validation */
|
|
97
|
+
commands: CommandsConfig;
|
|
77
98
|
/** Configuration for the attachment manager */
|
|
78
99
|
attachments: AttachmentManagerConfig;
|
|
79
100
|
/** Configuration for the link previews manager */
|
|
@@ -13,5 +13,5 @@ export declare const getExtensionFromMimeType: (mimeType: string) => string | un
|
|
|
13
13
|
export declare const readFileAsArrayBuffer: (file: File) => Promise<ArrayBuffer>;
|
|
14
14
|
export declare const generateFileName: (mimeType: string) => string;
|
|
15
15
|
export declare const isImageFile: (fileLike: FileReference | FileLike) => boolean;
|
|
16
|
-
export declare const getAttachmentTypeFromMimeType: (mimeType: string) => "file" | "
|
|
16
|
+
export declare const getAttachmentTypeFromMimeType: (mimeType: string) => "file" | "audio" | "video" | "image";
|
|
17
17
|
export declare const ensureIsLocalAttachment: (attachment: Attachment | LocalAttachment) => LocalAttachment | null;
|
|
@@ -14,7 +14,7 @@ import { Thread } from '../thread';
|
|
|
14
14
|
import type { ChannelAPIResponse, CommandResponse, DraftResponse, LocalMessage, LocalMessageBase, MessageResponse } from '../types';
|
|
15
15
|
import { WithSubscriptions } from '../utils/WithSubscriptions';
|
|
16
16
|
import type { StreamChat } from '../client';
|
|
17
|
-
import type { MessageComposerConfig } from './configuration/types';
|
|
17
|
+
import type { CommandSendability, MessageComposerConfig } from './configuration/types';
|
|
18
18
|
import type { CommandSuggestionDisabledReason, TextComposerCommandActivationEffect, TextComposerCommandClearEffect } from './middleware/textComposer/types';
|
|
19
19
|
import type { AttachmentManagerSnapshot } from './attachmentManager';
|
|
20
20
|
import type { CustomDataManagerSnapshot } from './CustomDataManager';
|
|
@@ -101,10 +101,12 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
101
101
|
get draftId(): string | null;
|
|
102
102
|
get lastChange(): LastComposerChange;
|
|
103
103
|
get quotedMessage(): LocalMessageBase | null;
|
|
104
|
-
getCommandDisabledReason: (command: CommandResponse) => CommandSuggestionDisabledReason | undefined;
|
|
105
|
-
isCommandDisabled: (command: CommandResponse) => boolean;
|
|
106
104
|
get pollId(): string | null;
|
|
107
105
|
get showReplyInChannel(): boolean;
|
|
106
|
+
getCommandDisabledReason: (command: CommandResponse) => CommandSuggestionDisabledReason | undefined;
|
|
107
|
+
isCommandDisabled: (command: CommandResponse) => boolean;
|
|
108
|
+
validateCommandSendability: (command: CommandResponse, text?: string) => CommandSendability;
|
|
109
|
+
get isCommandSendable(): boolean;
|
|
108
110
|
get hasSendableData(): boolean;
|
|
109
111
|
get compositionIsEmpty(): boolean;
|
|
110
112
|
get contentIsEmpty(): boolean;
|
|
@@ -149,7 +151,7 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
149
151
|
clear: () => void;
|
|
150
152
|
restore: () => void;
|
|
151
153
|
compose: () => Promise<MessageComposerMiddlewareValue["state"] | undefined>;
|
|
152
|
-
composeDraft: () => Promise<import("
|
|
154
|
+
composeDraft: () => Promise<import("..").MessageDraftComposerMiddlewareValueState | undefined>;
|
|
153
155
|
createDraft: () => Promise<void>;
|
|
154
156
|
deleteDraft: () => Promise<void>;
|
|
155
157
|
getDraft: () => Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { CommandSearchSource } from '../textComposer/commands';
|
|
1
2
|
import type { MessageCompositionMiddleware, MessageDraftCompositionMiddleware } from './types';
|
|
2
3
|
import type { MessageComposer } from '../../messageComposer';
|
|
3
|
-
export declare const createCompositionValidationMiddleware: (composer: MessageComposer) => MessageCompositionMiddleware;
|
|
4
|
+
export declare const createCompositionValidationMiddleware: (composer: MessageComposer, commandSearchSource?: CommandSearchSource) => MessageCompositionMiddleware;
|
|
4
5
|
export declare const createDraftCompositionValidationMiddleware: (composer: MessageComposer) => MessageDraftCompositionMiddleware;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageCompositionMiddleware, MessageDraftCompositionMiddleware } from './types';
|
|
2
1
|
import type { MessageComposer } from '../../messageComposer';
|
|
2
|
+
import type { MessageCompositionMiddleware, MessageDraftCompositionMiddleware } from './types';
|
|
3
3
|
export declare const createTextComposerCompositionMiddleware: (composer: MessageComposer) => MessageCompositionMiddleware;
|
|
4
4
|
export declare const createDraftTextComposerCompositionMiddleware: (composer: MessageComposer) => MessageDraftCompositionMiddleware;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { MessageComposer } from '../../messageComposer';
|
|
2
|
-
import type { CommandResponse } from '../../../types';
|
|
2
|
+
import type { CommandResponse, UserResponse } from '../../../types';
|
|
3
|
+
import type { CommandSendability } from '../../configuration';
|
|
4
|
+
import type { CommandSearchSource } from './commands';
|
|
3
5
|
export declare function escapeCommandRegExp(text: string): string;
|
|
4
6
|
export declare const getRawCommandName: (text?: string) => string | undefined;
|
|
5
7
|
export declare const getCompleteCommandInString: (text: string) => string | null;
|
|
6
8
|
export declare const stripCommandFromText: (text: string, commandName: string) => string;
|
|
9
|
+
export declare const stripMentionTokens: (text: string, mentionedUsersInText: UserResponse[], trigger?: string) => string;
|
|
10
|
+
export declare const getMentionedUsersInText: (text: string, mentionedUsers: UserResponse[]) => UserResponse[];
|
|
11
|
+
export declare const getCommandByName: (searchSource: CommandSearchSource, commandName?: string) => CommandResponse | undefined;
|
|
7
12
|
export declare const notifyCommandDisabled: (composer: MessageComposer, command: CommandResponse) => true | undefined;
|
|
13
|
+
export declare const notifyCommandNotReady: ({ composer, sendability, }: {
|
|
14
|
+
composer: MessageComposer;
|
|
15
|
+
sendability: CommandSendability;
|
|
16
|
+
}) => true | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UserResponse } from '../../../types';
|
|
2
|
+
import type { MentionEntity, UserMentionEntity, UserSuggestion } from './types';
|
|
3
|
+
export declare const isUserMentionEntity: (entity: MentionEntity) => entity is UserMentionEntity;
|
|
4
|
+
export declare const userResponseToMentionEntity: (user: UserResponse) => UserMentionEntity;
|
|
5
|
+
export declare const userResponsesToMentionEntities: (users: UserResponse[]) => UserMentionEntity[];
|
|
6
|
+
export declare const mentionEntityToUserResponse: (entity: UserMentionEntity) => UserResponse;
|
|
7
|
+
export declare const userSuggestionToUserResponse: (suggestion: UserSuggestion) => UserResponse;
|
|
8
|
+
export declare const userSuggestionToMentionEntity: (suggestion: UserSuggestion) => UserMentionEntity;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseSearchSource, type SearchSourceOptions } from '../../../search';
|
|
2
|
-
import type { TextComposerMiddlewareOptions, UserSuggestion } from './types';
|
|
2
|
+
import type { ChannelMentionSuggestion, HereMentionSuggestion, MentionSuggestion, RoleMentionSuggestion, TextComposerMiddlewareOptions, UserGroupMentionSuggestion, UserSuggestion } from './types';
|
|
3
3
|
import type { StreamChat } from '../../../client';
|
|
4
|
-
import type { MemberFilters, MemberSort, UserFilters, UserOptions, UserResponse, UserSort } from '../../../types';
|
|
4
|
+
import type { MemberFilters, MemberSort, UserFilters, UserGroupResponse, UserOptions, UserResponse, UserSort } from '../../../types';
|
|
5
5
|
import type { Channel } from '../../../channel';
|
|
6
6
|
import type { Middleware } from '../../../middleware';
|
|
7
7
|
import type { TextComposerMiddlewareExecutorState } from './TextComposerMiddlewareExecutor';
|
|
@@ -11,14 +11,46 @@ export declare const accentsMap: {
|
|
|
11
11
|
export declare const removeDiacritics: (text?: string) => string;
|
|
12
12
|
export declare const calculateLevenshtein: (query: string, name: string) => number;
|
|
13
13
|
export type MentionsSearchSourceOptions = SearchSourceOptions & {
|
|
14
|
+
allowedMentionTypes?: Partial<Record<MentionType, boolean>>;
|
|
14
15
|
mentionAllAppUsers?: boolean;
|
|
16
|
+
suggestionFactoryMappers?: MentionSuggestionFactoryMapperOverrides;
|
|
15
17
|
textComposerText?: string;
|
|
18
|
+
trigger?: string;
|
|
16
19
|
transliterate?: (text: string) => string;
|
|
17
20
|
};
|
|
18
|
-
|
|
21
|
+
type MentionType = MentionSuggestion['mentionType'];
|
|
22
|
+
type MentionSuggestionFactoryInputByType = {
|
|
23
|
+
channel: 'channel';
|
|
24
|
+
here: 'here';
|
|
25
|
+
role: string;
|
|
26
|
+
user: UserResponse;
|
|
27
|
+
user_group: UserGroupResponse;
|
|
28
|
+
};
|
|
29
|
+
type MentionSuggestionByType = {
|
|
30
|
+
channel: ChannelMentionSuggestion;
|
|
31
|
+
here: HereMentionSuggestion;
|
|
32
|
+
role: RoleMentionSuggestion;
|
|
33
|
+
user: UserSuggestion;
|
|
34
|
+
user_group: UserGroupMentionSuggestion;
|
|
35
|
+
};
|
|
36
|
+
export type MentionSuggestionFactoryMapperContext = {
|
|
37
|
+
searchToken: string;
|
|
38
|
+
source: MentionsSearchSource;
|
|
39
|
+
};
|
|
40
|
+
export type MentionSuggestionFactoryMapper<TMentionType extends MentionType = MentionType> = (value: MentionSuggestionFactoryInputByType[TMentionType], context: MentionSuggestionFactoryMapperContext) => MentionSuggestionByType[TMentionType];
|
|
41
|
+
export type MentionSuggestionFactoryMapperOverrides = {
|
|
42
|
+
[TMentionType in MentionType]?: MentionSuggestionFactoryMapper<TMentionType>;
|
|
43
|
+
};
|
|
44
|
+
type UserPaginationState = {
|
|
45
|
+
itemCount: number;
|
|
46
|
+
nextOffset?: number;
|
|
47
|
+
};
|
|
48
|
+
export declare class MentionsSearchSource extends BaseSearchSource<MentionSuggestion> {
|
|
19
49
|
readonly type = "mentions";
|
|
20
50
|
protected client: StreamChat;
|
|
21
51
|
protected channel: Channel;
|
|
52
|
+
protected latestUserPaginationState?: UserPaginationState;
|
|
53
|
+
protected userGroupCursor?: string;
|
|
22
54
|
userFilters: UserFilters | undefined;
|
|
23
55
|
memberFilters: MemberFilters | undefined;
|
|
24
56
|
userSort: UserSort | undefined;
|
|
@@ -27,9 +59,20 @@ export declare class MentionsSearchSource extends BaseSearchSource<UserSuggestio
|
|
|
27
59
|
config: MentionsSearchSourceOptions;
|
|
28
60
|
constructor(channel: Channel, options?: MentionsSearchSourceOptions);
|
|
29
61
|
get allMembersLoadedWithInitialChannelQuery(): boolean;
|
|
30
|
-
|
|
62
|
+
normalizeSearchValue: (value?: string) => string;
|
|
63
|
+
matchesSearchQuery: (value: string | undefined, searchQuery: string) => boolean;
|
|
64
|
+
matchesPrefixSearchQuery: (value: string | undefined, searchQuery: string) => boolean;
|
|
65
|
+
matchesUserNameSearchQuery: (value: string | undefined, searchQuery: string) => boolean;
|
|
66
|
+
isMentionTypeAllowed: (mentionType: MentionType) => boolean;
|
|
67
|
+
protected mapMentionSuggestion: <TMentionType extends MentionType>(mentionType: TMentionType, value: MentionSuggestionFactoryInputByType[TMentionType], searchToken?: string) => MentionSuggestionByType[TMentionType];
|
|
68
|
+
getChannelTeam: () => string | undefined;
|
|
69
|
+
toUserSuggestion: (user: UserResponse, searchToken?: string) => UserSuggestion;
|
|
70
|
+
toChannelMentionSuggestion: (searchToken?: string) => ChannelMentionSuggestion;
|
|
71
|
+
toHereMentionSuggestion: (searchToken?: string) => HereMentionSuggestion;
|
|
72
|
+
toRoleMentionSuggestion: (role: string, searchToken?: string) => RoleMentionSuggestion;
|
|
73
|
+
toUserGroupMentionSuggestion: (userGroup: UserGroupResponse, searchToken?: string) => UserGroupMentionSuggestion;
|
|
31
74
|
getStateBeforeFirstQuery(newSearchString: string): {
|
|
32
|
-
items:
|
|
75
|
+
items: MentionSuggestion[] | undefined;
|
|
33
76
|
hasNext: boolean;
|
|
34
77
|
isActive: boolean;
|
|
35
78
|
isLoading: boolean;
|
|
@@ -39,36 +82,54 @@ export declare class MentionsSearchSource extends BaseSearchSource<UserSuggestio
|
|
|
39
82
|
offset?: number;
|
|
40
83
|
};
|
|
41
84
|
canExecuteQuery: (newSearchString?: string) => boolean;
|
|
85
|
+
protected updatePaginationStateFromQuery(): {
|
|
86
|
+
hasNext: boolean;
|
|
87
|
+
next: undefined;
|
|
88
|
+
offset: number;
|
|
89
|
+
};
|
|
42
90
|
transliterate: (text: string) => string;
|
|
43
91
|
getMembersAndWatchers: () => UserResponse[];
|
|
92
|
+
getBuiltinMentionSuggestions: (searchQuery: string) => MentionSuggestion[];
|
|
93
|
+
getRoleMentionSuggestions: (query: string) => Promise<RoleMentionSuggestion[]>;
|
|
44
94
|
searchMembersLocally: (searchQuery: string) => UserResponse[];
|
|
45
|
-
prepareQueryUsersParams: (searchQuery: string) => {
|
|
95
|
+
prepareQueryUsersParams: (searchQuery: string, offset?: number) => {
|
|
46
96
|
filters: UserFilters;
|
|
47
97
|
sort: UserSort;
|
|
48
98
|
options: {
|
|
49
99
|
limit: number;
|
|
50
|
-
offset: number
|
|
100
|
+
offset: number;
|
|
51
101
|
include_deactivated_users?: boolean;
|
|
52
102
|
presence?: boolean;
|
|
53
103
|
};
|
|
54
104
|
};
|
|
55
|
-
prepareQueryMembersParams: (searchQuery: string) => {
|
|
105
|
+
prepareQueryMembersParams: (searchQuery: string, offset?: number) => {
|
|
56
106
|
filters: MemberFilters;
|
|
57
107
|
sort: MemberSort;
|
|
58
108
|
options: {
|
|
59
109
|
limit: number;
|
|
60
|
-
offset: number
|
|
110
|
+
offset: number;
|
|
61
111
|
include_deactivated_users?: boolean;
|
|
62
112
|
presence?: boolean;
|
|
63
113
|
};
|
|
64
114
|
};
|
|
65
|
-
queryUsers: (searchQuery: string) => Promise<UserResponse[]>;
|
|
66
|
-
queryMembers: (searchQuery: string) => Promise<UserResponse[]>;
|
|
67
|
-
|
|
115
|
+
queryUsers: (searchQuery: string, offset?: number) => Promise<UserResponse[]>;
|
|
116
|
+
queryMembers: (searchQuery: string, offset?: number) => Promise<UserResponse[]>;
|
|
117
|
+
getUserSuggestionsPage: (searchQuery: string, userOffset?: number) => Promise<{
|
|
68
118
|
items: UserSuggestion[];
|
|
119
|
+
nextOffset: number | undefined;
|
|
120
|
+
}>;
|
|
121
|
+
buildUserGroupSearchCursor: (items: UserGroupResponse[]) => string | undefined;
|
|
122
|
+
getUserGroupSuggestionsPage: (searchQuery: string, cursor?: string) => Promise<{
|
|
123
|
+
items: UserGroupMentionSuggestion[];
|
|
124
|
+
next: string | undefined;
|
|
125
|
+
}>;
|
|
126
|
+
query(searchQuery: string): Promise<{
|
|
127
|
+
items: MentionSuggestion[];
|
|
69
128
|
}>;
|
|
70
|
-
filterMutes
|
|
71
|
-
|
|
129
|
+
filterMutes(data: UserSuggestion[]): UserSuggestion[];
|
|
130
|
+
filterMutes(data: MentionSuggestion[]): MentionSuggestion[];
|
|
131
|
+
filterQueryResults(items: MentionSuggestion[]): MentionSuggestion[];
|
|
132
|
+
resetState(): void;
|
|
72
133
|
}
|
|
73
134
|
/**
|
|
74
135
|
* TextComposer middleware for mentions
|
|
@@ -88,7 +149,8 @@ export declare class MentionsSearchSource extends BaseSearchSource<UserSuggestio
|
|
|
88
149
|
* }} options
|
|
89
150
|
* @returns
|
|
90
151
|
*/
|
|
91
|
-
export type MentionsMiddleware = Middleware<TextComposerMiddlewareExecutorState<
|
|
152
|
+
export type MentionsMiddleware = Middleware<TextComposerMiddlewareExecutorState<MentionSuggestion>, 'onChange' | 'onSuggestionItemSelect'>;
|
|
92
153
|
export declare const createMentionsMiddleware: (channel: Channel, options?: Partial<TextComposerMiddlewareOptions> & {
|
|
93
154
|
searchSource?: MentionsSearchSource;
|
|
94
155
|
}) => MentionsMiddleware;
|
|
156
|
+
export {};
|
|
@@ -12,9 +12,54 @@ export type BaseSuggestion = {
|
|
|
12
12
|
};
|
|
13
13
|
export type CommandSuggestionDisabledReason = 'editing' | 'quoted_message';
|
|
14
14
|
export type CommandSuggestion = BaseSuggestion & CommandResponse;
|
|
15
|
-
export type UserSuggestion = BaseSuggestion & UserResponse & TokenizationPayload
|
|
15
|
+
export type UserSuggestion = BaseSuggestion & UserResponse & TokenizationPayload & {
|
|
16
|
+
mentionType: 'user';
|
|
17
|
+
};
|
|
18
|
+
export type ChannelMentionSuggestion = BaseSuggestion & TokenizationPayload & {
|
|
19
|
+
mentionType: 'channel';
|
|
20
|
+
name: 'channel';
|
|
21
|
+
};
|
|
22
|
+
export type HereMentionSuggestion = BaseSuggestion & TokenizationPayload & {
|
|
23
|
+
mentionType: 'here';
|
|
24
|
+
name: 'here';
|
|
25
|
+
};
|
|
26
|
+
export type RoleMentionSuggestion = BaseSuggestion & TokenizationPayload & {
|
|
27
|
+
mentionType: 'role';
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
export type UserGroupMentionSuggestion = BaseSuggestion & TokenizationPayload & {
|
|
31
|
+
description?: string;
|
|
32
|
+
memberCount?: number;
|
|
33
|
+
mentionType: 'user_group';
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
export type MentionSuggestion = UserSuggestion | ChannelMentionSuggestion | HereMentionSuggestion | RoleMentionSuggestion | UserGroupMentionSuggestion;
|
|
16
37
|
export type CustomValidSuggestion = BaseSuggestion & CustomTextComposerSuggestion;
|
|
17
|
-
export type Suggestion = CommandSuggestion |
|
|
38
|
+
export type Suggestion = CommandSuggestion | MentionSuggestion | CustomValidSuggestion;
|
|
39
|
+
export type UserMentionEntity = UserResponse & {
|
|
40
|
+
mentionType: 'user';
|
|
41
|
+
};
|
|
42
|
+
export type ChannelMentionEntity = {
|
|
43
|
+
id: 'channel';
|
|
44
|
+
mentionType: 'channel';
|
|
45
|
+
name: 'channel';
|
|
46
|
+
};
|
|
47
|
+
export type HereMentionEntity = {
|
|
48
|
+
id: 'here';
|
|
49
|
+
mentionType: 'here';
|
|
50
|
+
name: 'here';
|
|
51
|
+
};
|
|
52
|
+
export type RoleMentionEntity = {
|
|
53
|
+
id: string;
|
|
54
|
+
mentionType: 'role';
|
|
55
|
+
name?: string;
|
|
56
|
+
};
|
|
57
|
+
export type UserGroupMentionEntity = {
|
|
58
|
+
id: string;
|
|
59
|
+
mentionType: 'user_group';
|
|
60
|
+
name?: string;
|
|
61
|
+
};
|
|
62
|
+
export type MentionEntity = UserMentionEntity | ChannelMentionEntity | HereMentionEntity | RoleMentionEntity | UserGroupMentionEntity;
|
|
18
63
|
export type TextComposerStateSnapshot = TextComposerState;
|
|
19
64
|
export type TextComposerCommandActivationStateToRestore = Partial<TextComposerStateSnapshot>;
|
|
20
65
|
export type TextComposerCommandActivationEffect = {
|
|
@@ -43,7 +88,11 @@ export type TextSelection = {
|
|
|
43
88
|
start: number;
|
|
44
89
|
};
|
|
45
90
|
export type TextComposerState<T extends Suggestion = Suggestion> = {
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Use `mentions` instead.
|
|
93
|
+
*/
|
|
46
94
|
mentionedUsers: UserResponse[];
|
|
95
|
+
mentions?: MentionEntity[];
|
|
47
96
|
selection: TextSelection;
|
|
48
97
|
text: string;
|
|
49
98
|
command?: CommandResponse | null;
|
|
@@ -21,7 +21,7 @@ export declare class PollComposer {
|
|
|
21
21
|
get id(): string;
|
|
22
22
|
get max_votes_allowed(): string;
|
|
23
23
|
get name(): string;
|
|
24
|
-
get options(): import("
|
|
24
|
+
get options(): import("..").PollComposerOption[];
|
|
25
25
|
get user_id(): string | undefined;
|
|
26
26
|
get voting_visibility(): VotingVisibility | undefined;
|
|
27
27
|
get canCreatePoll(): boolean;
|
|
@@ -35,5 +35,5 @@ export declare class PollComposer {
|
|
|
35
35
|
*/
|
|
36
36
|
updateFields: (data: UpdateFieldsData, injectedFieldErrors?: PollComposerFieldErrors) => Promise<void>;
|
|
37
37
|
handleFieldBlur: (field: keyof PollComposerState["data"]) => Promise<void>;
|
|
38
|
-
compose: () => Promise<import("
|
|
38
|
+
compose: () => Promise<import("..").PollComposerCompositionMiddlewareValueState | undefined>;
|
|
39
39
|
}
|
|
@@ -2,7 +2,7 @@ import { TextComposerMiddlewareExecutor } from './middleware';
|
|
|
2
2
|
import { StateStore } from '../store';
|
|
3
3
|
import type { TextComposerSuggestion } from './middleware/textComposer/types';
|
|
4
4
|
import type { TextSelection } from './middleware/textComposer/types';
|
|
5
|
-
import type { TextComposerState, TextComposerStateSnapshot } from './middleware/textComposer/types';
|
|
5
|
+
import type { MentionEntity, TextComposerState, TextComposerStateSnapshot } from './middleware/textComposer/types';
|
|
6
6
|
import type { Suggestions } from './middleware/textComposer/types';
|
|
7
7
|
import type { MessageComposer } from './messageComposer';
|
|
8
8
|
import type { CommandResponse, DraftMessage, LocalMessage, UserResponse } from '../types';
|
|
@@ -18,7 +18,7 @@ export declare class TextComposer {
|
|
|
18
18
|
middlewareExecutor: TextComposerMiddlewareExecutor;
|
|
19
19
|
constructor({ composer, message }: TextComposerOptions);
|
|
20
20
|
get channel(): import("..").Channel;
|
|
21
|
-
get config(): import("
|
|
21
|
+
get config(): import("..").TextComposerConfig;
|
|
22
22
|
get enabled(): boolean;
|
|
23
23
|
set enabled(enabled: boolean);
|
|
24
24
|
get defaultValue(): string | undefined;
|
|
@@ -31,8 +31,9 @@ export declare class TextComposer {
|
|
|
31
31
|
set publishTypingEvents(publishTypingEvents: boolean);
|
|
32
32
|
get command(): CommandResponse | null | undefined;
|
|
33
33
|
get mentionedUsers(): UserResponse[];
|
|
34
|
+
get mentions(): MentionEntity[];
|
|
34
35
|
get selection(): TextSelection;
|
|
35
|
-
get suggestions(): Suggestions<import("
|
|
36
|
+
get suggestions(): Suggestions<import("..").Suggestion> | undefined;
|
|
36
37
|
get text(): string;
|
|
37
38
|
get textIsEmpty(): boolean;
|
|
38
39
|
initState: ({ message }?: {
|
|
@@ -41,10 +42,23 @@ export declare class TextComposer {
|
|
|
41
42
|
getSnapshot: (state?: TextComposerState) => TextComposerSnapshot;
|
|
42
43
|
restoreSnapshot: (snapshot: TextComposerSnapshot) => void;
|
|
43
44
|
setMentionedUsers(users: UserResponse[]): void;
|
|
45
|
+
setMentions(entities: MentionEntity[]): void;
|
|
44
46
|
clearCommand(): void;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use `upsertMentionEntity({ ...user, mentionType: 'user' })` instead.
|
|
49
|
+
*/
|
|
45
50
|
upsertMentionedUser: (user: UserResponse) => void;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use `getMentionEntity('user', userId)` instead.
|
|
53
|
+
*/
|
|
46
54
|
getMentionedUser: (userId: string) => UserResponse | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use `removeMentionEntity('user', userId)` instead.
|
|
57
|
+
*/
|
|
47
58
|
removeMentionedUser: (userId: string) => void;
|
|
59
|
+
upsertMentionEntity: (entity: MentionEntity) => void;
|
|
60
|
+
getMentionEntity: (mentionType: MentionEntity["mentionType"], id: MentionEntity["id"]) => MentionEntity | undefined;
|
|
61
|
+
removeMentionEntity: (mentionType: MentionEntity["mentionType"], id: MentionEntity["id"]) => void;
|
|
48
62
|
setCommand: (command: CommandResponse | null) => void;
|
|
49
63
|
setText: (text: string) => void;
|
|
50
64
|
setSelection: (selection: TextSelection) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BasePaginator } from './BasePaginator';
|
|
2
|
+
import type { PaginationQueryParams, PaginationQueryReturnValue, PaginatorOptions, PaginatorState } from './BasePaginator';
|
|
3
|
+
import type { UserGroupResponse } from '../types';
|
|
4
|
+
import type { StreamChat } from '../client';
|
|
5
|
+
/**
|
|
6
|
+
* Paginates user-group listing through `/usergroups`.
|
|
7
|
+
*
|
|
8
|
+
* This entity only supports forward cursor pagination via `created_at_gt` and `id_gt`.
|
|
9
|
+
* Previous-page pagination is not available because the API does not expose a backward cursor.
|
|
10
|
+
*/
|
|
11
|
+
export declare class UserGroupPaginator extends BasePaginator<UserGroupResponse> {
|
|
12
|
+
private client;
|
|
13
|
+
protected _teamId: string | undefined;
|
|
14
|
+
constructor(client: StreamChat, options?: PaginatorOptions);
|
|
15
|
+
get initialState(): PaginatorState<UserGroupResponse>;
|
|
16
|
+
get teamId(): string | undefined;
|
|
17
|
+
set teamId(teamId: string | undefined);
|
|
18
|
+
private buildNextCursor;
|
|
19
|
+
query: ({ direction, }: PaginationQueryParams) => Promise<PaginationQueryReturnValue<UserGroupResponse>>;
|
|
20
|
+
filterQueryResults: (items: UserGroupResponse[]) => UserGroupResponse[];
|
|
21
|
+
}
|