Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit 9dc48da

Browse files
committed
feat: sync some missing settings (COR-4228) (#458)
This should close * COR-4228 * DSN-2623 * COR-4230
1 parent 9a0a282 commit 9dc48da

File tree

8 files changed

+47
-40
lines changed

8 files changed

+47
-40
lines changed

packages/chat/src/components/Launcher/LauncherWithLabel/index.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Button } from '@/components/Button';
66
import { ClassName } from '@/constants';
77

88
import { ChevronIcon } from '../ChevronIcon';
9-
import { PlayIcon } from '../PlayIcon';
109
import { closeChevron, imageIconStyle, imageIconWrapper, launcherLabelStyles, launcherStyles } from './styles.css';
1110

1211
export interface LauncherProps {
@@ -43,11 +42,7 @@ export const LauncherWithLabel: React.FC<LauncherProps> = ({ image, isOpen, labe
4342
return (
4443
<Button className={clsx(launcherStyles({ isOpen }), ClassName.LAUNCHER)} onClick={onClick}>
4544
<div className={imageIconWrapper({ isOpen })}>
46-
{image ? (
47-
<img src={image} className={clsx(imageIconStyle({ isOpen }))} alt="open chat" />
48-
) : (
49-
<PlayIcon className={imageIconStyle({ isOpen })} />
50-
)}
45+
{image && <img src={image} className={clsx(imageIconStyle({ isOpen }))} alt="open chat" />}
5146
<ChevronIcon className={clsx(closeChevron({ isOpen }))} />
5247
</div>
5348
<div className={launcherLabelStyles}>{label}</div>

packages/chat/src/components/Launcher/PlayIcon.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/chat/src/components/Launcher/index.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ import { ChevronIcon } from './ChevronIcon';
1010
import { LauncherWithLabel } from './LauncherWithLabel';
1111
import {
1212
closeChevron,
13+
closeIconStyles,
1314
iconContainer,
1415
imageStyles,
1516
launcherContainer,
1617
launcherIconStyles,
17-
launcherLabelStyles,
1818
launcherStyles,
19-
playIconStyles,
2019
} from './styles.css';
2120

2221
export const DEFAULT_ICON = 'https://cdn.voiceflow.com/widget-next/message.png';
@@ -59,23 +58,31 @@ export interface LauncherProps {
5958
export const Launcher: React.FC<LauncherProps> = ({ image, type, isOpen, label, onClick }) => {
6059
const withIcon = type !== 'label';
6160
const withLabel = type !== 'icon' && !!label?.length;
61+
6262
if (withLabel) {
63-
return <LauncherWithLabel image={image} isOpen={isOpen} label={label} onClick={onClick} />;
63+
return (
64+
<LauncherWithLabel
65+
image={withIcon ? (image ?? DEFAULT_ICON) : undefined}
66+
isOpen={isOpen}
67+
label={label}
68+
onClick={onClick}
69+
/>
70+
);
6471
}
72+
6573
return (
6674
<div className={launcherContainer} onClick={onClick}>
6775
<Button className={clsx(ClassName.LAUNCHER, launcherStyles({ isOpen }))}>
6876
<div className={iconContainer({ isOpen, withIcon })}>
69-
<ChevronIcon className={clsx(closeChevron({ isOpen }), launcherIconStyles())} />
77+
<ChevronIcon className={clsx(closeChevron({ isOpen }), closeIconStyles())} />
7078
{withIcon && (
7179
<img
7280
src={image ?? DEFAULT_ICON}
73-
className={clsx(imageStyles({ isOpen }), playIconStyles({}))}
81+
className={clsx(imageStyles({ isOpen }), launcherIconStyles({}))}
7482
alt="open chat"
7583
/>
7684
)}
7785
</div>
78-
{withLabel && <div className={launcherLabelStyles({ isOpen })}>{label} </div>}
7986
</Button>
8087
</div>
8188
);

packages/chat/src/components/Launcher/styles.css.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const launcherLabelStyles = recipe({
128128
},
129129
});
130130

131-
export const launcherIconStyles = recipe({
131+
export const closeIconStyles = recipe({
132132
base: {
133133
color: THEME.colors[50],
134134
width: 32,
@@ -146,7 +146,7 @@ export const launcherIconStyles = recipe({
146146
},
147147
});
148148

149-
export const playIconStyles = recipe({
149+
export const launcherIconStyles = recipe({
150150
base: {
151151
width: 32,
152152
height: 32,
@@ -167,6 +167,7 @@ export const playIconStyles = recipe({
167167
},
168168
},
169169
});
170+
170171
export const twistInAnimation = keyframes({
171172
'0%': {
172173
opacity: 0,

packages/chat/src/components/NewChat/ChatContainer/ChatContainer.component.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ import { chatWindowStyle } from './ChatContainer.css';
1010

1111
export interface IChatContainer {
1212
palette: WidgetSettingsColorPalette;
13+
fontFamily?: string;
1314
children?: React.ReactNode;
1415
embedded?: boolean;
1516
isPopover?: boolean;
1617
}
1718

18-
export const ChatContainer: React.FC<IChatContainer> = ({ palette, children, embedded, isPopover }) => {
19+
export const ChatContainer: React.FC<IChatContainer> = ({ palette, fontFamily, children, embedded, isPopover }) => {
1920
return (
2021
<div
21-
style={assignInlineVars(THEME, { colors: palette, fontFamily: FAMILY })}
22+
style={assignInlineVars(THEME, { colors: palette, fontFamily: fontFamily ?? FAMILY })}
2223
className={clsx(chatWindowStyle({ popover: isPopover }), embedded ? chatIsOpen : '')}
2324
>
2425
{children}

packages/chat/src/components/SystemResponse/SystemMessage.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ import { ExtensionMessage } from './ExtensionMessage';
1818
import { hide, messageContainer, responseAvatar, systemMessageContainer } from './styles.css';
1919
import type { MessageProps } from './types';
2020

21+
export interface AIDisclaimerProps {
22+
enabled?: boolean;
23+
text?: string;
24+
}
25+
2126
export interface SystemMessageProps {
2227
/**
2328
* An image URL for an avatar to associate this message with.
@@ -54,6 +59,8 @@ export interface SystemMessageProps {
5459
* The entire text content of a response over a number of responses
5560
*/
5661
textContent?: string;
62+
63+
aiDisclaimer?: AIDisclaimerProps;
5764
}
5865

5966
/**
@@ -66,9 +73,9 @@ export const SystemMessage: React.FC<SystemMessageProps> = ({
6673
isLast,
6774
withImage,
6875
textContent,
76+
aiDisclaimer,
6977
}) => {
70-
const { config, assistant } = useContext(RuntimeStateAPIContext);
71-
const aiMessage = assistant.chat.aiDisclaimer.text;
78+
const { config } = useContext(RuntimeStateAPIContext);
7279

7380
return (
7481
<div className={clsx(ClassName.SYSTEM_RESPONSE, systemMessageContainer)}>
@@ -86,8 +93,8 @@ export const SystemMessage: React.FC<SystemMessageProps> = ({
8693
.with({ type: MessageType.TEXT }, ({ text, ai }) => (
8794
<AgentMessage
8895
text={text}
89-
disclaimerMessage={aiMessage}
90-
ai={ai}
96+
disclaimerMessage={aiDisclaimer?.text}
97+
ai={ai && aiDisclaimer?.enabled}
9198
isLast={isLast}
9299
feedback={feedback}
93100
textContent={textContent}

packages/chat/src/views/ChatWidget/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ export const ChatWidget: React.FC<ChatWidgetProps> = ({ shadowRoot, chatAPI, rea
8383
const isDefaultFont = customFontFamily === 'UCity Pro';
8484

8585
useEffect(() => {
86-
if (!isDefaultFont) {
87-
const link = document.createElement('link');
86+
if (isDefaultFont) return;
8887

89-
const fontFamilyNameForImport = customFontFamily.replace(/ /g, '+');
90-
link.href = `https://fonts.googleapis.com/css2?family=${fontFamilyNameForImport}&display=swap`;
91-
link.rel = 'stylesheet';
92-
document.head.appendChild(link);
93-
}
94-
}, []);
88+
const link = document.createElement('link');
89+
90+
const fontFamilyNameForImport = customFontFamily.replace(/ /g, '+');
91+
link.href = `https://fonts.googleapis.com/css2?family=${fontFamilyNameForImport}&display=swap`;
92+
link.rel = 'stylesheet';
93+
document.head.appendChild(link);
94+
}, [customFontFamily]);
9595

9696
if (!isStyleSheetResolved) return null;
9797
if (!palette) return null;

packages/chat/src/views/ChatWindow/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { FeedbackName } from '@/contexts/RuntimeContext/useRuntimeAPI';
1414
import { DEFAULT_CHAT_AVATAR } from '@/dtos/AssistantOptions.dto';
1515
import { RenderMode } from '@/dtos/RenderOptions.dto';
1616
import { usePalette } from '@/hooks/usePalette';
17+
import { FAMILY } from '@/styles/font';
1718
import type { UserTurnProps } from '@/types';
1819
import { SessionStatus, TurnType } from '@/types';
1920

@@ -52,7 +53,12 @@ export const ChatWindow: React.FC<ChatWindowProps> = ({ isMobile, isPopover }) =
5253
const hasEnded = runtime.isStatus(SessionStatus.ENDED);
5354

5455
return (
55-
<NewChat.Container embedded={config.render.mode === RenderMode.EMBEDDED} palette={palette} isPopover={isPopover}>
56+
<NewChat.Container
57+
embedded={config.render.mode === RenderMode.EMBEDDED}
58+
palette={palette}
59+
fontFamily={assistant.common.fontFamily === 'UCity Pro' ? FAMILY : assistant.common.fontFamily}
60+
isPopover={isPopover}
61+
>
5662
<NewChat
5763
headerProps={{
5864
title: assistant.chat.banner.title,
@@ -68,6 +74,7 @@ export const ChatWindow: React.FC<ChatWindowProps> = ({ isMobile, isPopover }) =
6874
footerProps={{
6975
showPoweredBy: assistant.common.poweredBy,
7076
messageInputProps: {
77+
placeholder: assistant.chat.placeholderText,
7178
onSubmit: runtime.reply,
7279
audioInterface: assistant.chat.voiceInput,
7380
hasEnded,

0 commit comments

Comments
 (0)