stream-chat
Advanced tools
Comparing version 4.2.0 to 4.3.0
/// <reference types="node" /> | ||
import { ChannelState } from './channel_state'; | ||
import { StreamChat } from './client'; | ||
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelQueryOptions, ChannelResponse, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, LiteralStringForUnion, MarkReadOptions, Message, MessageFilters, MessageResponse, MuteChannelAPIResponse, PaginationOptions, PartialUpdateChannel, PartialUpdateChannelAPIResponse, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchOptions, SearchAPIResponse, SendMessageAPIResponse, TruncateChannelAPIResponse, UnknownType, UpdateChannelAPIResponse, UserFilters, UserResponse, UserSort } from './types'; | ||
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelQueryOptions, ChannelResponse, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, LiteralStringForUnion, MarkReadOptions, MemberSort, Message, MessageFilters, MessageResponse, MuteChannelAPIResponse, PaginationOptions, PartialUpdateChannel, PartialUpdateChannelAPIResponse, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchOptions, SearchAPIResponse, SendMessageAPIResponse, TruncateChannelAPIResponse, UnknownType, UpdateChannelAPIResponse, UserFilters, UserResponse } from './types'; | ||
import { Role } from './permissions'; | ||
@@ -52,3 +52,4 @@ /** | ||
* @param {Message<AttachmentType, MessageType, UserType>} message The Message object | ||
* @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications | ||
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message | ||
* @param {boolean} [options.skip_push] Skip sending push notifications | ||
* | ||
@@ -58,2 +59,3 @@ * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response | ||
sendMessage(message: Message<AttachmentType, MessageType, UserType>, options?: { | ||
skip_enrich_url?: boolean; | ||
skip_push?: boolean; | ||
@@ -91,4 +93,4 @@ }): Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>; | ||
* @param {UserFilters<UserType>} filterConditions object MongoDB style filters | ||
* @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}]. | ||
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}] | ||
* @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}]. | ||
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}] | ||
* @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10} | ||
@@ -98,3 +100,3 @@ * | ||
*/ | ||
queryMembers(filterConditions: UserFilters<UserType>, sort?: UserSort<UserType>, options?: QueryMembersOptions): Promise<ChannelMemberAPIResponse<UserType>>; | ||
queryMembers(filterConditions: UserFilters<UserType>, sort?: MemberSort<UserType>, options?: QueryMembersOptions): Promise<ChannelMemberAPIResponse<UserType>>; | ||
/** | ||
@@ -101,0 +103,0 @@ * sendReaction - Send a reaction about a message |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
import { TokenManager } from './token_manager'; | ||
import { APIResponse, AppSettings, AppSettingsAPIResponse, BaseDeviceFields, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BlockList, BlockListResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CustomPermissionOptions, DeleteCommandResponse, Device, EndpointName, Event, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, FlagMessageResponse, FlagUserResponse, GetChannelTypeResponse, GetCommandResponse, GetRateLimitsResponse, ListChannelResponse, ListCommandsResponse, LiteralStringForUnion, Logger, MarkAllReadOptions, MessageFilters, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OwnUserResponse, PartialMessageUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, ReactionResponse, SearchOptions, SearchAPIResponse, SendFileAPIResponse, StreamChatOptions, TestPushDataInput, TestSQSDataInput, TokenOrProvider, UnBanUserOptions, UnknownType, UpdateChannelOptions, UpdateChannelResponse, UpdateCommandOptions, UpdateCommandResponse, UpdatedMessage, UpdateMessageAPIResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, SegmentData, Segment, Campaign, CampaignData } from './types'; | ||
import { APIResponse, AppSettings, AppSettingsAPIResponse, BaseDeviceFields, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BlockList, BlockListResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CustomPermissionOptions, DeleteCommandResponse, Device, EndpointName, Event, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, FlagMessageResponse, FlagUserResponse, GetChannelTypeResponse, GetCommandResponse, GetRateLimitsResponse, ListChannelResponse, ListCommandsResponse, LiteralStringForUnion, Logger, MarkChannelsReadOptions, MessageFilters, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OwnUserResponse, PartialMessageUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PushProvider, ReactionResponse, SearchOptions, SearchAPIResponse, SendFileAPIResponse, StreamChatOptions, TestPushDataInput, TestSQSDataInput, TokenOrProvider, UnBanUserOptions, UnknownType, UpdateChannelOptions, UpdateChannelResponse, UpdateCommandOptions, UpdateCommandResponse, UpdatedMessage, UpdateMessageAPIResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, SegmentData, Segment, Campaign, CampaignData, OGAttachment, TaskStatus, DeleteUserOptions, TaskResponse } from './types'; | ||
export declare class StreamChat<AttachmentType extends UnknownType = UnknownType, ChannelType extends UnknownType = UnknownType, CommandType extends string = LiteralStringForUnion, EventType extends UnknownType = UnknownType, MessageType extends UnknownType = UnknownType, ReactionType extends UnknownType = UnknownType, UserType extends UnknownType = UnknownType> { | ||
@@ -212,2 +212,3 @@ private static _instance?; | ||
firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error | ||
huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error | ||
skipDevices: true, // skip config/device checks and sending to real devices | ||
@@ -220,9 +221,7 @@ } | ||
* | ||
* @param {string} userID User ID. If user has no devices, it will error | ||
* @param {TestPushDataInput} [data] Overrides for push templates/message used | ||
* @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed | ||
* IE: { | ||
messageID: 'id-of-message',//will error if message does not exist | ||
apnTemplate: '{}', //if app doesn't have apn configured it will error | ||
firebaseTemplate: '{}', //if app doesn't have firebase configured it will error | ||
firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error | ||
sqs_key: 'auth_key', | ||
sqs_secret: 'auth_secret', | ||
sqs_url: 'url_to_queue', | ||
} | ||
@@ -443,3 +442,3 @@ */ | ||
* @param {string} device.id device id | ||
* @param {string} device.push_provider the push provider (apn or firebase) | ||
* @param {string} device.push_provider the push provider | ||
* | ||
@@ -452,7 +451,7 @@ */ | ||
* @param {string} id the device id | ||
* @param {'apn' | 'firebase'} push_provider the push provider (apn or firebase) | ||
* @param {PushProvider} push_provider the push provider | ||
* @param {string} [userID] the user id (defaults to current user) | ||
* | ||
*/ | ||
addDevice(id: string, push_provider: 'apn' | 'firebase', userID?: string): Promise<APIResponse>; | ||
addDevice(id: string, push_provider: PushProvider, userID?: string): Promise<APIResponse>; | ||
/** | ||
@@ -727,2 +726,4 @@ * getDevices - Returns the devices associated with a current user | ||
/** | ||
* @deprecated use markChannelsRead instead | ||
* | ||
* markAllRead - marks all channels for this user as read | ||
@@ -733,3 +734,12 @@ * @param {MarkAllReadOptions<UserType>} [data] | ||
*/ | ||
markAllRead(data?: MarkAllReadOptions<UserType>): Promise<void>; | ||
markAllRead: (data?: MarkChannelsReadOptions<UserType>) => Promise<void>; | ||
/** | ||
* markChannelsRead - marks channels read - | ||
* it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read | ||
* | ||
* @param {MarkChannelsReadOptions <UserType>} [data] | ||
* | ||
* @return {Promise<APIResponse>} | ||
*/ | ||
markChannelsRead(data?: MarkChannelsReadOptions<UserType>): Promise<void>; | ||
createCommand(data: CreateCommandOptions<CommandType>): Promise<CreateCommandResponse<CommandType>>; | ||
@@ -839,2 +849,3 @@ getCommand(name: string): Promise<GetCommandResponse<CommandType>>; | ||
* @param {string | { id: string }} [userId] | ||
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message | ||
* | ||
@@ -845,2 +856,4 @@ * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message | ||
id: string; | ||
}, options?: { | ||
skip_enrich_url?: boolean; | ||
}): Promise<UpdateMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>; | ||
@@ -856,2 +869,4 @@ /** | ||
* | ||
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message | ||
* | ||
* @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message | ||
@@ -861,2 +876,4 @@ */ | ||
id: string; | ||
}, options?: { | ||
skip_enrich_url?: boolean; | ||
}): Promise<UpdateMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>; | ||
@@ -1111,3 +1128,40 @@ deleteMessage(messageID: string, hardDelete?: boolean): Promise<APIResponse & { | ||
}): Promise<Campaign>; | ||
/** | ||
* enrichURL - Get OpenGraph data of the given link | ||
* | ||
* @param {string} url link | ||
* @return {OGAttachment} OG Attachment | ||
*/ | ||
enrichURL(url: string): Promise<APIResponse & OGAttachment>; | ||
/** | ||
* getTask - Gets status of a long running task | ||
* | ||
* @param {string} id Task ID | ||
* | ||
* @return {TaskStatus} The task status | ||
*/ | ||
getTask(id: string): Promise<APIResponse & TaskStatus>; | ||
/** | ||
* deleteChannels - Deletes a list of channel | ||
* | ||
* @param {string[]} cids Channel CIDs | ||
* @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not | ||
* | ||
* @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well | ||
*/ | ||
deleteChannels(cids: string[], options?: { | ||
hard_delete?: boolean; | ||
}): Promise<APIResponse & { | ||
result: Record<string, string>; | ||
} & Partial<TaskResponse>>; | ||
/** | ||
* deleteUsers - Batch Delete Users | ||
* | ||
* @param {string[]} user_ids which users to delete | ||
* @param {DeleteUserOptions} options Configuration how to delete users | ||
* | ||
* @return {APIResponse} A task ID | ||
*/ | ||
deleteUsers(user_ids: string[], options: DeleteUserOptions): Promise<APIResponse & TaskResponse>; | ||
} | ||
//# sourceMappingURL=client.d.ts.map |
@@ -139,3 +139,2 @@ /// <reference types="node" /> | ||
* _listenForConnectionChanges - Adds an event listener for the browser going online or offline | ||
* | ||
*/ | ||
@@ -142,0 +141,0 @@ _listenForConnectionChanges: () => void; |
@@ -56,2 +56,3 @@ import { AxiosRequestConfig } from 'axios'; | ||
}>; | ||
async_url_enrich_enabled?: boolean; | ||
auto_translation_enabled?: boolean; | ||
@@ -77,4 +78,6 @@ before_message_send_hook_url?: string; | ||
firebase?: FirebaseConfig; | ||
huawei?: HuaweiConfig; | ||
}; | ||
revoke_tokens_issued_before?: string | null; | ||
search_backend?: 'disabled' | 'elasticsearch' | 'postgres'; | ||
sqs_key?: string; | ||
@@ -85,3 +88,4 @@ sqs_secret?: string; | ||
suspended_explanation?: string; | ||
user_search_disallowed_roles?: string[]; | ||
user_search_disallowed_roles?: string[] | null; | ||
webhook_events?: Array<string>; | ||
webhook_url?: string; | ||
@@ -144,2 +148,3 @@ }; | ||
deleted_at?: string; | ||
hidden?: boolean; | ||
invites?: string[]; | ||
@@ -191,2 +196,3 @@ last_message_at?: string; | ||
rendered_firebase_template?: string; | ||
rendered_huawei_template?: string; | ||
}; | ||
@@ -486,3 +492,3 @@ export declare type CheckSQSResponse = APIResponse & { | ||
members?: PaginationOptions; | ||
messages?: PaginationOptions; | ||
messages?: MessagePaginationOptions; | ||
presence?: boolean; | ||
@@ -530,5 +536,5 @@ state?: boolean; | ||
action: string; | ||
condition: object; | ||
id: string; | ||
name: string; | ||
condition?: string; | ||
description?: string; | ||
@@ -553,5 +559,8 @@ owner?: boolean; | ||
}; | ||
export declare type MarkAllReadOptions<UserType = UnknownType> = { | ||
/** @deprecated use MarkChannelsReadOptions instead */ | ||
export declare type MarkAllReadOptions<UserType = UnknownType> = MarkChannelsReadOptions<UserType>; | ||
export declare type MarkChannelsReadOptions<UserType = UnknownType> = { | ||
client_id?: string; | ||
connection_id?: string; | ||
read_by_channel?: Record<string, string>; | ||
user?: UserResponse<UserType>; | ||
@@ -590,2 +599,6 @@ user_id?: string; | ||
}; | ||
export declare type MessagePaginationOptions = PaginationOptions & { | ||
created_at_around?: string | Date; | ||
id_around?: string; | ||
}; | ||
export declare type QueryMembersOptions = { | ||
@@ -811,2 +824,3 @@ limit?: number; | ||
export declare type UserSort<UserType = UnknownType> = Sort<UserResponse<UserType>> | Array<Sort<UserResponse<UserType>>>; | ||
export declare type MemberSort<UserType = UnknownType> = Sort<Pick<UserResponse<UserType>, 'id' | 'created_at' | 'name'>> | Array<Sort<Pick<UserResponse<UserType>, 'id' | 'created_at' | 'name'>>>; | ||
export declare type SearchMessageSortBase<MessageType = UnknownType> = Sort<MessageType> & { | ||
@@ -862,2 +876,3 @@ attachments?: AscDesc; | ||
}; | ||
async_url_enrich_enabled?: boolean; | ||
auto_translation_enabled?: boolean; | ||
@@ -876,2 +891,7 @@ custom_action_handler_url?: string; | ||
grants?: Record<string, string[]>; | ||
huawei_config?: { | ||
id: string; | ||
secret: string; | ||
data_template?: string; | ||
}; | ||
image_moderation_enabled?: boolean; | ||
@@ -887,2 +907,3 @@ image_upload_config?: FileUploadConfig; | ||
sqs_url?: string; | ||
webhook_events?: Array<string> | null; | ||
webhook_url?: string; | ||
@@ -910,2 +931,14 @@ }; | ||
}; | ||
export declare type OGAttachment = { | ||
og_scrape_url: string; | ||
asset_url?: string; | ||
author_link?: string; | ||
author_name?: string; | ||
image_url?: string; | ||
text?: string; | ||
thumb_url?: string; | ||
title?: string; | ||
title_link?: string; | ||
type?: string | 'video' | 'audio' | 'image'; | ||
}; | ||
export declare type BlockList = { | ||
@@ -994,2 +1027,3 @@ name: string; | ||
}; | ||
export declare type PushProvider = 'apn' | 'firebase' | 'huawei'; | ||
export declare type CommandVariants<CommandType extends string = LiteralStringForUnion> = 'all' | 'ban' | 'flag' | 'fun_set' | 'giphy' | 'imgur' | 'moderation_set' | 'mute' | 'unban' | 'unmute' | CommandType; | ||
@@ -1017,3 +1051,3 @@ export declare type Configs<CommandType extends string = LiteralStringForUnion> = { | ||
id: string; | ||
push_provider: 'apn' | 'firebase'; | ||
push_provider: PushProvider; | ||
}; | ||
@@ -1034,2 +1068,3 @@ export declare type DeviceFields = BaseDeviceFields & { | ||
clear_deleted_message_text?: boolean; | ||
include_truncated_messages?: boolean; | ||
}; | ||
@@ -1042,6 +1077,6 @@ export declare type Field = { | ||
export declare type FileUploadConfig = { | ||
allowed_file_extensions?: string[]; | ||
allowed_mime_types?: string[]; | ||
blocked_file_extensions?: string[]; | ||
blocked_mime_types?: string[]; | ||
allowed_file_extensions?: string[] | null; | ||
allowed_mime_types?: string[] | null; | ||
blocked_file_extensions?: string[] | null; | ||
blocked_mime_types?: string[] | null; | ||
}; | ||
@@ -1054,2 +1089,6 @@ export declare type FirebaseConfig = { | ||
}; | ||
export declare type HuaweiConfig = { | ||
data_template?: string; | ||
enabled?: boolean; | ||
}; | ||
export declare type LiteralStringForUnion = string & {}; | ||
@@ -1096,2 +1135,3 @@ export declare type Logger = (logLevel: 'info' | 'error' | 'warn', message: string, extraData?: Record<string, unknown>) => void; | ||
action?: string; | ||
condition?: object; | ||
custom?: boolean; | ||
@@ -1151,2 +1191,3 @@ description?: string; | ||
firebaseTemplate?: string; | ||
huaweiDataTemplate?: string; | ||
messageID?: string; | ||
@@ -1175,2 +1216,14 @@ skipDevices?: boolean; | ||
}; | ||
export declare type TaskResponse = { | ||
task_id: string; | ||
}; | ||
export declare type DeleteChannelsResponse = { | ||
result: Record<string, string>; | ||
} & Partial<TaskResponse>; | ||
export declare type DeleteType = 'soft' | 'hard'; | ||
export declare type DeleteUserOptions = { | ||
user: DeleteType; | ||
conversations?: DeleteType; | ||
messages?: DeleteType; | ||
}; | ||
export declare type SegmentData = { | ||
@@ -1217,2 +1270,13 @@ description: string; | ||
} & CampaignData & CampaignStatus; | ||
export declare type TaskStatus = { | ||
created_at: string; | ||
status: string; | ||
task_id: string; | ||
updated_at: string; | ||
error?: { | ||
description: string; | ||
type: string; | ||
}; | ||
result?: UnknownType; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "stream-chat", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"description": "JS SDK for the Stream Chat API", | ||
@@ -5,0 +5,0 @@ "author": "GetStream", |
@@ -27,2 +27,3 @@ import { ChannelState } from './channel_state'; | ||
MarkReadOptions, | ||
MemberSort, | ||
Message, | ||
@@ -47,3 +48,2 @@ MessageFilters, | ||
UserResponse, | ||
UserSort, | ||
SearchMessageSortBase, | ||
@@ -204,3 +204,4 @@ } from './types'; | ||
* @param {Message<AttachmentType, MessageType, UserType>} message The Message object | ||
* @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications | ||
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message | ||
* @param {boolean} [options.skip_push] Skip sending push notifications | ||
* | ||
@@ -211,3 +212,3 @@ * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response | ||
message: Message<AttachmentType, MessageType, UserType>, | ||
options?: { skip_push?: boolean }, | ||
options?: { skip_enrich_url?: boolean; skip_push?: boolean }, | ||
) { | ||
@@ -389,4 +390,4 @@ const sendMessageResponse = await this.getClient().post< | ||
* @param {UserFilters<UserType>} filterConditions object MongoDB style filters | ||
* @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}]. | ||
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}] | ||
* @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}]. | ||
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}] | ||
* @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10} | ||
@@ -398,3 +399,3 @@ * | ||
filterConditions: UserFilters<UserType>, | ||
sort: UserSort<UserType> = [], | ||
sort: MemberSort<UserType> = [], | ||
options: QueryMembersOptions = {}, | ||
@@ -1141,2 +1142,3 @@ ) { | ||
return false; | ||
if (message.type === 'system') return false; | ||
@@ -1143,0 +1145,0 @@ if (this.muteStatus().muted) return false; |
@@ -704,10 +704,7 @@ import WebSocket from 'isomorphic-ws'; | ||
* _listenForConnectionChanges - Adds an event listener for the browser going online or offline | ||
* | ||
*/ | ||
_listenForConnectionChanges = () => { | ||
if ( | ||
typeof window !== 'undefined' && | ||
window != null && | ||
window.addEventListener != null | ||
) { | ||
// (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment, | ||
// and thus (window === undefined) will result in ReferenceError. | ||
if (typeof window !== 'undefined' && window?.addEventListener) { | ||
window.addEventListener('offline', this.onlineStatusChanged); | ||
@@ -719,7 +716,5 @@ window.addEventListener('online', this.onlineStatusChanged); | ||
_removeConnectionListeners = () => { | ||
if ( | ||
typeof window !== 'undefined' && | ||
window != null && | ||
window.addEventListener != null | ||
) { | ||
// (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment, | ||
// and thus (window === undefined) will result in ReferenceError. | ||
if (typeof window !== 'undefined' && window?.removeEventListener) { | ||
window.removeEventListener('offline', this.onlineStatusChanged); | ||
@@ -726,0 +721,0 @@ window.removeEventListener('online', this.onlineStatusChanged); |
105
src/types.ts
@@ -82,2 +82,3 @@ import { AxiosRequestConfig } from 'axios'; | ||
>; | ||
async_url_enrich_enabled?: boolean; | ||
auto_translation_enabled?: boolean; | ||
@@ -103,4 +104,6 @@ before_message_send_hook_url?: string; | ||
firebase?: FirebaseConfig; | ||
huawei?: HuaweiConfig; | ||
}; | ||
revoke_tokens_issued_before?: string | null; | ||
search_backend?: 'disabled' | 'elasticsearch' | 'postgres'; | ||
sqs_key?: string; | ||
@@ -111,3 +114,4 @@ sqs_secret?: string; | ||
suspended_explanation?: string; | ||
user_search_disallowed_roles?: string[]; | ||
user_search_disallowed_roles?: string[] | null; | ||
webhook_events?: Array<string>; | ||
webhook_url?: string; | ||
@@ -197,2 +201,3 @@ }; | ||
deleted_at?: string; | ||
hidden?: boolean; | ||
invites?: string[]; | ||
@@ -269,2 +274,3 @@ last_message_at?: string; | ||
rendered_firebase_template?: string; | ||
rendered_huawei_template?: string; | ||
}; | ||
@@ -832,3 +838,3 @@ | ||
members?: PaginationOptions; | ||
messages?: PaginationOptions; | ||
messages?: MessagePaginationOptions; | ||
presence?: boolean; | ||
@@ -880,5 +886,5 @@ state?: boolean; | ||
action: string; | ||
condition: object; | ||
id: string; | ||
name: string; | ||
condition?: string; | ||
description?: string; | ||
@@ -920,5 +926,11 @@ owner?: boolean; | ||
export type MarkAllReadOptions<UserType = UnknownType> = { | ||
/** @deprecated use MarkChannelsReadOptions instead */ | ||
export type MarkAllReadOptions< | ||
UserType = UnknownType | ||
> = MarkChannelsReadOptions<UserType>; | ||
export type MarkChannelsReadOptions<UserType = UnknownType> = { | ||
client_id?: string; | ||
connection_id?: string; | ||
read_by_channel?: Record<string, string>; | ||
user?: UserResponse<UserType>; | ||
@@ -961,2 +973,7 @@ user_id?: string; | ||
export type MessagePaginationOptions = PaginationOptions & { | ||
created_at_around?: string | Date; | ||
id_around?: string; | ||
}; | ||
export type QueryMembersOptions = { | ||
@@ -1454,2 +1471,6 @@ limit?: number; | ||
export type MemberSort<UserType = UnknownType> = | ||
| Sort<Pick<UserResponse<UserType>, 'id' | 'created_at' | 'name'>> | ||
| Array<Sort<Pick<UserResponse<UserType>, 'id' | 'created_at' | 'name'>>>; | ||
export type SearchMessageSortBase<MessageType = UnknownType> = Sort<MessageType> & { | ||
@@ -1522,2 +1543,3 @@ attachments?: AscDesc; | ||
}; | ||
async_url_enrich_enabled?: boolean; | ||
auto_translation_enabled?: boolean; | ||
@@ -1537,2 +1559,7 @@ custom_action_handler_url?: string; | ||
grants?: Record<string, string[]>; | ||
huawei_config?: { | ||
id: string; | ||
secret: string; | ||
data_template?: string; | ||
}; | ||
image_moderation_enabled?: boolean; | ||
@@ -1548,2 +1575,3 @@ image_upload_config?: FileUploadConfig; | ||
sqs_url?: string; | ||
webhook_events?: Array<string> | null; | ||
webhook_url?: string; | ||
@@ -1573,2 +1601,15 @@ }; | ||
export type OGAttachment = { | ||
og_scrape_url: string; | ||
asset_url?: string; // og:video | og:audio | ||
author_link?: string; // og:site | ||
author_name?: string; // og:site_name | ||
image_url?: string; // og:image | ||
text?: string; // og:description | ||
thumb_url?: string; // og:image | ||
title?: string; // og:title | ||
title_link?: string; // og:url | ||
type?: string | 'video' | 'audio' | 'image'; | ||
}; | ||
export type BlockList = { | ||
@@ -1670,2 +1711,4 @@ name: string; | ||
export type PushProvider = 'apn' | 'firebase' | 'huawei'; | ||
export type CommandVariants<CommandType extends string = LiteralStringForUnion> = | ||
@@ -1713,3 +1756,3 @@ | 'all' | ||
id: string; | ||
push_provider: 'apn' | 'firebase'; | ||
push_provider: PushProvider; | ||
}; | ||
@@ -1818,2 +1861,3 @@ | ||
clear_deleted_message_text?: boolean; | ||
include_truncated_messages?: boolean; | ||
}; | ||
@@ -1828,6 +1872,6 @@ | ||
export type FileUploadConfig = { | ||
allowed_file_extensions?: string[]; | ||
allowed_mime_types?: string[]; | ||
blocked_file_extensions?: string[]; | ||
blocked_mime_types?: string[]; | ||
allowed_file_extensions?: string[] | null; | ||
allowed_mime_types?: string[] | null; | ||
blocked_file_extensions?: string[] | null; | ||
blocked_mime_types?: string[] | null; | ||
}; | ||
@@ -1842,2 +1886,7 @@ | ||
export type HuaweiConfig = { | ||
data_template?: string; | ||
enabled?: boolean; | ||
}; | ||
export type LiteralStringForUnion = string & {}; | ||
@@ -1915,2 +1964,3 @@ | ||
action?: string; | ||
condition?: object; | ||
custom?: boolean; | ||
@@ -2013,2 +2063,3 @@ description?: string; | ||
firebaseTemplate?: string; | ||
huaweiDataTemplate?: string; | ||
messageID?: string; | ||
@@ -2116,2 +2167,26 @@ skipDevices?: boolean; | ||
export type TaskResponse = { | ||
task_id: string; | ||
}; | ||
export type DeleteChannelsResponse = { | ||
result: Record<string, string>; | ||
} & Partial<TaskResponse>; | ||
export type DeleteType = 'soft' | 'hard'; | ||
/* | ||
DeleteUserOptions specifies a collection of one or more `user_ids` to be deleted. | ||
`user` soft|hard determines if the user needs to be hard- or soft-deleted, where hard-delete | ||
implies that all related objects (messages, flags, etc) will be hard-deleted as well. | ||
`conversations` soft|hard will delete any 1to1 channels that the user was a member of. | ||
`messages` soft-hard will delete any messages that the user has sent. | ||
*/ | ||
export type DeleteUserOptions = { | ||
user: DeleteType; | ||
conversations?: DeleteType; | ||
messages?: DeleteType; | ||
}; | ||
export type SegmentData = { | ||
@@ -2171,1 +2246,13 @@ description: string; | ||
CampaignStatus; | ||
export type TaskStatus = { | ||
created_at: string; | ||
status: string; | ||
task_id: string; | ||
updated_at: string; | ||
error?: { | ||
description: string; | ||
type: string; | ||
}; | ||
result?: UnknownType; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3878422
44012