diff --git a/CHANGELOG.md b/CHANGELOG.md index da13881068..85a0365334 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [8.52.3](https://github.com/GetStream/stream-chat-js/compare/v8.52.2...v8.52.3) (2025-01-24) + + +### Bug Fixes + +* correct reviewqueue item filter: teams ([#1447](https://github.com/GetStream/stream-chat-js/issues/1447)) ([39a8411](https://github.com/GetStream/stream-chat-js/commit/39a84119672784243f02fd603dc57c122b0d111d)) + +### [8.52.2](https://github.com/GetStream/stream-chat-js/compare/v8.52.1...v8.52.2) (2025-01-24) + + +### Bug Fixes + +* add team to reviewqueue filter types ([#1445](https://github.com/GetStream/stream-chat-js/issues/1445)) ([dd1c6e5](https://github.com/GetStream/stream-chat-js/commit/dd1c6e5fa4a4eaa819c4aa38c649a7275117c7c3)) + ### [8.52.1](https://github.com/GetStream/stream-chat-js/compare/v8.52.0...v8.52.1) (2025-01-22) diff --git a/package.json b/package.json index 4815b6f3df..0fffdcd220 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.52.1", + "version": "8.52.3", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", diff --git a/src/channel.ts b/src/channel.ts index 03b3f32ae0..fef7158283 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -61,6 +61,7 @@ import { PartialUpdateMemberAPIResponse, AIState, MessageOptions, + PushPreference, } from './types'; import { Role } from './permissions'; import { DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE } from './constants'; @@ -97,6 +98,7 @@ export class Channel(this.baseURL + '/unread_batch', { user_ids: userIDs }); } + /** + * setPushPreferences - Applies the list of push preferences. + * + * @param {PushPreference[]} A list of push preferences. + * + * @return {} + */ + async setPushPreferences(preferences: PushPreference[]) { + return await this.post(this.baseURL + '/push_preferences', { preferences }); + } + /** * removeDevice - Removes the device with the given id. Clientside users can only delete their own devices * diff --git a/src/types.ts b/src/types.ts index 7aa087685f..d8980c0fda 100644 --- a/src/types.ts +++ b/src/types.ts @@ -323,6 +323,7 @@ export type ChannelAPIResponse | null; pending_messages?: PendingMessageResponse[]; + push_preferences?: PushPreference; read?: ReadResponse[]; threads?: ThreadResponse[]; watcher_count?: number; @@ -633,6 +634,27 @@ export type GetUnreadCountAPIResponse = APIResponse & { total_unread_threads_count: number; }; +export type ChatLevelPushPreference = 'all' | 'none' | 'mentions' | (string & {}); + +export type PushPreference = { + callLevel?: 'all' | 'none' | (string & {}); + chatLevel?: ChatLevelPushPreference; + disabledUntil?: string; // snooze till this time + removeDisable?: boolean; // Temporary flag for resetting disabledUntil +}; + +export type ChannelPushPreference = { + chatLevel?: ChatLevelPushPreference; // "all", "none", "mentions", or other custom strings + disabledUntil?: string; + removeDisable?: boolean; // Temporary flag for resetting disabledUntil +}; + +export type UpsertPushPreferencesResponse = APIResponse & { + // Mapping of user IDs to their push preferences + userChannelPreferences: Record>; + userPreferences: Record; // Mapping of user -> channel id -> push preferences +}; + export type GetUnreadCountBatchAPIResponse = APIResponse & { counts_by_user: { [userId: string]: GetUnreadCountAPIResponse }; }; @@ -773,6 +795,7 @@ export type OwnUserBase; + $eq?: PrimitiveFilter; + $in?: PrimitiveFilter; + }> + | PrimitiveFilter; } >; diff --git a/src/utils.ts b/src/utils.ts index acb78dad97..989f4e35a3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -92,6 +92,7 @@ export function isOwnUserBaseProperty(property: string) { invisible: true, privacy_settings: true, roles: true, + push_preferences: true, }; return ownUserBaseProperties[property as keyof OwnUserBase];