diff --git a/packages/chat/package.json b/packages/chat/package.json index 456a531b6..8289480de 100644 --- a/packages/chat/package.json +++ b/packages/chat/package.json @@ -77,7 +77,7 @@ "@vanilla-extract/css": "1.15.5", "@vanilla-extract/recipes": "0.5.5", "@voiceflow/base-types": "2.113.1", - "@voiceflow/dtos-interact": "1.1.0", + "@voiceflow/dtos-interact": "1.9.0", "@voiceflow/sdk-runtime": "workspace:*", "@voiceflow/slate-serializer": "1.5.5", "@voiceflow/voiceflow-types": "3.32.1", diff --git a/packages/chat/src/components/NewChat/ChatContainer/ChatContainer.component.tsx b/packages/chat/src/components/NewChat/ChatContainer/ChatContainer.component.tsx new file mode 100644 index 000000000..b7efe7ce1 --- /dev/null +++ b/packages/chat/src/components/NewChat/ChatContainer/ChatContainer.component.tsx @@ -0,0 +1,20 @@ +import { assignInlineVars } from '@vanilla-extract/dynamic'; +import type { WidgetSettingsColorPalette } from '@voiceflow/dtos-interact'; + +import { PALETTE } from '@/styles/colors.css'; + +import { chatWindowStyle } from './ChatContainer.css'; + +export interface IChatContainer { + palette: WidgetSettingsColorPalette; + children?: React.ReactNode; + isMobile?: boolean; +} + +export const ChatContainer: React.FC = ({ palette, children, isMobile = false }) => { + return ( +
+ {children} +
+ ); +}; diff --git a/packages/chat/src/views/ChatWindow/styles.css.ts b/packages/chat/src/components/NewChat/ChatContainer/ChatContainer.css.tsx similarity index 85% rename from packages/chat/src/views/ChatWindow/styles.css.ts rename to packages/chat/src/components/NewChat/ChatContainer/ChatContainer.css.tsx index dc0950f8d..8486469cf 100644 --- a/packages/chat/src/views/ChatWindow/styles.css.ts +++ b/packages/chat/src/components/NewChat/ChatContainer/ChatContainer.css.tsx @@ -1,6 +1,6 @@ import { recipe } from '@vanilla-extract/recipes'; -export const chatWindow = recipe({ +export const chatWindowStyle = recipe({ base: { height: '100%', maxHeight: '800px', diff --git a/packages/chat/src/components/NewChat/index.tsx b/packages/chat/src/components/NewChat/index.tsx index 93552df16..8c9d8172d 100644 --- a/packages/chat/src/components/NewChat/index.tsx +++ b/packages/chat/src/components/NewChat/index.tsx @@ -11,6 +11,7 @@ import { type INewFooter, NewFooter } from '../NewFooter'; import { Prompt } from '../Prompt'; import { Separator } from '../Separator'; import { type IWelcomeMessage, WelcomeMessage } from '../WelcomeMessage'; +import { ChatContainer } from './ChatContainer/ChatContainer.component'; import { bottomSpacer, chatContainer, chatContentWrapper, chatEndedContainer, dialogContainer } from './NewChat.css'; export interface INewChat @@ -56,7 +57,7 @@ export interface INewChat onStart?: (() => Promise) | undefined; } -export const NewChat: React.FC = ({ +const Chat: React.FC = ({ buttons, showPoweredBy, messageInputProps, @@ -142,3 +143,7 @@ export const NewChat: React.FC = ({ ); }; + +export const NewChat = Object.assign(Chat, { + Container: ChatContainer, +}); diff --git a/packages/chat/src/views/ChatWindow/index.tsx b/packages/chat/src/views/ChatWindow/index.tsx index 4a2b43e58..fe241b98c 100644 --- a/packages/chat/src/views/ChatWindow/index.tsx +++ b/packages/chat/src/views/ChatWindow/index.tsx @@ -1,6 +1,5 @@ import '../../styles.css'; -import { assignInlineVars } from '@vanilla-extract/dynamic'; import React, { useCallback, useContext } from 'react'; import * as R from 'remeda'; import { match } from 'ts-pattern'; @@ -12,12 +11,9 @@ import { UserResponse } from '@/components/UserResponse'; import { RuntimeStateAPIContext, RuntimeStateContext } from '@/contexts/RuntimeContext'; import type { FeedbackName } from '@/contexts/RuntimeContext/useRuntimeAPI'; import { usePalette } from '@/hooks/usePalette'; -import { PALETTE } from '@/styles/colors.css'; import type { UserTurnProps } from '@/types'; import { SessionStatus, TurnType } from '@/types'; -import { chatWindow } from './styles.css'; - export interface ChatWindowProps { className?: string; isMobile?: boolean; @@ -46,7 +42,7 @@ export const ChatWindow: React.FC = ({ isMobile }) => { if (!palette) return null; return ( -
+ = ({ isMobile }) => {
)} - + ); }; diff --git a/yarn.lock b/yarn.lock index 227c49bc1..eaa3ec22d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7480,6 +7480,15 @@ __metadata: languageName: node linkType: hard +"@voiceflow/dtos-interact@npm:1.9.0": + version: 1.9.0 + resolution: "@voiceflow/dtos-interact@npm:1.9.0" + peerDependencies: + zod: ^3 + checksum: 676a4d808f5f1191703fdc4b27f0d059774141bf9a4c2294bac16c25786fd2efd0e5a15c9637ae807ee2764db3be6a14c259e686b03beac04df341aee2795694 + languageName: node + linkType: hard + "@voiceflow/eslint-config@npm:7.5.0": version: 7.5.0 resolution: "@voiceflow/eslint-config@npm:7.5.0" @@ -7651,7 +7660,7 @@ __metadata: "@vanilla-extract/vite-plugin": 4.0.15 "@vitejs/plugin-react": 4.2.1 "@voiceflow/base-types": 2.113.1 - "@voiceflow/dtos-interact": 1.1.0 + "@voiceflow/dtos-interact": 1.9.0 "@voiceflow/sdk-runtime": "workspace:*" "@voiceflow/slate-serializer": 1.5.5 "@voiceflow/test-common": 1.10.3