From 9ad65d3ee6e275dc3ac22be1c2f87b082cf58de4 Mon Sep 17 00:00:00 2001 From: Vishal Narkhede Date: Mon, 29 Apr 2024 22:03:14 +0200 Subject: [PATCH 01/12] feat: sort option on getReplies endpoint (#1284) --- src/channel.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/channel.ts b/src/channel.ts index ca9cffab3..f1370de81 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -55,6 +55,7 @@ import { QueryChannelAPIResponse, PollVoteData, SendMessageOptions, + AscDesc, } from './types'; import { Role } from './permissions'; @@ -823,10 +824,13 @@ export class Channel; user_id?: string }, + sort?: { created_at: AscDesc }[], ) { + const normalizedSort = sort ? normalizeQuerySort(sort) : undefined; const data = await this.getClient().get>( this.getClient().baseURL + `/messages/${parent_id}/replies`, { + sort: normalizedSort, ...options, }, ); From 267f5a40a89beec96a982a794bf9c6644623319e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:04:39 +0200 Subject: [PATCH 02/12] chore: release v8.28.0 (#1285) Co-authored-by: github-actions --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b0354f49..2f772d250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 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.28.0](https://github.com/GetStream/stream-chat-js/compare/v8.27.0...v8.28.0) (2024-04-29) + + +### Features + +* add reactiongroups in `MessageResponse` ([#1278](https://github.com/GetStream/stream-chat-js/issues/1278)) ([0d5f87f](https://github.com/GetStream/stream-chat-js/commit/0d5f87fe29dc946044dedd1ad6df0e8780a04e8f)) +* sort option on getReplies endpoint ([#1284](https://github.com/GetStream/stream-chat-js/issues/1284)) ([9ad65d3](https://github.com/GetStream/stream-chat-js/commit/9ad65d3ee6e275dc3ac22be1c2f87b082cf58de4)) + ## [8.27.0](https://github.com/GetStream/stream-chat-js/compare/v8.26.0...v8.27.0) (2024-04-24) diff --git a/package.json b/package.json index 7cf15afa4..802ebe12c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.27.0", + "version": "8.28.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", From 7183154a663701c24d9c573832288d66e9214565 Mon Sep 17 00:00:00 2001 From: Matvei Andrienko Date: Tue, 30 Apr 2024 14:58:08 +0200 Subject: [PATCH 03/12] feat: add reaction groups fallback (#1286) --- .lintstagedrc.json | 2 +- src/types.ts | 2 +- src/utils.ts | 31 +++++++++++++++++++++++++++++++ test/unit/utils.js | 41 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 73 insertions(+), 3 deletions(-) diff --git a/.lintstagedrc.json b/.lintstagedrc.json index a86b3ff7f..8bdbf1e89 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,4 +1,4 @@ { "{**/*.{js,ts,md,css,scss,json}, .eslintrc.json, .prettierrc, .babelrc}": "prettier --list-different", - "**/*.{js,md,ts}": "eslint --max-warnings 0" + "**/*.{js,md,ts}, !test": "eslint --max-warnings 0" } diff --git a/src/types.ts b/src/types.ts index 2db5673b7..45d789687 100644 --- a/src/types.ts +++ b/src/types.ts @@ -627,7 +627,6 @@ export type MessageResponse< export type MessageResponseBase< StreamChatGenerics extends ExtendableGenerics = DefaultGenerics > = MessageBase & { - reaction_groups: Record; type: MessageLabel; args?: string; before_message_send_failed?: boolean; @@ -651,6 +650,7 @@ export type MessageResponseBase< pinned_by?: UserResponse | null; poll?: PollResponse; reaction_counts?: { [key: string]: number } | null; + reaction_groups?: { [key: string]: ReactionGroupResponse } | null; reaction_scores?: { [key: string]: number } | null; reply_count?: number; shadowed?: boolean; diff --git a/src/utils.ts b/src/utils.ts index 9d20e49e6..cb0609bc0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -8,6 +8,7 @@ import { UserResponse, MessageResponse, FormatMessageResponse, + ReactionGroupResponse, } from './types'; import { AxiosRequestConfig } from 'axios'; @@ -295,6 +296,11 @@ export function formatMessage { } }); }); + +describe('reaction groups fallback', () => { + it('uses groups if present', () => { + const date = '2024-04-30T11:03:39.217974Z'; + const groups = { + love: { + count: 1, + sum_scores: 1, + first_reaction_at: date, + last_reaction_at: date, + }, + }; + + const message = formatMessage({ reaction_groups: groups }); + expect(message.reaction_groups).to.be.equal(groups); + }); + + it('falls back to counts + scores', () => { + const counts = { love: 1, sad: 1 }; + const scores = { love: 1, sad: 2 }; + + const message = formatMessage({ + reaction_groups: null, + reaction_counts: counts, + reaction_scores: scores, + }); + + expect(message.reaction_groups).to.deep.equal({ + love: { + count: 1, + sum_scores: 1, + }, + sad: { + count: 1, + sum_scores: 2, + }, + }); + }); +}); From 65174a55fd30eec445033cb9af745e6d4164f23d Mon Sep 17 00:00:00 2001 From: Matvei Andrienko Date: Tue, 30 Apr 2024 16:16:05 +0200 Subject: [PATCH 04/12] fix: fix filter type for query reactions (#1287) --- src/types.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/types.ts b/src/types.ts index 45d789687..f25e94b31 100644 --- a/src/types.ts +++ b/src/types.ts @@ -297,6 +297,7 @@ export type QueryReactionsOptions = Pager; export type QueryReactionsAPIResponse = APIResponse & { reactions: ReactionResponse[]; + next?: string; }; export type QueryChannelsAPIResponse = APIResponse & { @@ -1381,11 +1382,7 @@ export type ReactionFilters, '$eq' | '$gt' | '$lt' | '$gte' | '$lte'>> | PrimitiveFilter; - } & { - [Key in keyof Omit, 'user_id' | 'type' | 'created_at'>]: RequireOnlyOne< - QueryFilter[Key]> - >; - } + } >; export type ChannelFilters = QueryFilters< From eb60d7b128f1a0849ac58cc1c4084b913825c3c6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 16:33:37 +0200 Subject: [PATCH 05/12] chore: release v8.29.0 (#1289) Co-authored-by: github-actions --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f772d250..ed4a60d95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ 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.29.0](https://github.com/GetStream/stream-chat-js/compare/v8.28.0...v8.29.0) (2024-04-30) + + +### Features + +* add reaction groups fallback ([#1286](https://github.com/GetStream/stream-chat-js/issues/1286)) ([7183154](https://github.com/GetStream/stream-chat-js/commit/7183154a663701c24d9c573832288d66e9214565)) + + +### Bug Fixes + +* fix filter type for query reactions ([#1287](https://github.com/GetStream/stream-chat-js/issues/1287)) ([65174a5](https://github.com/GetStream/stream-chat-js/commit/65174a55fd30eec445033cb9af745e6d4164f23d)) + ## [8.28.0](https://github.com/GetStream/stream-chat-js/compare/v8.27.0...v8.28.0) (2024-04-29) diff --git a/package.json b/package.json index 802ebe12c..10da08976 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.28.0", + "version": "8.29.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", From dcd7621594accdadc255b0eb091616d1a83cb602 Mon Sep 17 00:00:00 2001 From: Vishal Narkhede Date: Tue, 30 Apr 2024 16:38:19 +0200 Subject: [PATCH 06/12] feat: "include_soft_deleted_channels" option to export channels api (#1288) --- src/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types.ts b/src/types.ts index f25e94b31..6d14135bc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2296,6 +2296,7 @@ export type ExportChannelRequest = { export type ExportChannelOptions = { clear_deleted_message_text?: boolean; export_users?: boolean; + include_soft_deleted_channels?: boolean; include_truncated_messages?: boolean; version?: string; }; From f16552b1e50606d47485b7a77925a1340e046626 Mon Sep 17 00:00:00 2001 From: Kanat Kiialbaev Date: Tue, 30 Apr 2024 10:51:22 -0400 Subject: [PATCH 07/12] feat: support privacy settings (#1283) Co-authored-by: Vishal Narkhede --- src/channel.ts | 11 +++++++++-- src/types.ts | 11 +++++++++++ src/utils.ts | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/channel.ts b/src/channel.ts index f1370de81..5ffb0bcb9 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -656,7 +656,7 @@ export class Channel); } + _isTypingIndicatorsEnabled(): boolean { + if (!this.getConfig()?.typing_events) { + return false; + } + return this.getClient().user?.privacy_settings?.typing_indicators?.enabled ?? true; + } + /** * lastMessage - return the last message, takes into account that last few messages might not be perfectly sorted * diff --git a/src/types.ts b/src/types.ts index 6d14135bc..9b1318bcf 100644 --- a/src/types.ts +++ b/src/types.ts @@ -702,6 +702,7 @@ export type OwnUserBase Date: Wed, 1 May 2024 12:02:31 +0200 Subject: [PATCH 08/12] chore: release v8.30.0 (#1290) Co-authored-by: github-actions --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed4a60d95..c6a291295 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 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.30.0](https://github.com/GetStream/stream-chat-js/compare/v8.29.0...v8.30.0) (2024-04-30) + + +### Features + +* "include_soft_deleted_channels" option to export channels api ([#1288](https://github.com/GetStream/stream-chat-js/issues/1288)) ([dcd7621](https://github.com/GetStream/stream-chat-js/commit/dcd7621594accdadc255b0eb091616d1a83cb602)) +* support privacy settings ([#1283](https://github.com/GetStream/stream-chat-js/issues/1283)) ([f16552b](https://github.com/GetStream/stream-chat-js/commit/f16552b1e50606d47485b7a77925a1340e046626)) + ## [8.29.0](https://github.com/GetStream/stream-chat-js/compare/v8.28.0...v8.29.0) (2024-04-30) diff --git a/package.json b/package.json index 10da08976..8eb805ac3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.29.0", + "version": "8.30.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", From 78fae3d7364150b6b3a7640b4f9b37204702a161 Mon Sep 17 00:00:00 2001 From: Vishal Narkhede Date: Wed, 1 May 2024 23:54:57 +0200 Subject: [PATCH 09/12] feat: member_limit option on queryThreads and getThread endpoint (#1291) --- src/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types.ts b/src/types.ts index 9b1318bcf..72f73e593 100644 --- a/src/types.ts +++ b/src/types.ts @@ -525,6 +525,7 @@ export type PartialThreadUpdate = { export type QueryThreadsOptions = { limit?: number; + member_limit?: number; next?: string; participant_limit?: number; reply_limit?: number; @@ -537,6 +538,7 @@ export type QueryThreadsAPIResponse Date: Thu, 2 May 2024 14:08:40 +0200 Subject: [PATCH 10/12] feat: ability to send poll with campaigns (#1292) --- src/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types.ts b/src/types.ts index 72f73e593..0a0f0f2ab 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2779,6 +2779,7 @@ export type CampaignData = { text: string; attachments?: Attachment[]; custom?: {}; + poll_id?: string; }; name?: string; segment_ids?: string[]; From d527ac6c96fe0809ede53b3ed665a085df5b45ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 14:10:54 +0200 Subject: [PATCH 11/12] chore: release v8.31.0 (#1293) Co-authored-by: github-actions --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6a291295..fc66fca2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 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.31.0](https://github.com/GetStream/stream-chat-js/compare/v8.30.0...v8.31.0) (2024-05-02) + + +### Features + +* ability to send poll with campaigns ([#1292](https://github.com/GetStream/stream-chat-js/issues/1292)) ([cace193](https://github.com/GetStream/stream-chat-js/commit/cace1935dc808c03a291a28a084898ee5531d087)) +* member_limit option on queryThreads and getThread endpoint ([#1291](https://github.com/GetStream/stream-chat-js/issues/1291)) ([78fae3d](https://github.com/GetStream/stream-chat-js/commit/78fae3d7364150b6b3a7640b4f9b37204702a161)) + ## [8.30.0](https://github.com/GetStream/stream-chat-js/compare/v8.29.0...v8.30.0) (2024-04-30) diff --git a/package.json b/package.json index 8eb805ac3..1b62b3fc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.30.0", + "version": "8.31.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", From 7e02ac8f9d23fd5ca00c9e2c91b5e18ddb04fffb Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Wed, 8 May 2024 11:48:41 +0200 Subject: [PATCH 12/12] feat: add support for notifications_muted in queryMembers (#1296) --- src/types.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/types.ts b/src/types.ts index 0a0f0f2ab..bd124c54d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1665,6 +1665,11 @@ export type UserFilters > | PrimitiveFilter['name']>; + notifications_muted?: + | RequireOnlyOne<{ + $eq?: PrimitiveFilter['notifications_muted']>; + }> + | boolean; teams?: | RequireOnlyOne<{ $contains?: PrimitiveFilter;