diff --git a/gaming-livestream/package.json b/gaming-livestream/package.json index 6f299321..7a463ad1 100644 --- a/gaming-livestream/package.json +++ b/gaming-livestream/package.json @@ -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", diff --git a/gaming-livestream/src/components/Chat/ChannelContainer.tsx b/gaming-livestream/src/components/Chat/ChannelContainer.tsx new file mode 100644 index 00000000..ea35d2c7 --- /dev/null +++ b/gaming-livestream/src/components/Chat/ChannelContainer.tsx @@ -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(); + 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 ( + + + + + + ); +}; \ No newline at end of file diff --git a/gaming-livestream/src/components/Chat/index.tsx b/gaming-livestream/src/components/Chat/index.tsx index eb8261fd..7801efea 100644 --- a/gaming-livestream/src/components/Chat/index.tsx +++ b/gaming-livestream/src/components/Chat/index.tsx @@ -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 }); @@ -34,23 +32,10 @@ const userToConnect = { }; export const GamingChat = () => { - const [channel, setChannel] = useState | null>(null); const { memberListVisible, popUpText, upgradePanelVisible, chatVisible } = useLayoutController(); const chatClient = useConnectUser(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 ( @@ -59,22 +44,12 @@ export const GamingChat = () => { upgradePanelVisible ? 'show-upgrade' : '' }`} > - {channel && ( -
- - - - - - - - {popUpText && } -
- )} +
+ + + + {popUpText && } +
diff --git a/gaming-livestream/src/types.ts b/gaming-livestream/src/types.ts index 25912058..fa8bca7f 100644 --- a/gaming-livestream/src/types.ts +++ b/gaming-livestream/src/types.ts @@ -18,7 +18,7 @@ export type StreamChatType = { channelType: ChannelType; commandType: CommandType; eventType: EventType; - memberType: MessageType; + memberType: MemberType; messageType: MessageType; reactionType: ReactionType; userType: UserType; diff --git a/gaming-livestream/yarn.lock b/gaming-livestream/yarn.lock index 0c8f897a..867af40d 100644 --- a/gaming-livestream/yarn.lock +++ b/gaming-livestream/yarn.lock @@ -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" @@ -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" @@ -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== @@ -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== @@ -11216,16 +11200,7 @@ workbox-window@6.6.1: "@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== diff --git a/social-messenger-ts/package.json b/social-messenger-ts/package.json index cc1680f7..9d38da08 100644 --- a/social-messenger-ts/package.json +++ b/social-messenger-ts/package.json @@ -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", diff --git a/social-messenger-ts/src/types.ts b/social-messenger-ts/src/types.ts index ecf0fd71..0e542cab 100644 --- a/social-messenger-ts/src/types.ts +++ b/social-messenger-ts/src/types.ts @@ -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 }; diff --git a/social-messenger-ts/yarn.lock b/social-messenger-ts/yarn.lock index 40e70cc9..f82e3d20 100644 --- a/social-messenger-ts/yarn.lock +++ b/social-messenger-ts/yarn.lock @@ -9490,10 +9490,10 @@ statuses@2.0.1: 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" @@ -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" diff --git a/team-ts/package.json b/team-ts/package.json index 49001899..4b9bf90c 100644 --- a/team-ts/package.json +++ b/team-ts/package.json @@ -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", diff --git a/team-ts/src/types.ts b/team-ts/src/types.ts index c4ba333f..88953d4a 100644 --- a/team-ts/src/types.ts +++ b/team-ts/src/types.ts @@ -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 }; @@ -16,7 +16,7 @@ export type StreamChatType = { channelType: TeamChannelType; commandType: TeamCommandType; eventType: TeamEventType; - memberType: TeamMemberType; + memberType: MemberType; messageType: TeamMessageType; reactionType: TeamReactionType; userType: TeamUserType; diff --git a/team-ts/yarn.lock b/team-ts/yarn.lock index 38d7b02a..2341e3d0 100644 --- a/team-ts/yarn.lock +++ b/team-ts/yarn.lock @@ -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" @@ -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" diff --git a/virtual-event/package.json b/virtual-event/package.json index 81de31a5..717c23ed 100644 --- a/virtual-event/package.json +++ b/virtual-event/package.json @@ -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", diff --git a/virtual-event/yarn.lock b/virtual-event/yarn.lock index c4344b96..b5be5ee5 100644 --- a/virtual-event/yarn.lock +++ b/virtual-event/yarn.lock @@ -9248,10 +9248,10 @@ statuses@2.0.1: 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" @@ -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"