diff --git a/package.json b/package.json index d73a5be90..c6440dd1b 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "emoji-mart": "^5.4.0", "react": "^18.0.0 || ^17.0.0 || ^16.8.0", "react-dom": "^18.0.0 || ^17.0.0 || ^16.8.0", - "stream-chat": "^8.44.0" + "stream-chat": "^8.45.0" }, "peerDependenciesMeta": { "@breezystack/lamejs": { @@ -255,7 +255,7 @@ "react-dom": "^18.1.0", "react-test-renderer": "^18.1.0", "semantic-release": "^19.0.5", - "stream-chat": "^8.44.0", + "stream-chat": "^8.45.0", "ts-jest": "^29.1.4", "typescript": "^5.4.5" }, diff --git a/src/components/Message/__tests__/MessageSimple.test.js b/src/components/Message/__tests__/MessageSimple.test.js index f05f54146..ab27b69df 100644 --- a/src/components/Message/__tests__/MessageSimple.test.js +++ b/src/components/Message/__tests__/MessageSimple.test.js @@ -639,14 +639,26 @@ describe('', () => { expect(results).toHaveNoViolations(); }); - describe('bounced message', () => { - const bouncedMessageOptions = { - moderation_details: { - action: 'MESSAGE_RESPONSE_ACTION_BOUNCE', + describe.each([ + [ + 'v1', + { + moderation_details: { + action: 'MESSAGE_RESPONSE_ACTION_BOUNCE', + }, + type: 'error', }, - type: 'error', - }; - + ], + [ + 'v2', + { + moderation: { + action: 'bounce', + }, + type: 'error', + }, + ], + ])('bounced message %s', (_, bouncedMessageOptions) => { it('should render error badge for bounced messages', async () => { const message = generateAliceMessage(bouncedMessageOptions); const { queryByTestId } = await renderMessageSimple({ message }); diff --git a/src/components/Message/utils.tsx b/src/components/Message/utils.tsx index 80a53e799..2a01bb31f 100644 --- a/src/components/Message/utils.tsx +++ b/src/components/Message/utils.tsx @@ -485,10 +485,11 @@ export const isOnlyEmojis = (text?: string) => { export const isMessageBounced = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics >( - message: Pick, 'type' | 'moderation_details'>, + message: Pick, 'type' | 'moderation' | 'moderation_details'>, ) => message.type === 'error' && - message.moderation_details?.action === 'MESSAGE_RESPONSE_ACTION_BOUNCE'; + (message.moderation_details?.action === 'MESSAGE_RESPONSE_ACTION_BOUNCE' || + message.moderation?.action === 'bounce'); export const isMessageEdited = < StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics diff --git a/yarn.lock b/yarn.lock index 97b10f509..fa9da7177 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12200,10 +12200,10 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -stream-chat@^8.44.0: - version "8.44.0" - resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.44.0.tgz#e48446cf91db786e80a2e7358ac4f1601e5e97f0" - integrity sha512-7HNtimD8sT/51rsFibGcD6uBgKj+vlKyYCZMDzjYQEaEsrLqyAg48dOyNM4L2FTF5aXgo9SlxZr21SPleeA2BA== +stream-chat@^8.45.0: + version "8.45.0" + resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.0.tgz#bbb18ea897138dabb5ccd045a40958ec7242923c" + integrity sha512-re6GPh4F50ksB5/5GG5FtNAji+ZFTmIcLBIUhkGlnCwNaM8Ub59jcoI21Rtf/51+Nwrcitld2MzzlY49RlkwOA== dependencies: "@babel/runtime" "^7.16.3" "@types/jsonwebtoken" "~9.0.0"