Skip to content

Commit

Permalink
Merge branch 'master' into fix/initial-pagination-state-values
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCupela authored Jan 28, 2025
2 parents 4933a21 + c9861fd commit 0612d79
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 1 deletion.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
2 changes: 2 additions & 0 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -97,6 +98,7 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
lastTypingEvent: Date | null;
isTyping: boolean;
disconnected: boolean;
push_preferences?: PushPreference;

/**
* constructor - Create a channel
Expand Down
14 changes: 14 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ import {
PollVote,
PollVoteData,
PollVotesAPIResponse,
PushPreference,
PushProvider,
PushProviderConfig,
PushProviderID,
Expand Down Expand Up @@ -201,6 +202,7 @@ import {
UpdatePollAPIResponse,
UpdatePollOptionAPIResponse,
UpdateSegmentData,
UpsertPushPreferencesResponse,
UserCustomEvent,
UserFilters,
UserOptions,
Expand Down Expand Up @@ -1666,6 +1668,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
c.data = channelState.channel;
c.offlineMode = offlineMode;
c.initialized = !offlineMode;
c.push_preferences = channelState.push_preferences;

let updatedMessagesSet;
if (skipInitialization === undefined) {
Expand Down Expand Up @@ -1805,6 +1808,17 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
return await this.post<GetUnreadCountBatchAPIResponse>(this.baseURL + '/unread_batch', { user_ids: userIDs });
}

/**
* setPushPreferences - Applies the list of push preferences.
*
* @param {PushPreference[]} A list of push preferences.
*
* @return {<UpsertPushPreferencesResponse>}
*/
async setPushPreferences(preferences: PushPreference[]) {
return await this.post<UpsertPushPreferencesResponse>(this.baseURL + '/push_preferences', { preferences });
}

/**
* removeDevice - Removes the device with the given id. Clientside users can only delete their own devices
*
Expand Down
31 changes: 31 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export type ChannelAPIResponse<StreamChatGenerics extends ExtendableGenerics = D
hidden?: boolean;
membership?: ChannelMemberResponse<StreamChatGenerics> | null;
pending_messages?: PendingMessageResponse<StreamChatGenerics>[];
push_preferences?: PushPreference;
read?: ReadResponse<StreamChatGenerics>[];
threads?: ThreadResponse[];
watcher_count?: number;
Expand Down Expand Up @@ -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<string, Record<string, ChannelPushPreference>>;
userPreferences: Record<string, PushPreference>; // Mapping of user -> channel id -> push preferences
};

export type GetUnreadCountBatchAPIResponse = APIResponse & {
counts_by_user: { [userId: string]: GetUnreadCountAPIResponse };
};
Expand Down Expand Up @@ -773,6 +795,7 @@ export type OwnUserBase<StreamChatGenerics extends ExtendableGenerics = DefaultG
unread_threads: number;
invisible?: boolean;
privacy_settings?: PrivacySettings;
push_preferences?: PushPreference;
roles?: string[];
};

Expand Down Expand Up @@ -3543,6 +3566,14 @@ export type ReviewQueueFilters = QueryFilters<
has_text?: boolean;
} & {
has_video?: boolean;
} & {
teams?:
| RequireOnlyOne<{
$contains?: PrimitiveFilter<string>;
$eq?: PrimitiveFilter<string>;
$in?: PrimitiveFilter<string>;
}>
| PrimitiveFilter<string>;
}
>;

Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 0612d79

Please sign in to comment.