Skip to content

Commit

Permalink
chore: upgrade stream-chat-react to v12.6.2 & stream-chat to v8.45.3 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCupela authored Dec 4, 2024
1 parent a07d39a commit c48f1a1
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 117 deletions.
4 changes: 2 additions & 2 deletions gaming-livestream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"emoji-mart": "^5.5.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"stream-chat": "^8.45.0",
"stream-chat-react": "^12.6.0"
"stream-chat": "^8.45.3",
"stream-chat-react": "^12.6.2"
},
"devDependencies": {
"@types/react": "^18.2.37",
Expand Down
35 changes: 35 additions & 0 deletions gaming-livestream/src/components/Chat/ChannelContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {GamingThreadHeader} from "./GamingThreadHeader";
import {SearchIndex} from "emoji-mart";
import {MessageTimestampController} from "../../context/MessageTimestampController";
import {GamingChatInner} from "./GamingChatInner";
import {Channel, useChatContext} from "stream-chat-react";
import React, {useEffect} from "react";
import {StreamChatType} from "../../types";


export const ChannelContainer = () => {
const {channel, client, setActiveChannel} = useChatContext<StreamChatType>();
useEffect(() => {
const loadChat = async () => {
const channel = client.channel('gaming', 'gaming-demo', { name: 'Gaming Demo' });
await channel.watch();
setActiveChannel(channel);
};

loadChat();
}, [client]);

if (!channel) return null;

return (
<Channel
channel={channel}
ThreadHeader={GamingThreadHeader}
emojiSearchIndex={SearchIndex}
>
<MessageTimestampController>
<GamingChatInner />
</MessageTimestampController>
</Channel>
);
};
63 changes: 19 additions & 44 deletions gaming-livestream/src/components/Chat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import React, { useEffect, useState } from 'react';
import { Channel, Chat } from 'stream-chat-react';
import React, {useState} from 'react';
import {Chat} from 'stream-chat-react';

import { init, SearchIndex } from 'emoji-mart';
import {init} from 'emoji-mart';
import data from '@emoji-mart/data';

import { ChatUpgrades } from './ChatUpgrades';
import { GamingChatInner } from './GamingChatInner';
import { GamingChatNotification } from './GamingChatNotification';
import { GamingParticipants } from './GamingParticipants';
import { GamingThreadHeader } from './GamingThreadHeader';
import {ChatUpgrades} from './ChatUpgrades';
import {GamingChatNotification} from './GamingChatNotification';
import {GamingParticipants} from './GamingParticipants';

import { getColor, getRandomUserRole, participants } from '../../assets/data';
import { useChecklist } from '../../hooks/useChecklistTasks';
import {getColor, getRandomUserRole, participants} from '../../assets/data';
import {useChecklist} from '../../hooks/useChecklistTasks';

import { useConnectUser } from '../../hooks/useConnectUser';
import { useLayoutController } from '../../context/LayoutController';
import type { Channel as ChannelT } from 'stream-chat';
import type { StreamChatType } from '../../types';
import { MessageTimestampController } from '../../context/MessageTimestampController';
import {useConnectUser} from '../../hooks/useConnectUser';
import {useLayoutController} from '../../context/LayoutController';
import type {Channel as ChannelT} from 'stream-chat';
import type {StreamChatType} from '../../types';
import {ChannelContainer} from "./ChannelContainer";

init({ data });

Expand All @@ -34,23 +32,10 @@ const userToConnect = {
};

export const GamingChat = () => {
const [channel, setChannel] = useState<ChannelT<StreamChatType> | null>(null);
const { memberListVisible, popUpText, upgradePanelVisible, chatVisible } = useLayoutController();
const chatClient = useConnectUser<StreamChatType>(apiKey!, userToConnect, userToken);
useChecklist({ chatClient, targetOrigin });

useEffect(() => {
if (!chatClient) return;

const loadChat = async () => {
const channel = chatClient.channel('gaming', 'gaming-demo', { name: 'Gaming Demo' });
await channel.watch();
setChannel(channel);
};

loadChat();
}, [chatClient]);

if (!chatClient) return null;

return (
Expand All @@ -59,22 +44,12 @@ export const GamingChat = () => {
upgradePanelVisible ? 'show-upgrade' : ''
}`}
>
{channel && (
<div className='chat-container'>
<Chat client={chatClient}>
<Channel
channel={channel}
ThreadHeader={GamingThreadHeader}
emojiSearchIndex={SearchIndex}
>
<MessageTimestampController>
<GamingChatInner />
</MessageTimestampController>
</Channel>
</Chat>
{popUpText && <GamingChatNotification text={popUpText} />}
</div>
)}
<div className='chat-container'>
<Chat client={chatClient}>
<ChannelContainer/>
</Chat>
{popUpText && <GamingChatNotification text={popUpText} />}
</div>
<GamingParticipants participants={participants} />
<ChatUpgrades />
</section>
Expand Down
2 changes: 1 addition & 1 deletion gaming-livestream/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type StreamChatType = {
channelType: ChannelType;
commandType: CommandType;
eventType: EventType;
memberType: MessageType;
memberType: MemberType;
messageType: MessageType;
reactionType: ReactionType;
userType: UserType;
Expand Down
47 changes: 11 additions & 36 deletions gaming-livestream/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9766,10 +9766,10 @@ stop-iteration-iterator@^1.0.0:
dependencies:
internal-slot "^1.0.4"

stream-chat-react@^12.6.0:
version "12.6.0"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.0.tgz#660433032535b61b82338e1cd4a078ecf3d1c729"
integrity sha512-3NneDl0K69iSdDeprPJP31IEJjbdRKbzjXXYOWODw+OJLK3dPOpQgI5cjvCS1lcUxCqg2M6n74ugIrLgen46Jw==
stream-chat-react@^12.6.2:
version "12.6.2"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.2.tgz#81a3c7f683fceda4bbbbd358678e1b1cf68e75ee"
integrity sha512-8Ln7TiQVrwGA5jkxgevu2pgELt+qxrHOOldq5ROUu2ptpsbda12+SxZlbXK0hbHaWZLXy4DC8uZl1nAmsiXv6w==
dependencies:
"@braintree/sanitize-url" "^6.0.4"
"@popperjs/core" "^2.11.5"
Expand Down Expand Up @@ -9806,10 +9806,10 @@ stream-chat-react@^12.6.0:
"@stream-io/transliterate" "^1.5.5"
mml-react "^0.4.7"

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==
stream-chat@^8.45.3:
version "8.45.3"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.3.tgz#1db8652760c670a1b6fb1b744767771fb79e4a74"
integrity sha512-cAHHBj2TOHtrDs7gfZdzk/wQy6dsoCtOvloQpMWSUabb+iuVQ32aAfRvGZEmgjypAhkLyT0Y8nvvhv3fT/cLbg==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "~9.0.0"
Expand Down Expand Up @@ -9842,16 +9842,7 @@ string-natural-compare@^3.0.1:
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -9946,14 +9937,7 @@ stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -11216,16 +11200,7 @@ [email protected]:
"@types/trusted-types" "^2.0.2"
workbox-core "6.6.1"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down
4 changes: 2 additions & 2 deletions social-messenger-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"lodash.debounce": "^4.0.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"stream-chat": "^8.45.0",
"stream-chat-react": "^12.6.0"
"stream-chat": "^8.45.3",
"stream-chat-react": "^12.6.2"
},
"devDependencies": {
"@types/jest": "^27.5.2",
Expand Down
4 changes: 2 additions & 2 deletions social-messenger-ts/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { LiteralStringForUnion } from 'stream-chat';
import type { LiteralStringForUnion, UR } from 'stream-chat';

export type AttachmentType = {};
export type ChannelType = { demo?: string };
export type CommandType = LiteralStringForUnion;
export type EventType = {};
export type MemberType = {};
export type MemberType = UR;
export type MessageType = {};
export type ReactionType = {};
export type UserType = { image?: string };
Expand Down
16 changes: 8 additions & 8 deletions social-messenger-ts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9490,10 +9490,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react@^12.6.0:
version "12.6.0"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.0.tgz#660433032535b61b82338e1cd4a078ecf3d1c729"
integrity sha512-3NneDl0K69iSdDeprPJP31IEJjbdRKbzjXXYOWODw+OJLK3dPOpQgI5cjvCS1lcUxCqg2M6n74ugIrLgen46Jw==
stream-chat-react@^12.6.2:
version "12.6.2"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.2.tgz#81a3c7f683fceda4bbbbd358678e1b1cf68e75ee"
integrity sha512-8Ln7TiQVrwGA5jkxgevu2pgELt+qxrHOOldq5ROUu2ptpsbda12+SxZlbXK0hbHaWZLXy4DC8uZl1nAmsiXv6w==
dependencies:
"@braintree/sanitize-url" "^6.0.4"
"@popperjs/core" "^2.11.5"
Expand Down Expand Up @@ -9530,10 +9530,10 @@ stream-chat-react@^12.6.0:
"@stream-io/transliterate" "^1.5.5"
mml-react "^0.4.7"

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==
stream-chat@^8.45.3:
version "8.45.3"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.3.tgz#1db8652760c670a1b6fb1b744767771fb79e4a74"
integrity sha512-cAHHBj2TOHtrDs7gfZdzk/wQy6dsoCtOvloQpMWSUabb+iuVQ32aAfRvGZEmgjypAhkLyT0Y8nvvhv3fT/cLbg==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "~9.0.0"
Expand Down
4 changes: 2 additions & 2 deletions team-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-popper": "^2.3.0",
"stream-chat": "^8.45.0",
"stream-chat-react": "^12.6.0"
"stream-chat": "^8.45.3",
"stream-chat-react": "^12.6.2"
},
"devDependencies": {
"@types/emoji-mart": "^3.0.9",
Expand Down
4 changes: 2 additions & 2 deletions team-ts/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type TeamAttachmentType = UR;
export type TeamChannelType = UR;
export type TeamCommandType = LiteralStringForUnion;
export type TeamEventType = UR;
export type TeamMemberType = UR;
export type MemberType = UR;
export type TeamMessageType = UR;
export type TeamReactionType = UR;
export type TeamUserType = { image?: string };
Expand All @@ -16,7 +16,7 @@ export type StreamChatType = {
channelType: TeamChannelType;
commandType: TeamCommandType;
eventType: TeamEventType;
memberType: TeamMemberType;
memberType: MemberType;
messageType: TeamMessageType;
reactionType: TeamReactionType;
userType: TeamUserType;
Expand Down
16 changes: 8 additions & 8 deletions team-ts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9846,10 +9846,10 @@ stop-iteration-iterator@^1.0.0:
dependencies:
internal-slot "^1.0.4"

stream-chat-react@^12.6.0:
version "12.6.0"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.0.tgz#660433032535b61b82338e1cd4a078ecf3d1c729"
integrity sha512-3NneDl0K69iSdDeprPJP31IEJjbdRKbzjXXYOWODw+OJLK3dPOpQgI5cjvCS1lcUxCqg2M6n74ugIrLgen46Jw==
stream-chat-react@^12.6.2:
version "12.6.2"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.2.tgz#81a3c7f683fceda4bbbbd358678e1b1cf68e75ee"
integrity sha512-8Ln7TiQVrwGA5jkxgevu2pgELt+qxrHOOldq5ROUu2ptpsbda12+SxZlbXK0hbHaWZLXy4DC8uZl1nAmsiXv6w==
dependencies:
"@braintree/sanitize-url" "^6.0.4"
"@popperjs/core" "^2.11.5"
Expand Down Expand Up @@ -9886,10 +9886,10 @@ stream-chat-react@^12.6.0:
"@stream-io/transliterate" "^1.5.5"
mml-react "^0.4.7"

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==
stream-chat@^8.45.3:
version "8.45.3"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.3.tgz#1db8652760c670a1b6fb1b744767771fb79e4a74"
integrity sha512-cAHHBj2TOHtrDs7gfZdzk/wQy6dsoCtOvloQpMWSUabb+iuVQ32aAfRvGZEmgjypAhkLyT0Y8nvvhv3fT/cLbg==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "~9.0.0"
Expand Down
4 changes: 2 additions & 2 deletions virtual-event/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"lottie-web": "^5.9.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"stream-chat": "^8.45.0",
"stream-chat-react": "^12.6.0"
"stream-chat": "^8.45.3",
"stream-chat-react": "^12.6.2"
},
"devDependencies": {
"@types/emoji-mart": "^3.0.8",
Expand Down
16 changes: 8 additions & 8 deletions virtual-event/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9248,10 +9248,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react@^12.6.0:
version "12.6.0"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.0.tgz#660433032535b61b82338e1cd4a078ecf3d1c729"
integrity sha512-3NneDl0K69iSdDeprPJP31IEJjbdRKbzjXXYOWODw+OJLK3dPOpQgI5cjvCS1lcUxCqg2M6n74ugIrLgen46Jw==
stream-chat-react@^12.6.2:
version "12.6.2"
resolved "https://registry.yarnpkg.com/stream-chat-react/-/stream-chat-react-12.6.2.tgz#81a3c7f683fceda4bbbbd358678e1b1cf68e75ee"
integrity sha512-8Ln7TiQVrwGA5jkxgevu2pgELt+qxrHOOldq5ROUu2ptpsbda12+SxZlbXK0hbHaWZLXy4DC8uZl1nAmsiXv6w==
dependencies:
"@braintree/sanitize-url" "^6.0.4"
"@popperjs/core" "^2.11.5"
Expand Down Expand Up @@ -9288,10 +9288,10 @@ stream-chat-react@^12.6.0:
"@stream-io/transliterate" "^1.5.5"
mml-react "^0.4.7"

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==
stream-chat@^8.45.3:
version "8.45.3"
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-8.45.3.tgz#1db8652760c670a1b6fb1b744767771fb79e4a74"
integrity sha512-cAHHBj2TOHtrDs7gfZdzk/wQy6dsoCtOvloQpMWSUabb+iuVQ32aAfRvGZEmgjypAhkLyT0Y8nvvhv3fT/cLbg==
dependencies:
"@babel/runtime" "^7.16.3"
"@types/jsonwebtoken" "~9.0.0"
Expand Down

0 comments on commit c48f1a1

Please sign in to comment.