@memori.ai/memori-react
Version:
[](https://www.npmjs.com/package/@memori.ai/memori-react)   • 5.4 kB
TypeScript
import { DialogState, Memori, Integration, OpenSession, MemoriConfig, Tenant } from '@memori.ai/memori-api-client/src/types';
import React from 'react';
import Chat, { Props as ChatProps } from '../Chat/Chat';
import StartPanel, { Props as StartPanelProps } from '../StartPanel/StartPanel';
import Avatar, { Props as AvatarProps } from '../Avatar/Avatar';
import Header, { Props as HeaderProps } from '../Header/Header';
declare const getMemoriState: (integrationId?: string | undefined) => object | null;
type MemoriTextEnteredEvent = CustomEvent<{
text: string;
waitForPrevious?: boolean;
hidden?: boolean;
typingText?: string;
useLoaderTextAsMsg?: boolean;
hasBatchQueued?: boolean;
}>;
declare const typeMessage: (message: string, waitForPrevious?: boolean, hidden?: boolean, typingText?: string | undefined, useLoaderTextAsMsg?: boolean, hasBatchQueued?: boolean) => void;
declare const typeMessageHidden: (message: string, waitForPrevious?: boolean, typingText?: string | undefined, useLoaderTextAsMsg?: boolean, hasBatchQueued?: boolean) => void;
declare const typeBatchMessages: (messages: {
message: string;
waitForPrevious?: boolean | undefined;
hidden?: boolean | undefined;
typingText?: string | undefined;
useLoaderTextAsMsg?: boolean | undefined;
}[]) => void;
type MemoriNewDialogStateEvent = CustomEvent<DialogState>;
interface CustomEventMap {
MemoriTextEntered: MemoriTextEnteredEvent;
MemoriEndSpeak: CustomEvent;
MemoriResetUIEffects: CustomEvent;
MemoriNewDialogState: MemoriNewDialogStateEvent;
}
declare global {
interface Document {
addEventListener<K extends keyof CustomEventMap>(type: K, listener: (this: Document, ev: CustomEventMap[K]) => void): void;
removeEventListener<K extends keyof CustomEventMap>(type: K, listener: (this: Document, ev: CustomEventMap[K]) => void): void;
dispatchEvent<K extends keyof CustomEventMap>(ev: CustomEventMap[K]): void;
}
interface Window {
getMemoriState: typeof getMemoriState;
typeMessage: typeof typeMessage;
typeMessageHidden: typeof typeMessageHidden;
typeBatchMessages: typeof typeBatchMessages;
}
}
export interface LayoutProps {
Header?: typeof Header;
headerProps?: HeaderProps;
Avatar: typeof Avatar;
avatarProps?: AvatarProps;
Chat?: typeof Chat;
chatProps?: ChatProps;
StartPanel: typeof StartPanel;
startPanelProps?: StartPanelProps;
integrationStyle?: JSX.Element | null;
integrationBackground?: JSX.Element | null;
poweredBy?: JSX.Element | null;
sessionId?: string;
hasUserActivatedSpeak?: boolean;
showUpload?: boolean;
loading?: boolean;
autoStart?: boolean;
}
export interface Props {
memori: Memori;
ownerUserName?: string | null;
ownerUserID?: string | null;
tenantID: string;
memoriConfigs?: MemoriConfig[];
memoriLang?: string;
multilingual?: boolean;
integration?: Integration;
layout?: 'DEFAULT' | 'FULLPAGE' | 'TOTEM' | 'CHAT' | 'WEBSITE_ASSISTANT' | 'HIDDEN_CHAT' | 'ZOOMED_FULL_BODY';
customLayout?: React.FC<LayoutProps>;
showShare?: boolean;
showCopyButton?: boolean;
showTranslationOriginal?: boolean;
showInputs?: boolean;
showDates?: boolean;
showContextPerLine?: boolean;
showSettings?: boolean;
showClear?: boolean;
showOnlyLastMessages?: boolean;
showTypingText?: boolean;
showLogin?: boolean;
showUpload?: boolean;
showChatHistory?: boolean;
showReasoning?: boolean;
preview?: boolean;
embed?: boolean;
height?: number | string;
secret?: string;
baseUrl?: string;
apiURL?: string;
engineURL?: string;
initialContextVars?: {
[key: string]: string;
};
initialQuestion?: string;
ogImage?: string;
sessionID?: string;
tenant?: Tenant;
personification?: {
name?: string;
tag: string;
pin: string;
};
authToken?: string;
AZURE_COGNITIVE_SERVICES_TTS_KEY?: string;
enableAudio?: boolean;
defaultSpeakerActive?: boolean;
disableTextEnteredEvents?: boolean;
onStateChange?: (state?: DialogState) => void;
additionalInfo?: OpenSession['additionalInfo'] & {
[key: string]: string;
};
customMediaRenderer?: ChatProps['customMediaRenderer'];
additionalSettings?: JSX.Element | null;
userAvatar?: string | JSX.Element;
useMathFormatting?: boolean;
autoStart?: boolean;
applyVarsToRoot?: boolean;
showFunctionCache?: boolean;
}
declare const MemoriWidget: ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview, embed, showCopyButton, showTranslationOriginal, showInputs, showDates, showContextPerLine, showSettings, showTypingText, showClear, showLogin, showUpload, showOnlyLastMessages, showChatHistory, showReasoning, height, secret, baseUrl, apiURL, engineURL, initialContextVars, initialQuestion, ogImage, sessionID: initialSessionID, tenant, personification, authToken, AZURE_COGNITIVE_SERVICES_TTS_KEY, enableAudio, defaultSpeakerActive, disableTextEnteredEvents, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, useMathFormatting, autoStart, applyVarsToRoot, showFunctionCache, }: Props) => JSX.Element;
export default MemoriWidget;