stream-chat 9.44.1 → 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 +3546 -2681
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +3555 -2681
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +3546 -2681
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/channel_manager.d.ts +5 -2
- package/dist/types/channel_state.d.ts +1 -1
- package/dist/types/client.d.ts +112 -5
- 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 +132 -2
- package/dist/types/utils.d.ts +2 -0
- package/package.json +38 -31
- package/src/channel_manager.ts +88 -13
- package/src/client.ts +217 -12
- 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 +161 -2
- package/src/utils.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StreamChat } from './client';
|
|
1
|
+
import type { QueryChannelsResponseWithChannels, StreamChat } from './client';
|
|
2
2
|
import type { ChannelFilters, ChannelOptions, ChannelSort, ChannelStateOptions, Event } from './types';
|
|
3
3
|
import type { ValueOrPatch } from './store';
|
|
4
4
|
import { StateStore } from './store';
|
|
@@ -10,6 +10,8 @@ export type ChannelManagerPagination = {
|
|
|
10
10
|
isLoading: boolean;
|
|
11
11
|
isLoadingNext: boolean;
|
|
12
12
|
options: ChannelOptions;
|
|
13
|
+
responseFilters?: ChannelFilters;
|
|
14
|
+
responseSort?: ChannelSort;
|
|
13
15
|
sort: ChannelSort;
|
|
14
16
|
};
|
|
15
17
|
export type ChannelManagerState = {
|
|
@@ -64,7 +66,8 @@ export type ChannelManagerOptions = {
|
|
|
64
66
|
*/
|
|
65
67
|
lockChannelOrder?: boolean;
|
|
66
68
|
};
|
|
67
|
-
export type
|
|
69
|
+
export type QueryChannelsRequestOutput = Channel[] | QueryChannelsResponseWithChannels;
|
|
70
|
+
export type QueryChannelsRequestType = (filters: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions, stateOptions?: ChannelStateOptions) => Promise<QueryChannelsRequestOutput>;
|
|
68
71
|
export declare const DEFAULT_CHANNEL_MANAGER_OPTIONS: {
|
|
69
72
|
abortInFlightQuery: boolean;
|
|
70
73
|
allowNotLoadedChannelPromotionForEvent: {
|
|
@@ -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, 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';
|
|
@@ -24,6 +24,9 @@ import { StateStore } from './store';
|
|
|
24
24
|
import type { MessageComposer } from './messageComposer';
|
|
25
25
|
import type { AbstractOfflineDB } from './offline-support';
|
|
26
26
|
type MessageComposerTearDownFunction = () => void;
|
|
27
|
+
export type QueryChannelsResponseWithChannels = Omit<QueryChannelsAPIResponse, 'channels'> & {
|
|
28
|
+
channels: Channel[];
|
|
29
|
+
};
|
|
27
30
|
type MessageComposerSetupFunction = ({ composer, }: {
|
|
28
31
|
composer: MessageComposer;
|
|
29
32
|
}) => void | MessageComposerTearDownFunction;
|
|
@@ -486,6 +489,75 @@ export declare class StreamChat {
|
|
|
486
489
|
queryUsers(filterConditions: UserFilters, sort?: UserSort, options?: UserOptions): Promise<APIResponse & {
|
|
487
490
|
users: Array<UserResponse>;
|
|
488
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>;
|
|
489
561
|
/**
|
|
490
562
|
* queryBannedUsers - Query user bans
|
|
491
563
|
*
|
|
@@ -513,7 +585,29 @@ export declare class StreamChat {
|
|
|
513
585
|
*/
|
|
514
586
|
queryMessageFlags(filterConditions?: MessageFlagsFilters, options?: MessageFlagsPaginationOptions): Promise<MessageFlagsResponse>;
|
|
515
587
|
/**
|
|
516
|
-
*
|
|
588
|
+
* queryChannelsRequestWithResponse - Queries channels and returns the full API response
|
|
589
|
+
* including top-level metadata such as `predefined_filter`.
|
|
590
|
+
*
|
|
591
|
+
* This exists as a compatibility bridge, as changing `queryChannelsRequest()` to return
|
|
592
|
+
* `QueryChannelsAPIResponse` would be a breaking change because it currently returns
|
|
593
|
+
* only the channel list. In the next major release, the request/response APIs should
|
|
594
|
+
* be consolidated so callers can access the full response through the primary API.
|
|
595
|
+
*
|
|
596
|
+
* @param {ChannelFilters} filterConditions object MongoDB style filters. Can be empty object when using predefined_filter in options.
|
|
597
|
+
* @param {ChannelSort} [sort] Sort options, for instance {created_at: -1}.
|
|
598
|
+
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
|
|
599
|
+
* @param {ChannelOptions} [options] Options object. Can include predefined_filter, filter_values, and sort_values for using predefined filters.
|
|
600
|
+
*
|
|
601
|
+
* @return {Promise<QueryChannelsAPIResponse>} full search channels response
|
|
602
|
+
*/
|
|
603
|
+
queryChannelsRequestWithResponse(filterConditions: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<QueryChannelsAPIResponse>;
|
|
604
|
+
/**
|
|
605
|
+
* queryChannelsRequest - Queries channels and returns the raw channel response list.
|
|
606
|
+
*
|
|
607
|
+
* This preserves the historical return shape for backwards compatibility. Use
|
|
608
|
+
* `queryChannelsRequestWithResponse()` when response level metadata such as
|
|
609
|
+
* `predefined_filter` is needed. In the next major release these APIs should be
|
|
610
|
+
* consolidated into a single full-response API.
|
|
517
611
|
*
|
|
518
612
|
* @param {ChannelFilters} filterConditions object MongoDB style filters. Can be empty object when using predefined_filter in options.
|
|
519
613
|
* @param {ChannelSort} [sort] Sort options, for instance {created_at: -1}.
|
|
@@ -533,10 +627,14 @@ export declare class StreamChat {
|
|
|
533
627
|
* @param {ChannelStateOptions} [stateOptions] State options object. These options will only be used for state management and won't be sent in the request.
|
|
534
628
|
* - stateOptions.skipInitialization - Skips the initialization of the state for the channels matching the ids in the list.
|
|
535
629
|
* - stateOptions.skipHydration - Skips returning the channels as instances of the Channel class and rather returns the raw query response.
|
|
630
|
+
* - stateOptions.withResponse - Returns the full query response with hydrated channels. This is a compatibility bridge for internal callers that need response-level metadata while the default return value remains `Channel[]`.
|
|
536
631
|
*
|
|
537
632
|
* @return {Promise<Array<Channel>>} search channels response
|
|
538
633
|
*/
|
|
539
|
-
queryChannels(filterConditions: ChannelFilters, sort
|
|
634
|
+
queryChannels(filterConditions: ChannelFilters, sort: ChannelSort, options: ChannelOptions, stateOptions: ChannelStateOptions & {
|
|
635
|
+
withResponse: true;
|
|
636
|
+
}): Promise<QueryChannelsResponseWithChannels>;
|
|
637
|
+
queryChannels(filterConditions?: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions, stateOptions?: ChannelStateOptions): Promise<Channel[]>;
|
|
540
638
|
/**
|
|
541
639
|
* queryReactions - Query reactions
|
|
542
640
|
*
|
|
@@ -1032,6 +1130,8 @@ export declare class StreamChat {
|
|
|
1032
1130
|
mentioned_users?: UserResponse[];
|
|
1033
1131
|
mentioned_channel?: boolean;
|
|
1034
1132
|
mentioned_here?: boolean;
|
|
1133
|
+
mentioned_group_ids?: string[];
|
|
1134
|
+
mentioned_groups?: import("./types").UserGroupResponse[];
|
|
1035
1135
|
mentioned_roles?: string[];
|
|
1036
1136
|
message_text_updated_at?: string;
|
|
1037
1137
|
moderation?: import("./types").ModerationResponse;
|
|
@@ -1313,12 +1413,17 @@ export declare class StreamChat {
|
|
|
1313
1413
|
* @param {string} name the new role name
|
|
1314
1414
|
* @returns {Promise<APIResponse>}
|
|
1315
1415
|
*/
|
|
1316
|
-
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>;
|
|
1317
1422
|
/** listRoles - returns the list of all roles for this application
|
|
1318
1423
|
*
|
|
1319
1424
|
* @returns {Promise<APIResponse>}
|
|
1320
1425
|
*/
|
|
1321
|
-
|
|
1426
|
+
searchRoles(options: SearchRolesOptions): Promise<SearchRolesAPIResponse>;
|
|
1322
1427
|
/** deleteRole - deletes a custom role
|
|
1323
1428
|
*
|
|
1324
1429
|
* @param {string} name the role name
|
|
@@ -1763,6 +1868,8 @@ export declare class StreamChat {
|
|
|
1763
1868
|
mentioned_users?: UserResponse[];
|
|
1764
1869
|
mentioned_channel?: boolean;
|
|
1765
1870
|
mentioned_here?: boolean;
|
|
1871
|
+
mentioned_group_ids?: string[];
|
|
1872
|
+
mentioned_groups?: import("./types").UserGroupResponse[];
|
|
1766
1873
|
mentioned_roles?: string[];
|
|
1767
1874
|
message_text_updated_at?: string;
|
|
1768
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
|
}
|