ttc-ai-client
Version:
TypeScript client sdk for TTC AI services with decorators and schema validation.
89 lines • 2.7 kB
TypeScript
import { ClassType } from '../types';
import { BotShape } from './botRenderer';
export interface TTCChatWidgetTheme {
primary?: string;
primaryHover?: string;
background?: string;
messagesBackground?: string;
headerBackground?: string;
footerBackground?: string;
textColor?: string;
headerTextColor?: string;
userBubbleColor?: string;
aiBubbleColor?: string;
userBubbleTextColor?: string;
aiBubbleTextColor?: string;
statusTextColor?: string;
borderColor?: string;
scrollbarColor?: string;
focusColor?: string;
fontFamily?: string;
botBorderColor?: string;
botBackgroundColor?: string;
botEyeColor?: string;
botAntennaColor?: string;
}
export interface TTCChatWidgetOptions {
appId: string;
modules: ClassType[];
conversationId?: string;
getApiKey?: () => Promise<string> | string;
authorization?: {
generateUrl?: (appId: string, redirectUri: string, scopes: string, state: string) => Promise<{
authorizationUrl: string;
state: string;
}>;
exchangeCode?: (code: string, appId: string, redirectUri: string) => Promise<{
accessToken: string;
}>;
refreshToken?: (appUserId: string, appId: string) => Promise<{
accessToken: string;
}>;
};
redirectUri?: string;
storageKey?: string;
chatIdStorageKey?: string;
emoteStorageKey?: string;
ui?: {
title?: string;
placeholder?: string;
openLabel?: string;
themeColor?: string;
theme?: TTCChatWidgetTheme;
typingSpeed?: number;
};
onToken?: (token: string) => void;
onMessage?: (msg: {
role: 'user' | 'assistant';
content: string;
}) => void;
onInitError?: (err: Error) => void;
}
export declare function initTTCChatWidget(options: TTCChatWidgetOptions): {
open: () => void;
close: () => void;
destroy: () => void;
send: (text: string) => void;
getToken: () => string;
getChatId: () => string;
isInitialized: () => boolean;
reinitializeCallManager: () => void;
newChat: () => void;
setEmote: (emote: BotShape) => void;
getEmote: () => BotShape;
Play: (mood: 'idle' | 'happy' | 'sad', animationName?: string) => void;
} | {
open: () => void;
close: () => void;
destroy: () => void;
send: (text: string) => void;
getToken: () => string;
getChatId: () => string;
isInitialized: () => boolean;
newChat: () => void;
setEmote: (emote: BotShape) => void;
getEmote: () => BotShape;
Play: () => void;
};
export default initTTCChatWidget;
//# sourceMappingURL=index.d.ts.map