@gravity-ui/aikit 3.2.0 → 3.2.1-beta.62cd303ea62095304bfb52217eb70529a7dbaf96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/build/cjs/components/organisms/Header/Header.css +25 -0
  2. package/build/cjs/components/organisms/Header/Header.js +21 -2
  3. package/build/cjs/components/organisms/Header/Header.js.map +1 -1
  4. package/build/cjs/components/organisms/Header/i18n/en.json +4 -1
  5. package/build/cjs/components/organisms/Header/i18n/index.d.ts +4 -4
  6. package/build/cjs/components/organisms/Header/i18n/ru.json +4 -1
  7. package/build/cjs/components/organisms/Header/types.d.ts +3 -0
  8. package/build/cjs/components/organisms/Header/types.js.map +1 -1
  9. package/build/cjs/components/pages/ChatContainer/ChatContainer.js +18 -9
  10. package/build/cjs/components/pages/ChatContainer/ChatContainer.js.map +1 -1
  11. package/build/cjs/components/pages/ChatContainer/types.d.ts +9 -0
  12. package/build/cjs/components/pages/ChatContainer/types.js.map +1 -1
  13. package/build/cjs/components/templates/History/ChatItem.d.ts +4 -1
  14. package/build/cjs/components/templates/History/ChatItem.js +2 -2
  15. package/build/cjs/components/templates/History/ChatItem.js.map +1 -1
  16. package/build/cjs/components/templates/History/History.css +14 -0
  17. package/build/cjs/components/templates/History/History.js +1 -1
  18. package/build/cjs/components/templates/History/History.js.map +1 -1
  19. package/build/cjs/components/templates/History/HistoryList.d.ts +5 -0
  20. package/build/cjs/components/templates/History/HistoryList.js +14 -4
  21. package/build/cjs/components/templates/History/HistoryList.js.map +1 -1
  22. package/build/cjs/components/templates/History/i18n/en.json +3 -1
  23. package/build/cjs/components/templates/History/i18n/index.d.ts +4 -4
  24. package/build/cjs/components/templates/History/i18n/ru.json +3 -1
  25. package/build/cjs/hooks/index.d.ts +1 -0
  26. package/build/cjs/hooks/index.js +1 -0
  27. package/build/cjs/hooks/index.js.map +1 -1
  28. package/build/cjs/hooks/useChatActivity.d.ts +10 -0
  29. package/build/cjs/hooks/useChatActivity.js +51 -0
  30. package/build/cjs/hooks/useChatActivity.js.map +1 -0
  31. package/build/cjs/package.json +1 -1
  32. package/build/cjs/utils/chatActivityPersistence.d.ts +21 -0
  33. package/build/cjs/utils/chatActivityPersistence.js +186 -0
  34. package/build/cjs/utils/chatActivityPersistence.js.map +1 -0
  35. package/build/cjs/utils/chatActivityStore.d.ts +59 -0
  36. package/build/cjs/utils/chatActivityStore.js +112 -0
  37. package/build/cjs/utils/chatActivityStore.js.map +1 -0
  38. package/build/cjs/utils/index.d.ts +2 -0
  39. package/build/cjs/utils/index.js +2 -0
  40. package/build/cjs/utils/index.js.map +1 -1
  41. package/build/cjs/utils/remoteChatActivityStore.d.ts +38 -0
  42. package/build/cjs/utils/remoteChatActivityStore.js +127 -0
  43. package/build/cjs/utils/remoteChatActivityStore.js.map +1 -0
  44. package/build/docs/INDEX.md +1 -0
  45. package/build/docs/components/organisms/Header.md +5 -0
  46. package/build/docs/components/pages/ChatContainer.md +5 -0
  47. package/build/docs/components/templates/History.md +6 -0
  48. package/build/docs/guides/chat-activity.md +158 -0
  49. package/build/esm/components/organisms/Header/Header.css +25 -0
  50. package/build/esm/components/organisms/Header/Header.js +22 -3
  51. package/build/esm/components/organisms/Header/Header.js.map +1 -1
  52. package/build/esm/components/organisms/Header/i18n/en.json +4 -1
  53. package/build/esm/components/organisms/Header/i18n/index.d.ts +4 -4
  54. package/build/esm/components/organisms/Header/i18n/ru.json +4 -1
  55. package/build/esm/components/organisms/Header/types.d.ts +3 -0
  56. package/build/esm/components/organisms/Header/types.js.map +1 -1
  57. package/build/esm/components/pages/ChatContainer/ChatContainer.js +18 -9
  58. package/build/esm/components/pages/ChatContainer/ChatContainer.js.map +1 -1
  59. package/build/esm/components/pages/ChatContainer/types.d.ts +9 -0
  60. package/build/esm/components/pages/ChatContainer/types.js.map +1 -1
  61. package/build/esm/components/templates/History/ChatItem.d.ts +4 -1
  62. package/build/esm/components/templates/History/ChatItem.js +3 -3
  63. package/build/esm/components/templates/History/ChatItem.js.map +1 -1
  64. package/build/esm/components/templates/History/History.css +14 -0
  65. package/build/esm/components/templates/History/History.js +1 -1
  66. package/build/esm/components/templates/History/History.js.map +1 -1
  67. package/build/esm/components/templates/History/HistoryList.d.ts +5 -0
  68. package/build/esm/components/templates/History/HistoryList.js +14 -4
  69. package/build/esm/components/templates/History/HistoryList.js.map +1 -1
  70. package/build/esm/components/templates/History/i18n/en.json +3 -1
  71. package/build/esm/components/templates/History/i18n/index.d.ts +4 -4
  72. package/build/esm/components/templates/History/i18n/ru.json +3 -1
  73. package/build/esm/hooks/index.d.ts +1 -0
  74. package/build/esm/hooks/index.js +1 -0
  75. package/build/esm/hooks/index.js.map +1 -1
  76. package/build/esm/hooks/useChatActivity.d.ts +10 -0
  77. package/build/esm/hooks/useChatActivity.js +48 -0
  78. package/build/esm/hooks/useChatActivity.js.map +1 -0
  79. package/build/esm/package.json +1 -1
  80. package/build/esm/utils/chatActivityPersistence.d.ts +21 -0
  81. package/build/esm/utils/chatActivityPersistence.js +183 -0
  82. package/build/esm/utils/chatActivityPersistence.js.map +1 -0
  83. package/build/esm/utils/chatActivityStore.d.ts +59 -0
  84. package/build/esm/utils/chatActivityStore.js +107 -0
  85. package/build/esm/utils/chatActivityStore.js.map +1 -0
  86. package/build/esm/utils/index.d.ts +2 -0
  87. package/build/esm/utils/index.js +2 -0
  88. package/build/esm/utils/index.js.map +1 -1
  89. package/build/esm/utils/remoteChatActivityStore.d.ts +38 -0
  90. package/build/esm/utils/remoteChatActivityStore.js +124 -0
  91. package/build/esm/utils/remoteChatActivityStore.js.map +1 -0
  92. package/docs/chat-activity.md +158 -0
  93. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainer.js","sourceRoot":"../../../../../src","sources":["components/pages/ChatContainer/ChatContainer.tsx"],"names":[],"mappings":";;AAwMA,sCAmkBC;;;AA3wBD,iCAAiG;AAEjG,6CAA+E;AAE/E,mDAA8E;AAE9E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K,iBAAiB,EAAI,EACjC,KAAK,CAAC,UAAU,IAAI,CACjB,uBAAC,mCAAgB,oBAAK,UAAU,CAAC,WAAW,IAAE,QAAQ,EAAE,cAAc,IAAI,CAC7E,IACC,GACO,CACpB,CAAC;AACN,CAAC","sourcesContent":["import {type CSSProperties, Fragment, type ReactNode, useCallback, useMemo, useRef} from 'react';\n\nimport {Alert, MobileProvider, useForkRef, useMobile} from '@gravity-ui/uikit';\n\nimport {getMascotAnimationType, useKeyboardViewportFit} from '../../../hooks';\nimport type {TSuggestionContext} from '../../../types/messages';\nimport {block} from '../../../utils/cn';\nimport {getMascotNode, resolveMascotAssets, resolveMascotCollection} from '../../../utils/mascot';\nimport {Disclaimer} from '../../atoms/Disclaimer';\nimport {Header, HeaderAction, type HeaderProps} from '../../organisms/Header';\nimport {\n PromptInput,\n type PromptInputHandle,\n type PromptInputProps,\n} from '../../organisms/PromptInput';\nimport {ChatContent} from '../../templates/ChatContent/ChatContent';\nimport {History} from '../../templates/History';\n\nimport {ChatExportDialog} from './ChatExportDialog';\nimport {defaultGravityMascots} from './GravityMascot';\nimport {\n normalizeChatContainerQa,\n resolveChatContainerQa,\n resolveChatContainerRootQa,\n resolveHeaderMenuItemQa,\n} from './chatContainerQa';\nimport {i18n} from './i18n';\nimport type {ChatContainerProps, ChatContainerTexts, MascotConfig} from './types';\nimport {useChatContainer} from './useChatContainer';\nimport {useChatContainerMascot} from './useChatContainerMascot';\nimport {useChatExport} from './useChatExport';\nimport {useKeyboardLayoutFit} from './useKeyboardLayoutFit';\n\nimport './ChatContainer.scss';\n\nconst b = block('chat-container');\nconst DEFAULT_MASCOT_CONFIG: MascotConfig = {};\n\ntype NormalizedChatContainerQa = ReturnType<typeof normalizeChatContainerQa>;\n\nfunction toSuggestionContext(\n id?: string,\n data?: Record<string, unknown>,\n): TSuggestionContext | undefined {\n if (!id && !data) {\n return undefined;\n }\n\n return {\n ...(id && {id}),\n ...(data && {data}),\n };\n}\n\nfunction mergePromptInputSuggestionsProps(\n fromProps: PromptInputProps['suggestionsProps'] | undefined,\n textsSuggestTitle: ReactNode | undefined,\n): PromptInputProps['suggestionsProps'] | undefined {\n const hasSuggestionsFromProps = Boolean(fromProps);\n const hasSuggestTitleFromTexts = textsSuggestTitle !== undefined;\n if (!hasSuggestionsFromProps && !hasSuggestTitleFromTexts) {\n return undefined;\n }\n return {\n ...fromProps,\n suggestTitle: textsSuggestTitle ?? fromProps?.suggestTitle,\n };\n}\n\nfunction buildFinalPromptInputHeaderProps(args: {\n headerProps: NonNullable<ChatContainerProps['promptInputProps']>['headerProps'];\n contextItems: ChatContainerProps['contextItems'];\n showContextIndicator: ChatContainerProps['showContextIndicator'];\n contextIndicatorProps: ChatContainerProps['contextIndicatorProps'];\n qa: string | undefined;\n}): NonNullable<ChatContainerProps['promptInputProps']>['headerProps'] {\n const {headerProps, contextItems, showContextIndicator, contextIndicatorProps, qa} = args;\n\n // topContent replaces the default header entirely, so context-related\n // props are not allowed (and would be ignored) alongside it\n if (headerProps?.topContent) {\n return {topContent: headerProps.topContent, qa};\n }\n\n return {\n contextItems,\n showContextIndicator: showContextIndicator ?? headerProps?.showContextIndicator,\n contextIndicatorProps: contextIndicatorProps ?? headerProps?.contextIndicatorProps,\n qa,\n };\n}\n\nfunction buildFinalPromptInputProps(args: {\n t: ReturnType<typeof i18n.useTranslation>['t'];\n promptInputProps: ChatContainerProps['promptInputProps'];\n onSendMessage: ChatContainerProps['onSendMessage'];\n onCancel: ChatContainerProps['onCancel'];\n status: ChatContainerProps['status'];\n contextItems: ChatContainerProps['contextItems'];\n showContextIndicator: ChatContainerProps['showContextIndicator'];\n contextIndicatorProps: ChatContainerProps['contextIndicatorProps'];\n texts: ChatContainerTexts;\n promptInputKey: number;\n commandsResetKey: string | number;\n qaMap: NormalizedChatContainerQa;\n onValueChange?: (value: string) => void;\n}) {\n const {\n t,\n promptInputProps,\n onSendMessage,\n onCancel,\n status,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n texts: textsArg,\n promptInputKey,\n commandsResetKey,\n qaMap,\n onValueChange,\n } = args;\n\n const texts = textsArg ?? {};\n\n const {\n autoFocusOnNewChat: _autoFocusOnNewChat,\n autoFocusOnChatSelect: _autoFocusOnChatSelect,\n ...restBodyProps\n } = promptInputProps?.bodyProps ?? {};\n\n const suggestionsProps = mergePromptInputSuggestionsProps(\n promptInputProps?.suggestionsProps,\n texts.promptSuggestTitle,\n );\n\n return {\n ...promptInputProps,\n commandsResetKey,\n onValueChange:\n onValueChange || promptInputProps?.onValueChange\n ? (value: string) => {\n onValueChange?.(value);\n promptInputProps?.onValueChange?.(value);\n }\n : undefined,\n qa: resolveChatContainerQa(qaMap, 'promptInput', 'prompt-input') ?? promptInputProps?.qa,\n onSend: onSendMessage,\n onCancel,\n status,\n suggestionsProps,\n headerProps: buildFinalPromptInputHeaderProps({\n headerProps: promptInputProps?.headerProps,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n qa:\n resolveChatContainerQa(qaMap, 'promptInputHeader', 'prompt-input-header') ??\n promptInputProps?.headerProps?.qa,\n }),\n bodyProps: {\n ...restBodyProps,\n placeholder:\n texts.promptPlaceholder || restBodyProps?.placeholder || t('prompt-placeholder'),\n // The remount that clears the draft on a new or a freshly picked chat also puts the\n // cursor in the field. On a touch device that raises the keyboard over half the\n // screen, so a consumer that asked for no auto focus is taken at its word and keeps\n // the clearing without the cursor.\n autoFocus: restBodyProps?.autoFocus ?? promptInputKey > 0,\n qa:\n resolveChatContainerQa(qaMap, 'promptInputBody', 'prompt-input-body') ??\n restBodyProps?.qa,\n },\n footerProps: {\n ...promptInputProps?.footerProps,\n submitButtonTooltipSend:\n texts?.submitSendTooltip ?? promptInputProps?.footerProps?.submitButtonTooltipSend,\n submitButtonTooltipCancel:\n texts?.submitCancelTooltip ??\n promptInputProps?.footerProps?.submitButtonTooltipCancel,\n submitButtonCancelableText:\n texts?.submitButtonCancelableText ??\n promptInputProps?.footerProps?.submitButtonCancelableText,\n qa:\n resolveChatContainerQa(qaMap, 'promptInputFooter', 'prompt-input-footer') ??\n promptInputProps?.footerProps?.qa,\n submitButtonQa:\n resolveChatContainerQa(qaMap, 'submitButton', 'submit-button') ??\n promptInputProps?.footerProps?.submitButtonQa,\n },\n };\n}\n\n/**\n * ChatContainer - fully assembled chat component, the main exportable component of the library.\n * Integrates Header, ChatContent, History and manages their state.\n *\n * @param props - component props\n * @returns React component\n */\nexport function ChatContainer(props: ChatContainerProps) {\n const {t} = i18n.useTranslation();\n const {\n chats = [],\n messages = [],\n onSendMessage,\n onDeleteChat,\n onCancel,\n onRetry,\n status = 'ready',\n error = null,\n showActionsOnHover = false,\n contextItems = [],\n showContextIndicator,\n contextIndicatorProps,\n transformOptions,\n shouldParseIncompleteMarkdown,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxProps,\n messageListConfig,\n showMascot = false,\n mascotConfig: customMascotConfig,\n headerProps = {},\n contentProps = {},\n emptyContainerProps = {},\n promptInputProps = {},\n disclaimerProps = {},\n historyProps = {},\n welcomeConfig,\n texts = {},\n hideTitleOnEmptyChat = false,\n isMobile: isMobileProp,\n adjustToKeyboard = true,\n floatingHeader = false,\n className,\n headerClassName,\n contentClassName,\n footerClassName,\n qa,\n } = props;\n\n const isMobileContext = useMobile();\n const isMobile = isMobileProp ?? isMobileContext;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const viewportProbeRef = useRef<HTMLDivElement>(null);\n const isKeyboardTracked = isMobile && adjustToKeyboard;\n // Keeps the footer (prompt input + disclaimer) above the on-screen keyboard on iOS Safari,\n // where the layout viewport stays full-height while the keyboard is open.\n const {isKeyboardOpen, maxHeight} = useKeyboardViewportFit(rootRef, isKeyboardTracked, {\n viewportProbeRef,\n });\n // Measured at all times, not only while the keyboard is open: otherwise the field grows by\n // its own row counter while the keyboard is away, and by the next time it comes back the\n // field is already taller than the space left, with the cap long gone.\n const {promptInputMaxHeight, isHeroFitting} = useKeyboardLayoutFit(\n rootRef,\n headerRef,\n footerRef,\n isKeyboardTracked,\n );\n\n const hookState = useChatContainer(props);\n const chatExport = useChatExport({\n conversationKey: hookState.chatExportKey,\n chatId: props.activeChat?.id,\n messages,\n status,\n config: props.chatExport,\n });\n const exportFeedback = chatExport.notice && (\n <div role=\"status\">\n <Alert\n theme={chatExport.notice.error ? 'danger' : 'success'}\n message={chatExport.notice.text}\n onClose={chatExport.dismissNotice}\n />\n </div>\n );\n\n const mascotConfig = customMascotConfig ?? (showMascot ? DEFAULT_MASCOT_CONFIG : undefined);\n const mascotState = useChatContainerMascot({\n config: mascotConfig,\n view: hookState.chatContentView === 'empty' ? 'hero' : 'chat',\n status,\n messagesCount: messages.length,\n activeChatId: hookState.activeChat?.id,\n promptInputKey: hookState.promptInputKey,\n });\n\n const promptApiRef = useRef<PromptInputHandle>(null);\n const mergedPromptApiRef = useForkRef(promptApiRef, promptInputProps?.apiRef);\n\n const wrappedOnSendMessage = useCallback(\n async (...args: Parameters<typeof onSendMessage>) => {\n mascotState.notifyActivity();\n return onSendMessage(...args);\n },\n [mascotState.notifyActivity, onSendMessage],\n );\n const wrappedOnCancel = useMemo(() => {\n if (!onCancel) {\n return undefined;\n }\n return async () => {\n await onCancel();\n mascotState.handleCancelResolved();\n };\n }, [mascotState.handleCancelResolved, onCancel]);\n const wrappedOnRetry = useMemo(() => {\n if (!onRetry) {\n return undefined;\n }\n return () => {\n mascotState.notifyActivity();\n onRetry();\n };\n }, [mascotState.notifyActivity, onRetry]);\n\n const resolvedMascotAssets = useMemo(\n () => resolveMascotAssets(mascotConfig?.defaultAssets, mascotConfig?.assets),\n [mascotConfig?.assets, mascotConfig?.defaultAssets],\n );\n const resolvedMascots = useMemo(\n () =>\n resolveMascotCollection(\n resolveMascotCollection(\n showMascot ? defaultGravityMascots : undefined,\n mascotConfig?.defaultMascots,\n ),\n mascotConfig?.mascots,\n ),\n [showMascot, mascotConfig?.defaultMascots, mascotConfig?.mascots],\n );\n const mascotView = hookState.chatContentView === 'empty' ? 'hero' : 'chat';\n const mascotNode = useMemo(() => {\n if (!mascotConfig) {\n return undefined;\n }\n if (mascotView === 'hero' && mascotConfig.showOnWelcome === false) {\n return undefined;\n }\n if (mascotView === 'chat' && mascotConfig.showInChat === false) {\n return undefined;\n }\n const node = mascotConfig.renderMascot\n ? mascotConfig.renderMascot({\n view: mascotView,\n state: mascotState.state,\n animationType: getMascotAnimationType(mascotState.state),\n assets: resolvedMascotAssets,\n })\n : getMascotNode(resolvedMascots, mascotView, mascotState.state);\n if (node === undefined || node === null) {\n return undefined;\n }\n return <div className={b('mascot', {view: mascotView})}>{node}</div>;\n }, [mascotConfig, mascotState.state, mascotView, resolvedMascotAssets, resolvedMascots]);\n\n const qaMap = useMemo(() => normalizeChatContainerQa(qa), [qa]);\n\n // Collect i18n texts with overrides\n const headerTitle = useMemo(\n () =>\n texts.headerTitle ||\n headerProps.title ||\n hookState.activeChat?.name ||\n t('header-default-title'),\n [texts.headerTitle, headerProps.title, hookState.activeChat?.name, t],\n );\n\n // Determine if chat is empty\n const isChatEmpty = hookState.chatContentView === 'empty';\n\n // Calculate showTitle based on hideTitleOnEmptyChat option\n const showTitle = useMemo(() => {\n // If explicit showTitle is provided in headerProps, use it\n if (headerProps.showTitle !== undefined) {\n return headerProps.showTitle;\n }\n // If hideTitleOnEmptyChat is enabled, show title only when chat has messages\n if (hideTitleOnEmptyChat && isChatEmpty) {\n return false;\n }\n return true;\n }, [hideTitleOnEmptyChat, isChatEmpty, headerProps.showTitle]);\n\n // Build props for Header\n const finalHeaderProps = useMemo(() => {\n const actionQa: Partial<Record<HeaderAction, string>> = {\n ...headerProps.actionQa,\n };\n const setHeaderActionQa = (\n action: HeaderAction,\n key: 'headerNewChat' | 'headerHistory' | 'headerFolding' | 'headerClose',\n suffix: string,\n ) => {\n const resolved = resolveChatContainerQa(qaMap, key, suffix);\n if (resolved !== undefined) {\n actionQa[action] = resolved;\n }\n };\n setHeaderActionQa(HeaderAction.NewChat, 'headerNewChat', 'header-action-newChat');\n setHeaderActionQa(HeaderAction.History, 'headerHistory', 'header-action-history');\n setHeaderActionQa(HeaderAction.Folding, 'headerFolding', 'header-action-folding');\n setHeaderActionQa(HeaderAction.Close, 'headerClose', 'header-action-close');\n\n const actionTooltipTexts: NonNullable<HeaderProps['actionTooltipTexts']> = {\n [HeaderAction.NewChat]:\n texts.headerNewChatTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.NewChat],\n [HeaderAction.History]:\n texts.headerHistoryTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.History],\n [HeaderAction.Close]:\n texts.headerCloseTooltip ?? headerProps.actionTooltipTexts?.[HeaderAction.Close],\n [HeaderAction.Folding]: {\n collapsed:\n texts.headerFoldingCollapsedTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.Folding]?.collapsed,\n opened:\n texts.headerFoldingOpenedTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.Folding]?.opened,\n },\n };\n\n return {\n ...headerProps,\n title: headerTitle,\n showTitle,\n baseActions: hookState.baseActions,\n handleNewChat: hookState.handleNewChat,\n handleHistoryToggle: hookState.handleHistoryToggle,\n handleFolding: hookState.handleFolding,\n handleClose: hookState.handleClose,\n historyButtonRef: hookState.historyButtonRef,\n qa: resolveChatContainerQa(qaMap, 'header', 'header') ?? headerProps.qa,\n actionQa,\n actionTooltipTexts,\n menuButtonQa:\n resolveChatContainerQa(qaMap, 'headerMenuButton', 'header-menu-button') ??\n headerProps.menuButtonQa,\n menuButtonTooltip: texts.headerMenuTooltip ?? headerProps.menuButtonTooltip,\n menuItemQa: resolveHeaderMenuItemQa(\n qaMap,\n headerProps.menuItems,\n headerProps.menuItemQa,\n ),\n };\n }, [\n headerTitle,\n showTitle,\n hookState.baseActions,\n hookState.handleNewChat,\n hookState.handleHistoryToggle,\n hookState.handleFolding,\n hookState.handleClose,\n hookState.historyButtonRef,\n headerProps,\n qaMap,\n texts.headerNewChatTooltip,\n texts.headerHistoryTooltip,\n texts.headerCloseTooltip,\n texts.headerFoldingCollapsedTooltip,\n texts.headerFoldingOpenedTooltip,\n texts.headerMenuTooltip,\n ]);\n\n // Build props for EmptyContainer\n const finalEmptyContainerProps = useMemo(() => {\n const {showDefaultTitle = true, showDefaultDescription = true} = welcomeConfig || {};\n\n return {\n ...emptyContainerProps,\n qa:\n resolveChatContainerQa(qaMap, 'emptyState', 'empty-state') ??\n emptyContainerProps.qa,\n image: welcomeConfig?.image,\n title:\n texts.emptyStateTitle ??\n welcomeConfig?.title ??\n emptyContainerProps.title ??\n (showDefaultTitle ? t('empty-state-title') : undefined),\n description:\n texts.emptyStateDescription ??\n welcomeConfig?.description ??\n emptyContainerProps.description ??\n (showDefaultDescription ? t('empty-state-description') : undefined),\n suggestionTitle:\n texts.emptyStateSuggestionsTitle ??\n welcomeConfig?.suggestionTitle ??\n emptyContainerProps.suggestionTitle,\n suggestions: welcomeConfig?.suggestions,\n alignment: {\n ...emptyContainerProps.alignment,\n ...welcomeConfig?.alignment,\n ...(mascotView === 'hero' &&\n mascotNode &&\n emptyContainerProps.alignment?.hero === undefined &&\n welcomeConfig?.alignment?.hero === undefined\n ? {hero: 'center' as const}\n : {}),\n },\n heroContent:\n emptyContainerProps.heroContent ?? (mascotView === 'hero' ? mascotNode : undefined),\n layout: welcomeConfig?.layout ?? emptyContainerProps.layout,\n wrapText: welcomeConfig?.wrapText ?? emptyContainerProps.wrapText,\n showMore: welcomeConfig?.showMore,\n showMoreText:\n texts.emptyStateShowMoreText ??\n welcomeConfig?.showMoreText ??\n emptyContainerProps.showMoreText ??\n t('empty-state-show-more'),\n onSuggestionClick: async (\n content: string,\n suggestionId?: string,\n suggestionData?: Record<string, unknown>,\n ) => {\n const suggestion = toSuggestionContext(suggestionId, suggestionData);\n\n await promptApiRef.current?.submit({\n content,\n ...(suggestion && {suggestion}),\n });\n },\n };\n }, [\n welcomeConfig,\n emptyContainerProps,\n wrappedOnSendMessage,\n qaMap,\n texts.emptyStateTitle,\n texts.emptyStateDescription,\n texts.emptyStateSuggestionsTitle,\n texts.emptyStateShowMoreText,\n mascotNode,\n mascotView,\n t,\n ]);\n\n // Build props for MessageList\n const messageListProps = useMemo(\n () => ({\n ...messageListConfig,\n messages,\n status,\n errorMessage: texts.errorText\n ? {...(messageListConfig?.errorMessage ?? {}), text: texts.errorText}\n : messageListConfig?.errorMessage || (error ? {text: error.message} : undefined),\n onRetry: wrappedOnRetry,\n showActionsOnHover,\n transformOptions,\n shouldParseIncompleteMarkdown,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxProps,\n qa:\n resolveChatContainerQa(qaMap, 'messageList', 'message-list') ??\n messageListConfig?.qa,\n actionPopupProps: {\n ...messageListConfig?.actionPopupProps,\n qa:\n resolveChatContainerQa(qaMap, 'actionPopup', 'action-popup') ??\n messageListConfig?.actionPopupProps?.qa,\n },\n footerContent:\n mascotView === 'chat' && mascotNode !== undefined && mascotNode !== null ? (\n <Fragment>\n {messageListConfig?.footerContent}\n {mascotNode}\n </Fragment>\n ) : (\n messageListConfig?.footerContent\n ),\n }),\n [\n messages,\n status,\n error,\n wrappedOnRetry,\n showActionsOnHover,\n transformOptions,\n shouldParseIncompleteMarkdown,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxProps,\n messageListConfig,\n qaMap,\n texts.errorText,\n mascotNode,\n mascotView,\n ],\n );\n\n // Build props for PromptInput\n const finalPromptInputProps = useMemo(\n () =>\n buildFinalPromptInputProps({\n t,\n promptInputProps: {...promptInputProps, apiRef: mergedPromptApiRef},\n onSendMessage: wrappedOnSendMessage,\n onCancel: wrappedOnCancel,\n status,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n texts,\n promptInputKey: hookState.promptInputKey,\n commandsResetKey: hookState.commandsResetKey,\n qaMap,\n onValueChange: mascotConfig ? mascotState.handleValueChange : undefined,\n }),\n [\n wrappedOnSendMessage,\n wrappedOnCancel,\n status,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n promptInputProps,\n mergedPromptApiRef,\n hookState.promptInputKey,\n hookState.commandsResetKey,\n qaMap,\n texts.promptPlaceholder,\n texts.promptSuggestTitle,\n texts.submitSendTooltip,\n texts.submitCancelTooltip,\n texts.submitButtonCancelableText,\n mascotState.handleValueChange,\n mascotConfig,\n t,\n ],\n );\n\n // Build props for Disclaimer\n const finalDisclaimerProps = useMemo(() => {\n const disclaimerText = texts.disclaimerText ?? disclaimerProps.text ?? t('disclaimer-text');\n\n return {\n ...disclaimerProps,\n text: disclaimerText,\n qa: resolveChatContainerQa(qaMap, 'disclaimer', 'disclaimer') ?? disclaimerProps.qa,\n };\n }, [disclaimerProps, qaMap, texts.disclaimerText, t]);\n\n // Build props for ChatContent\n const finalContentProps = useMemo(\n () => ({\n ...contentProps,\n qa: resolveChatContainerQa(qaMap, 'content', 'content') ?? contentProps.qa,\n view: hookState.chatContentView as 'empty' | 'chat',\n emptyContainerProps: finalEmptyContainerProps,\n messageListProps,\n }),\n [\n hookState.chatContentView,\n finalEmptyContainerProps,\n messageListProps,\n contentProps,\n qaMap,\n ],\n );\n\n // Build props for History\n const finalHistoryProps = useMemo(\n () => ({\n ...historyProps,\n qa: resolveChatContainerQa(qaMap, 'history', 'history') ?? historyProps.qa,\n chats,\n selectedChat: hookState.activeChat,\n onSelectChat: hookState.handleSelectChat,\n onDeleteChat,\n open: hookState.isHistoryOpen,\n onOpenChange: (open: boolean) => {\n historyProps.onOpenChange?.(open);\n hookState.handleHistoryOpenChange(open);\n },\n anchorElement: hookState.historyButtonRef.current,\n emptyPlaceholder:\n texts.historyEmptyPlaceholder ??\n historyProps.emptyPlaceholder ??\n t('history-empty'),\n emptyFilteredPlaceholder:\n texts.historyEmptyFilteredPlaceholder ??\n historyProps.emptyFilteredPlaceholder ??\n t('history-empty-filtered'),\n searchPlaceholder: texts.historySearchPlaceholder ?? historyProps.searchPlaceholder,\n }),\n [\n chats,\n hookState.activeChat,\n hookState.handleSelectChat,\n onDeleteChat,\n hookState.isHistoryOpen,\n hookState.handleHistoryOpenChange,\n hookState.historyButtonRef,\n historyProps,\n qaMap,\n texts.historyEmptyPlaceholder,\n texts.historyEmptyFilteredPlaceholder,\n texts.historySearchPlaceholder,\n t,\n ],\n );\n\n const showFooter = finalPromptInputProps || finalDisclaimerProps;\n\n const rootStyle = useMemo<CSSProperties | undefined>(() => {\n if (maxHeight === undefined && promptInputMaxHeight === undefined && isHeroFitting) {\n return undefined;\n }\n\n return {\n ...(maxHeight === undefined ? undefined : {maxHeight}),\n ...(promptInputMaxHeight === undefined\n ? undefined\n : {\n '--g-aikit-prompt-input-body-textarea-max-height': `${promptInputMaxHeight}px`,\n }),\n ...(isHeroFitting\n ? undefined\n : {'--g-aikit-empty-container-hero-visibility': 'hidden'}),\n } as CSSProperties;\n }, [maxHeight, promptInputMaxHeight, isHeroFitting]);\n\n return (\n <MobileProvider mobile={isMobile}>\n <div\n ref={rootRef}\n className={b(\n {\n mobile: isMobile,\n 'keyboard-open': isKeyboardOpen,\n 'floating-header': floatingHeader,\n },\n className,\n )}\n style={rootStyle}\n data-qa={resolveChatContainerRootQa(qaMap)}\n >\n {isKeyboardTracked && (\n <div className={b('viewport-probe')} ref={viewportProbeRef} aria-hidden />\n )}\n <div className={b('header', headerClassName)} ref={headerRef}>\n <Header\n {...finalHeaderProps}\n menuItems={[...(finalHeaderProps.menuItems ?? []), ...chatExport.menuItems]}\n />\n {!chatExport.dialogProps.open && exportFeedback}\n </div>\n <div className={b('content', {view: hookState.chatContentView}, contentClassName)}>\n <ChatContent {...finalContentProps} />\n </div>\n {showFooter && (\n <div\n className={b('footer', {view: hookState.chatContentView}, footerClassName)}\n ref={footerRef}\n >\n {finalPromptInputProps && (\n <PromptInput\n key={hookState.promptInputKey}\n {...finalPromptInputProps}\n />\n )}\n {finalDisclaimerProps && <Disclaimer {...finalDisclaimerProps} />}\n </div>\n )}\n {/* History is integrated via popup anchored to button in Header */}\n <History {...finalHistoryProps} />\n {props.chatExport && (\n <ChatExportDialog {...chatExport.dialogProps} feedback={exportFeedback} />\n )}\n </div>\n </MobileProvider>\n );\n}\n"]}
1
+ {"version":3,"file":"ChatContainer.js","sourceRoot":"../../../../../src","sources":["components/pages/ChatContainer/ChatContainer.tsx"],"names":[],"mappings":";;AAyMA,sCA8kBC;;;AAvxBD,iCAAiG;AAEjG,6CAA+E;AAE/E,mDAA8E;AAC9E,uEAA+D;AAE/D,6CAAwC;AACxC,qDAAkG;AAClG,gEAAkD;AAClD,4DAA8E;AAC9E,sEAIqC;AACrC,4EAAoE;AACpE,8DAAgD;AAEhD,4DAAoD;AACpD,sDAAsD;AACtD,0DAK2B;AAC3B,0CAA4B;AAE5B,4DAAoD;AACpD,wEAAgE;AAChE,sDAA8C;AAC9C,oEAA4D;AAE5D,+BAA8B;AAE9B,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,gBAAgB,CAAC,CAAC;AAClC,MAAM,qBAAqB,GAAiB,EAAE,CAAC;AAI/C,SAAS,mBAAmB,CACxB,EAAW,EACX,IAA8B;IAE9B,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,uCACO,CAAC,EAAE,IAAI,EAAC,EAAE,EAAC,CAAC,GACZ,CAAC,IAAI,IAAI,EAAC,IAAI,EAAC,CAAC,EACrB;AACN,CAAC;AAED,SAAS,gCAAgC,CACrC,SAA2D,EAC3D,iBAAwC;IAExC,MAAM,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACnD,MAAM,wBAAwB,GAAG,iBAAiB,KAAK,SAAS,CAAC;IACjE,IAAI,CAAC,uBAAuB,IAAI,CAAC,wBAAwB,EAAE,CAAC;QACxD,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,uCACO,SAAS,KACZ,YAAY,EAAE,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,YAAY,IAC5D;AAC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wBAAgB,CAC7E,EACD,iCAAK,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,SAAS,aACxD,uBAAC,eAAM,oBACC,gBAAgB,IACpB,SAAS,EAAE,CAAC,GAAG,CAAC,MAAA,gBAAgB,CAAC,SAAS,mCAAI,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,IAC7E,EACD,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,IAAI,cAAc,IAC7C,EACN,gCAAK,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,EAAC,IAAI,EAAE,SAAS,CAAC,eAAe,EAAC,EAAE,gBAAgB,CAAC,YAC7E,uBAAC,yBAAW,oBAAK,iBAAiB,EAAI,GACpC,EACL,UAAU,IAAI,CACX,iCACI,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,SAAS,CAAC,eAAe,EAAC,EAAE,eAAe,CAAC,EAC1E,GAAG,EAAE,SAAS,aAEb,qBAAqB,IAAI,CACtB,uBAAC,yBAAW,oBAEJ,qBAAqB,GADpB,SAAS,CAAC,cAAc,CAE/B,CACL,EACA,oBAAoB,IAAI,uBAAC,uBAAU,oBAAK,oBAAoB,EAAI,IAC/D,CACT,EAED,uBAAC,iBAAO,oBAAK,iBAAiB,EAAI,EACjC,KAAK,CAAC,UAAU,IAAI,CACjB,uBAAC,mCAAgB,oBAAK,UAAU,CAAC,WAAW,IAAE,QAAQ,EAAE,cAAc,IAAI,CAC7E,IACC,GACO,CACpB,CAAC;AACN,CAAC","sourcesContent":["import {type CSSProperties, Fragment, type ReactNode, useCallback, useMemo, useRef} from 'react';\n\nimport {Alert, MobileProvider, useForkRef, useMobile} from '@gravity-ui/uikit';\n\nimport {getMascotAnimationType, useKeyboardViewportFit} from '../../../hooks';\nimport {useChatActivity} from '../../../hooks/useChatActivity';\nimport type {TSuggestionContext} from '../../../types/messages';\nimport {block} from '../../../utils/cn';\nimport {getMascotNode, resolveMascotAssets, resolveMascotCollection} from '../../../utils/mascot';\nimport {Disclaimer} from '../../atoms/Disclaimer';\nimport {Header, HeaderAction, type HeaderProps} from '../../organisms/Header';\nimport {\n PromptInput,\n type PromptInputHandle,\n type PromptInputProps,\n} from '../../organisms/PromptInput';\nimport {ChatContent} from '../../templates/ChatContent/ChatContent';\nimport {History} from '../../templates/History';\n\nimport {ChatExportDialog} from './ChatExportDialog';\nimport {defaultGravityMascots} from './GravityMascot';\nimport {\n normalizeChatContainerQa,\n resolveChatContainerQa,\n resolveChatContainerRootQa,\n resolveHeaderMenuItemQa,\n} from './chatContainerQa';\nimport {i18n} from './i18n';\nimport type {ChatContainerProps, ChatContainerTexts, MascotConfig} from './types';\nimport {useChatContainer} from './useChatContainer';\nimport {useChatContainerMascot} from './useChatContainerMascot';\nimport {useChatExport} from './useChatExport';\nimport {useKeyboardLayoutFit} from './useKeyboardLayoutFit';\n\nimport './ChatContainer.scss';\n\nconst b = block('chat-container');\nconst DEFAULT_MASCOT_CONFIG: MascotConfig = {};\n\ntype NormalizedChatContainerQa = ReturnType<typeof normalizeChatContainerQa>;\n\nfunction toSuggestionContext(\n id?: string,\n data?: Record<string, unknown>,\n): TSuggestionContext | undefined {\n if (!id && !data) {\n return undefined;\n }\n\n return {\n ...(id && {id}),\n ...(data && {data}),\n };\n}\n\nfunction mergePromptInputSuggestionsProps(\n fromProps: PromptInputProps['suggestionsProps'] | undefined,\n textsSuggestTitle: ReactNode | undefined,\n): PromptInputProps['suggestionsProps'] | undefined {\n const hasSuggestionsFromProps = Boolean(fromProps);\n const hasSuggestTitleFromTexts = textsSuggestTitle !== undefined;\n if (!hasSuggestionsFromProps && !hasSuggestTitleFromTexts) {\n return undefined;\n }\n return {\n ...fromProps,\n suggestTitle: textsSuggestTitle ?? fromProps?.suggestTitle,\n };\n}\n\nfunction buildFinalPromptInputHeaderProps(args: {\n headerProps: NonNullable<ChatContainerProps['promptInputProps']>['headerProps'];\n contextItems: ChatContainerProps['contextItems'];\n showContextIndicator: ChatContainerProps['showContextIndicator'];\n contextIndicatorProps: ChatContainerProps['contextIndicatorProps'];\n qa: string | undefined;\n}): NonNullable<ChatContainerProps['promptInputProps']>['headerProps'] {\n const {headerProps, contextItems, showContextIndicator, contextIndicatorProps, qa} = args;\n\n // topContent replaces the default header entirely, so context-related\n // props are not allowed (and would be ignored) alongside it\n if (headerProps?.topContent) {\n return {topContent: headerProps.topContent, qa};\n }\n\n return {\n contextItems,\n showContextIndicator: showContextIndicator ?? headerProps?.showContextIndicator,\n contextIndicatorProps: contextIndicatorProps ?? headerProps?.contextIndicatorProps,\n qa,\n };\n}\n\nfunction buildFinalPromptInputProps(args: {\n t: ReturnType<typeof i18n.useTranslation>['t'];\n promptInputProps: ChatContainerProps['promptInputProps'];\n onSendMessage: ChatContainerProps['onSendMessage'];\n onCancel: ChatContainerProps['onCancel'];\n status: ChatContainerProps['status'];\n contextItems: ChatContainerProps['contextItems'];\n showContextIndicator: ChatContainerProps['showContextIndicator'];\n contextIndicatorProps: ChatContainerProps['contextIndicatorProps'];\n texts: ChatContainerTexts;\n promptInputKey: number;\n commandsResetKey: string | number;\n qaMap: NormalizedChatContainerQa;\n onValueChange?: (value: string) => void;\n}) {\n const {\n t,\n promptInputProps,\n onSendMessage,\n onCancel,\n status,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n texts: textsArg,\n promptInputKey,\n commandsResetKey,\n qaMap,\n onValueChange,\n } = args;\n\n const texts = textsArg ?? {};\n\n const {\n autoFocusOnNewChat: _autoFocusOnNewChat,\n autoFocusOnChatSelect: _autoFocusOnChatSelect,\n ...restBodyProps\n } = promptInputProps?.bodyProps ?? {};\n\n const suggestionsProps = mergePromptInputSuggestionsProps(\n promptInputProps?.suggestionsProps,\n texts.promptSuggestTitle,\n );\n\n return {\n ...promptInputProps,\n commandsResetKey,\n onValueChange:\n onValueChange || promptInputProps?.onValueChange\n ? (value: string) => {\n onValueChange?.(value);\n promptInputProps?.onValueChange?.(value);\n }\n : undefined,\n qa: resolveChatContainerQa(qaMap, 'promptInput', 'prompt-input') ?? promptInputProps?.qa,\n onSend: onSendMessage,\n onCancel,\n status,\n suggestionsProps,\n headerProps: buildFinalPromptInputHeaderProps({\n headerProps: promptInputProps?.headerProps,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n qa:\n resolveChatContainerQa(qaMap, 'promptInputHeader', 'prompt-input-header') ??\n promptInputProps?.headerProps?.qa,\n }),\n bodyProps: {\n ...restBodyProps,\n placeholder:\n texts.promptPlaceholder || restBodyProps?.placeholder || t('prompt-placeholder'),\n // The remount that clears the draft on a new or a freshly picked chat also puts the\n // cursor in the field. On a touch device that raises the keyboard over half the\n // screen, so a consumer that asked for no auto focus is taken at its word and keeps\n // the clearing without the cursor.\n autoFocus: restBodyProps?.autoFocus ?? promptInputKey > 0,\n qa:\n resolveChatContainerQa(qaMap, 'promptInputBody', 'prompt-input-body') ??\n restBodyProps?.qa,\n },\n footerProps: {\n ...promptInputProps?.footerProps,\n submitButtonTooltipSend:\n texts?.submitSendTooltip ?? promptInputProps?.footerProps?.submitButtonTooltipSend,\n submitButtonTooltipCancel:\n texts?.submitCancelTooltip ??\n promptInputProps?.footerProps?.submitButtonTooltipCancel,\n submitButtonCancelableText:\n texts?.submitButtonCancelableText ??\n promptInputProps?.footerProps?.submitButtonCancelableText,\n qa:\n resolveChatContainerQa(qaMap, 'promptInputFooter', 'prompt-input-footer') ??\n promptInputProps?.footerProps?.qa,\n submitButtonQa:\n resolveChatContainerQa(qaMap, 'submitButton', 'submit-button') ??\n promptInputProps?.footerProps?.submitButtonQa,\n },\n };\n}\n\n/**\n * ChatContainer - fully assembled chat component, the main exportable component of the library.\n * Integrates Header, ChatContent, History and manages their state.\n *\n * @param props - component props\n * @returns React component\n */\nexport function ChatContainer(props: ChatContainerProps) {\n const {t} = i18n.useTranslation();\n const {\n chats = [],\n messages = [],\n onSendMessage,\n onDeleteChat,\n onCancel,\n onRetry,\n status = 'ready',\n error = null,\n showActionsOnHover = false,\n contextItems = [],\n showContextIndicator,\n contextIndicatorProps,\n transformOptions,\n shouldParseIncompleteMarkdown,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxProps,\n messageListConfig,\n showMascot = false,\n mascotConfig: customMascotConfig,\n headerProps = {},\n contentProps = {},\n emptyContainerProps = {},\n promptInputProps = {},\n disclaimerProps = {},\n historyProps = {},\n welcomeConfig,\n texts = {},\n hideTitleOnEmptyChat = false,\n isMobile: isMobileProp,\n adjustToKeyboard = true,\n floatingHeader = false,\n className,\n headerClassName,\n contentClassName,\n footerClassName,\n qa,\n } = props;\n\n const isMobileContext = useMobile();\n const isMobile = isMobileProp ?? isMobileContext;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const footerRef = useRef<HTMLDivElement>(null);\n const viewportProbeRef = useRef<HTMLDivElement>(null);\n const isKeyboardTracked = isMobile && adjustToKeyboard;\n // Keeps the footer (prompt input + disclaimer) above the on-screen keyboard on iOS Safari,\n // where the layout viewport stays full-height while the keyboard is open.\n const {isKeyboardOpen, maxHeight} = useKeyboardViewportFit(rootRef, isKeyboardTracked, {\n viewportProbeRef,\n });\n // Measured at all times, not only while the keyboard is open: otherwise the field grows by\n // its own row counter while the keyboard is away, and by the next time it comes back the\n // field is already taller than the space left, with the cap long gone.\n const {promptInputMaxHeight, isHeroFitting} = useKeyboardLayoutFit(\n rootRef,\n headerRef,\n footerRef,\n isKeyboardTracked,\n );\n\n const hookState = useChatContainer(props);\n const chatActivity = useChatActivity(props.chatActivity?.store, {\n chatId: hookState.activeChat?.id,\n isPanelVisible: props.chatActivity?.isPanelVisible ?? false,\n renderedResponseId: props.chatActivity?.renderedResponseId,\n });\n\n const chatExport = useChatExport({\n conversationKey: hookState.chatExportKey,\n chatId: props.activeChat?.id,\n messages,\n status,\n config: props.chatExport,\n });\n const exportFeedback = chatExport.notice && (\n <div role=\"status\">\n <Alert\n theme={chatExport.notice.error ? 'danger' : 'success'}\n message={chatExport.notice.text}\n onClose={chatExport.dismissNotice}\n />\n </div>\n );\n\n const mascotConfig = customMascotConfig ?? (showMascot ? DEFAULT_MASCOT_CONFIG : undefined);\n const mascotState = useChatContainerMascot({\n config: mascotConfig,\n view: hookState.chatContentView === 'empty' ? 'hero' : 'chat',\n status,\n messagesCount: messages.length,\n activeChatId: hookState.activeChat?.id,\n promptInputKey: hookState.promptInputKey,\n });\n\n const promptApiRef = useRef<PromptInputHandle>(null);\n const mergedPromptApiRef = useForkRef(promptApiRef, promptInputProps?.apiRef);\n\n const wrappedOnSendMessage = useCallback(\n async (...args: Parameters<typeof onSendMessage>) => {\n mascotState.notifyActivity();\n return onSendMessage(...args);\n },\n [mascotState.notifyActivity, onSendMessage],\n );\n const wrappedOnCancel = useMemo(() => {\n if (!onCancel) {\n return undefined;\n }\n return async () => {\n await onCancel();\n mascotState.handleCancelResolved();\n };\n }, [mascotState.handleCancelResolved, onCancel]);\n const wrappedOnRetry = useMemo(() => {\n if (!onRetry) {\n return undefined;\n }\n return () => {\n mascotState.notifyActivity();\n onRetry();\n };\n }, [mascotState.notifyActivity, onRetry]);\n\n const resolvedMascotAssets = useMemo(\n () => resolveMascotAssets(mascotConfig?.defaultAssets, mascotConfig?.assets),\n [mascotConfig?.assets, mascotConfig?.defaultAssets],\n );\n const resolvedMascots = useMemo(\n () =>\n resolveMascotCollection(\n resolveMascotCollection(\n showMascot ? defaultGravityMascots : undefined,\n mascotConfig?.defaultMascots,\n ),\n mascotConfig?.mascots,\n ),\n [showMascot, mascotConfig?.defaultMascots, mascotConfig?.mascots],\n );\n const mascotView = hookState.chatContentView === 'empty' ? 'hero' : 'chat';\n const mascotNode = useMemo(() => {\n if (!mascotConfig) {\n return undefined;\n }\n if (mascotView === 'hero' && mascotConfig.showOnWelcome === false) {\n return undefined;\n }\n if (mascotView === 'chat' && mascotConfig.showInChat === false) {\n return undefined;\n }\n const node = mascotConfig.renderMascot\n ? mascotConfig.renderMascot({\n view: mascotView,\n state: mascotState.state,\n animationType: getMascotAnimationType(mascotState.state),\n assets: resolvedMascotAssets,\n })\n : getMascotNode(resolvedMascots, mascotView, mascotState.state);\n if (node === undefined || node === null) {\n return undefined;\n }\n return <div className={b('mascot', {view: mascotView})}>{node}</div>;\n }, [mascotConfig, mascotState.state, mascotView, resolvedMascotAssets, resolvedMascots]);\n\n const qaMap = useMemo(() => normalizeChatContainerQa(qa), [qa]);\n\n // Collect i18n texts with overrides\n const headerTitle = useMemo(\n () =>\n texts.headerTitle ||\n headerProps.title ||\n hookState.activeChat?.name ||\n t('header-default-title'),\n [texts.headerTitle, headerProps.title, hookState.activeChat?.name, t],\n );\n\n // Determine if chat is empty\n const isChatEmpty = hookState.chatContentView === 'empty';\n\n // Calculate showTitle based on hideTitleOnEmptyChat option\n const showTitle = useMemo(() => {\n // If explicit showTitle is provided in headerProps, use it\n if (headerProps.showTitle !== undefined) {\n return headerProps.showTitle;\n }\n // If hideTitleOnEmptyChat is enabled, show title only when chat has messages\n if (hideTitleOnEmptyChat && isChatEmpty) {\n return false;\n }\n return true;\n }, [hideTitleOnEmptyChat, isChatEmpty, headerProps.showTitle]);\n\n // Build props for Header\n const finalHeaderProps = useMemo(() => {\n const actionQa: Partial<Record<HeaderAction, string>> = {\n ...headerProps.actionQa,\n };\n const setHeaderActionQa = (\n action: HeaderAction,\n key: 'headerNewChat' | 'headerHistory' | 'headerFolding' | 'headerClose',\n suffix: string,\n ) => {\n const resolved = resolveChatContainerQa(qaMap, key, suffix);\n if (resolved !== undefined) {\n actionQa[action] = resolved;\n }\n };\n setHeaderActionQa(HeaderAction.NewChat, 'headerNewChat', 'header-action-newChat');\n setHeaderActionQa(HeaderAction.History, 'headerHistory', 'header-action-history');\n setHeaderActionQa(HeaderAction.Folding, 'headerFolding', 'header-action-folding');\n setHeaderActionQa(HeaderAction.Close, 'headerClose', 'header-action-close');\n\n const actionTooltipTexts: NonNullable<HeaderProps['actionTooltipTexts']> = {\n [HeaderAction.NewChat]:\n texts.headerNewChatTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.NewChat],\n [HeaderAction.History]:\n texts.headerHistoryTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.History],\n [HeaderAction.Close]:\n texts.headerCloseTooltip ?? headerProps.actionTooltipTexts?.[HeaderAction.Close],\n [HeaderAction.Folding]: {\n collapsed:\n texts.headerFoldingCollapsedTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.Folding]?.collapsed,\n opened:\n texts.headerFoldingOpenedTooltip ??\n headerProps.actionTooltipTexts?.[HeaderAction.Folding]?.opened,\n },\n };\n\n return {\n ...headerProps,\n historyActivity: props.chatActivity ? chatActivity : headerProps.historyActivity,\n title: headerTitle,\n showTitle,\n baseActions: hookState.baseActions,\n handleNewChat: hookState.handleNewChat,\n handleHistoryToggle: hookState.handleHistoryToggle,\n handleFolding: hookState.handleFolding,\n handleClose: hookState.handleClose,\n historyButtonRef: hookState.historyButtonRef,\n qa: resolveChatContainerQa(qaMap, 'header', 'header') ?? headerProps.qa,\n actionQa,\n actionTooltipTexts,\n menuButtonQa:\n resolveChatContainerQa(qaMap, 'headerMenuButton', 'header-menu-button') ??\n headerProps.menuButtonQa,\n menuButtonTooltip: texts.headerMenuTooltip ?? headerProps.menuButtonTooltip,\n menuItemQa: resolveHeaderMenuItemQa(\n qaMap,\n headerProps.menuItems,\n headerProps.menuItemQa,\n ),\n };\n }, [\n headerTitle,\n props.chatActivity,\n chatActivity,\n showTitle,\n hookState.baseActions,\n hookState.handleNewChat,\n hookState.handleHistoryToggle,\n hookState.handleFolding,\n hookState.handleClose,\n hookState.historyButtonRef,\n headerProps,\n qaMap,\n texts.headerNewChatTooltip,\n texts.headerHistoryTooltip,\n texts.headerCloseTooltip,\n texts.headerFoldingCollapsedTooltip,\n texts.headerFoldingOpenedTooltip,\n texts.headerMenuTooltip,\n ]);\n\n // Build props for EmptyContainer\n const finalEmptyContainerProps = useMemo(() => {\n const {showDefaultTitle = true, showDefaultDescription = true} = welcomeConfig || {};\n\n return {\n ...emptyContainerProps,\n qa:\n resolveChatContainerQa(qaMap, 'emptyState', 'empty-state') ??\n emptyContainerProps.qa,\n image: welcomeConfig?.image,\n title:\n texts.emptyStateTitle ??\n welcomeConfig?.title ??\n emptyContainerProps.title ??\n (showDefaultTitle ? t('empty-state-title') : undefined),\n description:\n texts.emptyStateDescription ??\n welcomeConfig?.description ??\n emptyContainerProps.description ??\n (showDefaultDescription ? t('empty-state-description') : undefined),\n suggestionTitle:\n texts.emptyStateSuggestionsTitle ??\n welcomeConfig?.suggestionTitle ??\n emptyContainerProps.suggestionTitle,\n suggestions: welcomeConfig?.suggestions,\n alignment: {\n ...emptyContainerProps.alignment,\n ...welcomeConfig?.alignment,\n ...(mascotView === 'hero' &&\n mascotNode &&\n emptyContainerProps.alignment?.hero === undefined &&\n welcomeConfig?.alignment?.hero === undefined\n ? {hero: 'center' as const}\n : {}),\n },\n heroContent:\n emptyContainerProps.heroContent ?? (mascotView === 'hero' ? mascotNode : undefined),\n layout: welcomeConfig?.layout ?? emptyContainerProps.layout,\n wrapText: welcomeConfig?.wrapText ?? emptyContainerProps.wrapText,\n showMore: welcomeConfig?.showMore,\n showMoreText:\n texts.emptyStateShowMoreText ??\n welcomeConfig?.showMoreText ??\n emptyContainerProps.showMoreText ??\n t('empty-state-show-more'),\n onSuggestionClick: async (\n content: string,\n suggestionId?: string,\n suggestionData?: Record<string, unknown>,\n ) => {\n const suggestion = toSuggestionContext(suggestionId, suggestionData);\n\n await promptApiRef.current?.submit({\n content,\n ...(suggestion && {suggestion}),\n });\n },\n };\n }, [\n welcomeConfig,\n emptyContainerProps,\n wrappedOnSendMessage,\n qaMap,\n texts.emptyStateTitle,\n texts.emptyStateDescription,\n texts.emptyStateSuggestionsTitle,\n texts.emptyStateShowMoreText,\n mascotNode,\n mascotView,\n t,\n ]);\n\n // Build props for MessageList\n const messageListProps = useMemo(\n () => ({\n ...messageListConfig,\n messages,\n status,\n errorMessage: texts.errorText\n ? {...(messageListConfig?.errorMessage ?? {}), text: texts.errorText}\n : messageListConfig?.errorMessage || (error ? {text: error.message} : undefined),\n onRetry: wrappedOnRetry,\n showActionsOnHover,\n transformOptions,\n shouldParseIncompleteMarkdown,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxProps,\n qa:\n resolveChatContainerQa(qaMap, 'messageList', 'message-list') ??\n messageListConfig?.qa,\n actionPopupProps: {\n ...messageListConfig?.actionPopupProps,\n qa:\n resolveChatContainerQa(qaMap, 'actionPopup', 'action-popup') ??\n messageListConfig?.actionPopupProps?.qa,\n },\n footerContent:\n mascotView === 'chat' && mascotNode !== undefined && mascotNode !== null ? (\n <Fragment>\n {messageListConfig?.footerContent}\n {mascotNode}\n </Fragment>\n ) : (\n messageListConfig?.footerContent\n ),\n }),\n [\n messages,\n status,\n error,\n wrappedOnRetry,\n showActionsOnHover,\n transformOptions,\n shouldParseIncompleteMarkdown,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxProps,\n messageListConfig,\n qaMap,\n texts.errorText,\n mascotNode,\n mascotView,\n ],\n );\n\n // Build props for PromptInput\n const finalPromptInputProps = useMemo(\n () =>\n buildFinalPromptInputProps({\n t,\n promptInputProps: {...promptInputProps, apiRef: mergedPromptApiRef},\n onSendMessage: wrappedOnSendMessage,\n onCancel: wrappedOnCancel,\n status,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n texts,\n promptInputKey: hookState.promptInputKey,\n commandsResetKey: hookState.commandsResetKey,\n qaMap,\n onValueChange: mascotConfig ? mascotState.handleValueChange : undefined,\n }),\n [\n wrappedOnSendMessage,\n wrappedOnCancel,\n status,\n contextItems,\n showContextIndicator,\n contextIndicatorProps,\n promptInputProps,\n mergedPromptApiRef,\n hookState.promptInputKey,\n hookState.commandsResetKey,\n qaMap,\n texts.promptPlaceholder,\n texts.promptSuggestTitle,\n texts.submitSendTooltip,\n texts.submitCancelTooltip,\n texts.submitButtonCancelableText,\n mascotState.handleValueChange,\n mascotConfig,\n t,\n ],\n );\n\n // Build props for Disclaimer\n const finalDisclaimerProps = useMemo(() => {\n const disclaimerText = texts.disclaimerText ?? disclaimerProps.text ?? t('disclaimer-text');\n\n return {\n ...disclaimerProps,\n text: disclaimerText,\n qa: resolveChatContainerQa(qaMap, 'disclaimer', 'disclaimer') ?? disclaimerProps.qa,\n };\n }, [disclaimerProps, qaMap, texts.disclaimerText, t]);\n\n // Build props for ChatContent\n const finalContentProps = useMemo(\n () => ({\n ...contentProps,\n qa: resolveChatContainerQa(qaMap, 'content', 'content') ?? contentProps.qa,\n view: hookState.chatContentView as 'empty' | 'chat',\n emptyContainerProps: finalEmptyContainerProps,\n messageListProps,\n }),\n [\n hookState.chatContentView,\n finalEmptyContainerProps,\n messageListProps,\n contentProps,\n qaMap,\n ],\n );\n\n // Build props for History\n const finalHistoryProps = useMemo(\n () => ({\n ...historyProps,\n qa: resolveChatContainerQa(qaMap, 'history', 'history') ?? historyProps.qa,\n chats,\n activityStore: props.chatActivity?.store ?? historyProps.activityStore,\n selectedChat: hookState.activeChat,\n onSelectChat: hookState.handleSelectChat,\n onDeleteChat,\n open: hookState.isHistoryOpen,\n onOpenChange: (open: boolean) => {\n historyProps.onOpenChange?.(open);\n hookState.handleHistoryOpenChange(open);\n },\n anchorElement: hookState.historyButtonRef.current,\n emptyPlaceholder:\n texts.historyEmptyPlaceholder ??\n historyProps.emptyPlaceholder ??\n t('history-empty'),\n emptyFilteredPlaceholder:\n texts.historyEmptyFilteredPlaceholder ??\n historyProps.emptyFilteredPlaceholder ??\n t('history-empty-filtered'),\n searchPlaceholder: texts.historySearchPlaceholder ?? historyProps.searchPlaceholder,\n }),\n [\n chats,\n props.chatActivity?.store,\n hookState.activeChat,\n hookState.handleSelectChat,\n onDeleteChat,\n hookState.isHistoryOpen,\n hookState.handleHistoryOpenChange,\n hookState.historyButtonRef,\n historyProps,\n qaMap,\n texts.historyEmptyPlaceholder,\n texts.historyEmptyFilteredPlaceholder,\n texts.historySearchPlaceholder,\n t,\n ],\n );\n\n const showFooter = finalPromptInputProps || finalDisclaimerProps;\n\n const rootStyle = useMemo<CSSProperties | undefined>(() => {\n if (maxHeight === undefined && promptInputMaxHeight === undefined && isHeroFitting) {\n return undefined;\n }\n\n return {\n ...(maxHeight === undefined ? undefined : {maxHeight}),\n ...(promptInputMaxHeight === undefined\n ? undefined\n : {\n '--g-aikit-prompt-input-body-textarea-max-height': `${promptInputMaxHeight}px`,\n }),\n ...(isHeroFitting\n ? undefined\n : {'--g-aikit-empty-container-hero-visibility': 'hidden'}),\n } as CSSProperties;\n }, [maxHeight, promptInputMaxHeight, isHeroFitting]);\n\n return (\n <MobileProvider mobile={isMobile}>\n <div\n ref={rootRef}\n className={b(\n {\n mobile: isMobile,\n 'keyboard-open': isKeyboardOpen,\n 'floating-header': floatingHeader,\n },\n className,\n )}\n style={rootStyle}\n data-qa={resolveChatContainerRootQa(qaMap)}\n >\n {isKeyboardTracked && (\n <div className={b('viewport-probe')} ref={viewportProbeRef} aria-hidden />\n )}\n <div className={b('header', headerClassName)} ref={headerRef}>\n <Header\n {...finalHeaderProps}\n menuItems={[...(finalHeaderProps.menuItems ?? []), ...chatExport.menuItems]}\n />\n {!chatExport.dialogProps.open && exportFeedback}\n </div>\n <div className={b('content', {view: hookState.chatContentView}, contentClassName)}>\n <ChatContent {...finalContentProps} />\n </div>\n {showFooter && (\n <div\n className={b('footer', {view: hookState.chatContentView}, footerClassName)}\n ref={footerRef}\n >\n {finalPromptInputProps && (\n <PromptInput\n key={hookState.promptInputKey}\n {...finalPromptInputProps}\n />\n )}\n {finalDisclaimerProps && <Disclaimer {...finalDisclaimerProps} />}\n </div>\n )}\n {/* History is integrated via popup anchored to button in Header */}\n <History {...finalHistoryProps} />\n {props.chatExport && (\n <ChatExportDialog {...chatExport.dialogProps} feedback={exportFeedback} />\n )}\n </div>\n </MobileProvider>\n );\n}\n"]}
@@ -3,6 +3,7 @@ import { MdxProps, MessageListProps } from "../../organisms/MessageList/index.js
3
3
  import type { MermaidOptions } from "../../../markdown/types.js";
4
4
  import type { ChatStatus, ChatType, MascotAssets, MascotCollection, MascotRenderContext, MascotState, TChatMessage, TSubmitData } from "../../../types/index.js";
5
5
  import type { SuggestionsItem } from "../../../types/common.js";
6
+ import type { ChatActivityStore } from "../../../utils/chatActivityStore.js";
6
7
  import type { ChatMarkdownOptions } from "../../../utils/chatMarkdown.js";
7
8
  import type { ContextIndicatorProps } from "../../atoms/ContextIndicator/index.js";
8
9
  import type { DisclaimerProps } from "../../atoms/Disclaimer/index.js";
@@ -178,6 +179,14 @@ export interface ChatExportConfig extends ChatMarkdownOptions {
178
179
  * Props for ChatContainer component
179
180
  */
180
181
  export interface ChatContainerProps {
182
+ /** Stable account-scoped activity source; accepts local and server-backed stores. */
183
+ chatActivity?: {
184
+ store: ChatActivityStore;
185
+ /** False while the host panel is closed or collapsed. */
186
+ isPanelVisible: boolean;
187
+ /** The completed response actually rendered for activeChat; omit while loading it. */
188
+ renderedResponseId?: string;
189
+ };
181
190
  /** Opt-in Markdown export. Supply complete history in messages, including off-screen messages. */
182
191
  chatExport?: ChatExportConfig;
183
192
  /** Array of chats for history */
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/pages/ChatContainer/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {OptionsType} from '@diplodoc/transform/lib/typings';\n\nimport {MdxProps, MessageListProps} from 'src/components/organisms/MessageList';\n\nimport type {MermaidOptions} from '../../../markdown/types';\nimport type {\n ChatStatus,\n ChatType,\n MascotAssets,\n MascotCollection,\n MascotRenderContext,\n MascotState,\n TChatMessage,\n TSubmitData,\n} from '../../../types';\nimport type {SuggestionsItem} from '../../../types/common';\nimport type {ChatMarkdownOptions} from '../../../utils/chatMarkdown';\nimport type {ContextIndicatorProps} from '../../atoms/ContextIndicator';\nimport type {DisclaimerProps} from '../../atoms/Disclaimer';\nimport type {ContextItemConfig} from '../../molecules/PromptInputHeader';\nimport type {HeaderProps} from '../../organisms/Header';\nimport type {PromptInputProps} from '../../organisms/PromptInput';\nimport type {ChatContentProps} from '../../templates/ChatContent';\nimport type {AlignmentConfig, EmptyContainerProps} from '../../templates/EmptyContainer';\nimport type {HistoryProps} from '../../templates/History';\n\n/**\n * Welcome screen configuration\n */\nexport interface WelcomeConfig {\n /** Image or icon to display */\n image?: React.ReactNode;\n /** Title text or custom React element */\n title?: React.ReactNode;\n /** Description text or custom React element */\n description?: React.ReactNode;\n /** Suggestions section title - can be string or custom React element */\n suggestionTitle?: React.ReactNode;\n /** Array of suggestions (title will be used as message content) */\n suggestions?: SuggestionsItem[];\n /** Alignment configuration for image, title, and description */\n alignment?: AlignmentConfig;\n /** Layout orientation for suggestions: 'grid' for horizontal, 'list' for vertical */\n layout?: 'grid' | 'list';\n /** Enable text wrapping inside suggestion buttons instead of ellipsis */\n wrapText?: boolean;\n /** Show default title when neither title nor `texts.emptyStateTitle` / `emptyContainerProps.title` are provided */\n showDefaultTitle?: boolean;\n /** Show default description when neither description nor `texts.emptyStateDescription` / `emptyContainerProps.description` are provided */\n showDefaultDescription?: boolean;\n /** Show more suggestions callback */\n showMore?: () => void;\n /** Show more button text */\n showMoreText?: string;\n}\n\nexport interface MascotConfig<TAsset = string> {\n /** External state override, primarily for audio states or full consumer control. */\n stateOverride?: MascotState;\n assets?: MascotAssets<TAsset>;\n defaultAssets?: MascotAssets<TAsset>;\n /** Ready-to-render animated mascots grouped by welcome/chat surface and state. */\n mascots?: MascotCollection;\n /** Product-wide fallback mascots merged underneath `mascots`. */\n defaultMascots?: MascotCollection;\n /** Advanced renderer. Takes precedence over `mascots` when provided. */\n renderMascot?: (context: MascotRenderContext<TAsset>) => React.ReactNode;\n showOnWelcome?: boolean;\n showInChat?: boolean;\n sleepDelayMs?: number | null;\n onceDurations?: Partial<Record<'reveal' | 'done' | 'error' | 'stopped', number>>;\n onStateChange?: (state: MascotState) => void;\n}\n\n/**\n * MessageList configuration\n */\nexport type MessageListConfig = Omit<\n MessageListProps,\n | 'messages'\n | 'status'\n | 'onRetry'\n | 'showActionsOnHover'\n | 'transformOptions'\n | 'openMarkdownLinksInNewTab'\n | 'mermaidOptions'\n | 'mdxProps'\n>;\n\n/**\n * Unified visible strings for ChatContainer and its subtree.\n *\n * `texts.*` always wins. Below that, each area uses `welcomeConfig`, per-section `*Props` text fields,\n * then built-in defaults from `i18n()`.\n */\nexport interface ChatContainerTexts {\n /** Default header title when not using `headerProps.title` or active chat name */\n headerTitle?: string;\n /** Tooltip for the \"new chat\" header button */\n headerNewChatTooltip?: string;\n /** Tooltip for the \"history\" header button */\n headerHistoryTooltip?: string;\n /** Tooltip for the \"close\" header button */\n headerCloseTooltip?: string;\n /** Tooltip for the folding header button when collapsed (expand action) */\n headerFoldingCollapsedTooltip?: string;\n /** Tooltip for the folding header button when opened (collapse action) */\n headerFoldingOpenedTooltip?: string;\n /** Tooltip for the header menu button */\n headerMenuTooltip?: string;\n /** Empty state / welcome title */\n emptyStateTitle?: React.ReactNode;\n /** Empty state / welcome description */\n emptyStateDescription?: React.ReactNode;\n /** Title above suggestions on welcome screen */\n emptyStateSuggestionsTitle?: React.ReactNode;\n /** \"Show more\" button label on welcome screen */\n emptyStateShowMoreText?: string;\n /** Prompt textarea placeholder */\n promptPlaceholder?: string;\n /** Title above suggestions rendered inside PromptInput (`promptInputProps.suggestionsProps.suggestTitle`) */\n promptSuggestTitle?: React.ReactNode;\n /** Submit button tooltip (send / ready state) */\n submitSendTooltip?: string;\n /** Submit button tooltip (cancel / streaming state) */\n submitCancelTooltip?: string;\n /** Label rendered next to the submit button in cancelable state (`submitButtonCancelableText`) */\n submitButtonCancelableText?: string;\n /** Message list error alert main text */\n errorText?: string;\n /** History search/filter placeholder */\n historySearchPlaceholder?: string;\n /** History panel empty state when there are no chats */\n historyEmptyPlaceholder?: React.ReactNode;\n /** History panel empty state when search has no results */\n historyEmptyFilteredPlaceholder?: React.ReactNode;\n /** Disclaimer body text (must be a string; use `disclaimerProps.children` for custom nodes) */\n disclaimerText?: string;\n}\n\n/**\n * Unified test identifiers (`data-qa`) for ChatContainer and its subtree.\n *\n * - Pass a **string** for backward compatibility: only the root container gets `data-qa`.\n * - Pass **`{ prefix: 'x' }`** to opt in to `${prefix}-${suffix}` for every slot below (see README).\n * - Pass **explicit keys** to override individual elements; they win over `prefix` and nested `*Props.qa`.\n */\nexport interface ChatContainerQa {\n /** Applied to child slots when explicit keys are omitted; also used as root if `root` is omitted */\n prefix?: string;\n /** Root chat container */\n root?: string;\n /** Header root */\n header?: string;\n /** Overrides default `header-action-newChat` */\n headerNewChat?: string;\n /** Overrides default `header-action-history` */\n headerHistory?: string;\n /** Overrides default `header-action-folding` */\n headerFolding?: string;\n /** Overrides default `header-action-close` */\n headerClose?: string;\n /** Overrides default `header-menu-button` */\n headerMenuButton?: string;\n /** ChatContent root */\n content?: string;\n /** Empty state (EmptyContainer) */\n emptyState?: string;\n /** MessageList scroll area */\n messageList?: string;\n /** Action popup in MessageList */\n actionPopup?: string;\n /** PromptInput root */\n promptInput?: string;\n promptInputHeader?: string;\n promptInputBody?: string;\n promptInputFooter?: string;\n /** Submit button in prompt footer */\n submitButton?: string;\n /** Disclaimer text block */\n disclaimer?: string;\n /** History list (inside popup) */\n history?: string;\n}\n\n/** Outcome of an export operation for its originating conversation. */\nexport type ChatExportResult = {\n action: 'copy' | 'download';\n /** Undefined for an unsaved conversation. */\n chatId?: string;\n} & ({status: 'success'} | {status: 'error'; error: unknown});\n\nexport interface ChatExportConfig extends ChatMarkdownOptions {\n /** Disable export until the full conversation history is loaded. */\n loading?: boolean;\n filename?: string;\n /** Replace built-in feedback. Stale results after switching chats are not delivered. */\n onResult?: (result: ChatExportResult) => void;\n}\n\n/**\n * Props for ChatContainer component\n */\nexport interface ChatContainerProps {\n /** Opt-in Markdown export. Supply complete history in messages, including off-screen messages. */\n chatExport?: ChatExportConfig;\n // Chat data\n /** Array of chats for history */\n chats?: ChatType[];\n /** Currently active chat */\n activeChat?: ChatType | null;\n /** Array of messages in current chat */\n messages?: TChatMessage[];\n\n // Main callbacks\n /** Callback when user sends a message */\n onSendMessage: (data: TSubmitData) => Promise<void | false>;\n /** Callback when user selects a chat from history */\n onSelectChat?: (chat: ChatType) => void;\n /** Callback when user creates a new chat */\n onCreateChat?: () => void;\n /** Callback when user deletes a chat */\n onDeleteChat?: (chat: ChatType) => Promise<void>;\n /** Callback when user deletes all chats */\n onDeleteAllChats?: () => Promise<void>;\n /** Callback when user folds or unfolds the chat */\n onFold?: (value: 'collapsed' | 'opened') => void;\n /** Callback when user closes the chat */\n onClose?: () => void;\n /** Callback when user cancels streaming */\n onCancel?: () => Promise<void>;\n\n // Layout\n /**\n * Enables mobile mode for the chat and all inner components.\n * When omitted, falls back to the `useMobile()` value from the\n * `@gravity-ui/uikit` `MobileProvider` context.\n */\n isMobile?: boolean;\n /**\n * In mobile mode, shrinks the container to the visible part of the viewport while the\n * on-screen keyboard is open, so the prompt input and the disclaimer stay above it.\n * Set to `false` when the host application handles the keyboard itself.\n *\n * @default true\n */\n adjustToKeyboard?: boolean;\n /**\n * Renders the header above the content instead of stacking it on top: the message list and\n * the welcome screen scroll underneath. The header is taken out of the flow, so the content\n * has to be offset by its height manually — the offset depends on the layout. Set an explicit\n * height first: `--g-aikit-chat-container-header-height` is `auto` by default and\n * `--g-aikit-chat-container-mobile-header-height` is `60px` in mobile mode. Pair it with a\n * transparent `--g-aikit-chat-container-header-background` to let the content show through.\n *\n * @example\n * .my-chat {\n * --g-aikit-chat-container-header-height: 60px;\n * --g-aikit-chat-container-header-background: transparent;\n * }\n * .my-chat .g-aikit-chat-container__content {\n * padding-top: var(--g-aikit-chat-container-header-height);\n * }\n */\n floatingHeader?: boolean;\n\n // States\n /** Chat status: submitted, streaming, ready, error */\n status?: ChatStatus;\n /** Error state */\n error?: Error | null;\n /** Show message actions on hover */\n showActionsOnHover?: boolean;\n /** Callback to retry after error */\n onRetry?: () => void;\n\n // Context\n /** Array of context items to display in prompt input header */\n contextItems?: ContextItemConfig[];\n /** Show context indicator in prompt input header */\n showContextIndicator?: boolean;\n /** Props for the context indicator */\n contextIndicatorProps?: ContextIndicatorProps;\n /** Transform options for markdown rendering */\n transformOptions?: OptionsType;\n /** Should parse incomplete markdown (e.g., during streaming) */\n shouldParseIncompleteMarkdown?: boolean;\n /** Enables Mermaid diagrams with an application-provided lazy loader. */\n mermaidOptions?: MermaidOptions;\n /** Open all markdown links rendered by the default message renderers in a new tab */\n openMarkdownLinksInNewTab?: boolean;\n /**\n * Grouped MDX/markdown rendering props forwarded to the message list:\n * `mdxOptions`, `getMarkdownExtraProps` and `getMdxContext`.\n */\n mdxProps?: MdxProps;\n\n // Configuration\n /** MessageList configuration for actions and loader behavior */\n messageListConfig?: MessageListConfig;\n /** Enable the built-in Gravity mascot. Custom mascot configuration takes precedence. */\n showMascot?: boolean;\n /** Mascot renderer, assets and lifecycle configuration. Enables custom mascots independently of `showMascot`. */\n mascotConfig?: MascotConfig;\n\n // Component props overrides\n /** Props override for Header component */\n headerProps?: Partial<\n Omit<HeaderProps, 'handleNewChat' | 'handleHistoryToggle' | 'handleFolding' | 'handleClose'>\n >;\n /** Props override for ChatContent component */\n contentProps?: Partial<Omit<ChatContentProps, 'view' | 'messageListProps'>>;\n /** Props override for EmptyContainer (welcome screen) */\n emptyContainerProps?: Partial<EmptyContainerProps>;\n /** Props override for PromptInput component */\n promptInputProps?: Partial<Omit<PromptInputProps, 'onSend' | 'onCancel'>>;\n /** Props override for Disclaimer component */\n disclaimerProps?: Partial<DisclaimerProps>;\n /** Props override for History component */\n historyProps?: Partial<\n Omit<\n HistoryProps,\n 'chats' | 'selectedChat' | 'onSelectChat' | 'onDeleteChat' | 'anchorElement'\n >\n >;\n\n // Configuration\n /** Welcome screen configuration for empty state */\n welcomeConfig?: WelcomeConfig;\n /** Unified flat text overrides for ChatContainer subtree */\n texts?: ChatContainerTexts;\n /** Show chat history feature */\n showHistory?: boolean;\n /** Show new chat button */\n showNewChat?: boolean;\n /** Show folding button */\n showFolding?: boolean;\n /** Show close button */\n showClose?: boolean;\n /** Hide header title when chat is empty */\n hideTitleOnEmptyChat?: boolean;\n\n // Styling\n /** Additional CSS class */\n className?: string;\n /** Additional CSS class for header section */\n headerClassName?: string;\n /** Additional CSS class for content section */\n contentClassName?: string;\n /** Additional CSS class for footer section */\n footerClassName?: string;\n /**\n * QA/test identifiers. A string sets only the root `data-qa`. Use {@link ChatContainerQa} for a full map or `prefix`.\n */\n qa?: string | ChatContainerQa;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/pages/ChatContainer/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {OptionsType} from '@diplodoc/transform/lib/typings';\n\nimport {MdxProps, MessageListProps} from 'src/components/organisms/MessageList';\n\nimport type {MermaidOptions} from '../../../markdown/types';\nimport type {\n ChatStatus,\n ChatType,\n MascotAssets,\n MascotCollection,\n MascotRenderContext,\n MascotState,\n TChatMessage,\n TSubmitData,\n} from '../../../types';\nimport type {SuggestionsItem} from '../../../types/common';\nimport type {ChatActivityStore} from '../../../utils/chatActivityStore';\nimport type {ChatMarkdownOptions} from '../../../utils/chatMarkdown';\nimport type {ContextIndicatorProps} from '../../atoms/ContextIndicator';\nimport type {DisclaimerProps} from '../../atoms/Disclaimer';\nimport type {ContextItemConfig} from '../../molecules/PromptInputHeader';\nimport type {HeaderProps} from '../../organisms/Header';\nimport type {PromptInputProps} from '../../organisms/PromptInput';\nimport type {ChatContentProps} from '../../templates/ChatContent';\nimport type {AlignmentConfig, EmptyContainerProps} from '../../templates/EmptyContainer';\nimport type {HistoryProps} from '../../templates/History';\n\n/**\n * Welcome screen configuration\n */\nexport interface WelcomeConfig {\n /** Image or icon to display */\n image?: React.ReactNode;\n /** Title text or custom React element */\n title?: React.ReactNode;\n /** Description text or custom React element */\n description?: React.ReactNode;\n /** Suggestions section title - can be string or custom React element */\n suggestionTitle?: React.ReactNode;\n /** Array of suggestions (title will be used as message content) */\n suggestions?: SuggestionsItem[];\n /** Alignment configuration for image, title, and description */\n alignment?: AlignmentConfig;\n /** Layout orientation for suggestions: 'grid' for horizontal, 'list' for vertical */\n layout?: 'grid' | 'list';\n /** Enable text wrapping inside suggestion buttons instead of ellipsis */\n wrapText?: boolean;\n /** Show default title when neither title nor `texts.emptyStateTitle` / `emptyContainerProps.title` are provided */\n showDefaultTitle?: boolean;\n /** Show default description when neither description nor `texts.emptyStateDescription` / `emptyContainerProps.description` are provided */\n showDefaultDescription?: boolean;\n /** Show more suggestions callback */\n showMore?: () => void;\n /** Show more button text */\n showMoreText?: string;\n}\n\nexport interface MascotConfig<TAsset = string> {\n /** External state override, primarily for audio states or full consumer control. */\n stateOverride?: MascotState;\n assets?: MascotAssets<TAsset>;\n defaultAssets?: MascotAssets<TAsset>;\n /** Ready-to-render animated mascots grouped by welcome/chat surface and state. */\n mascots?: MascotCollection;\n /** Product-wide fallback mascots merged underneath `mascots`. */\n defaultMascots?: MascotCollection;\n /** Advanced renderer. Takes precedence over `mascots` when provided. */\n renderMascot?: (context: MascotRenderContext<TAsset>) => React.ReactNode;\n showOnWelcome?: boolean;\n showInChat?: boolean;\n sleepDelayMs?: number | null;\n onceDurations?: Partial<Record<'reveal' | 'done' | 'error' | 'stopped', number>>;\n onStateChange?: (state: MascotState) => void;\n}\n\n/**\n * MessageList configuration\n */\nexport type MessageListConfig = Omit<\n MessageListProps,\n | 'messages'\n | 'status'\n | 'onRetry'\n | 'showActionsOnHover'\n | 'transformOptions'\n | 'openMarkdownLinksInNewTab'\n | 'mermaidOptions'\n | 'mdxProps'\n>;\n\n/**\n * Unified visible strings for ChatContainer and its subtree.\n *\n * `texts.*` always wins. Below that, each area uses `welcomeConfig`, per-section `*Props` text fields,\n * then built-in defaults from `i18n()`.\n */\nexport interface ChatContainerTexts {\n /** Default header title when not using `headerProps.title` or active chat name */\n headerTitle?: string;\n /** Tooltip for the \"new chat\" header button */\n headerNewChatTooltip?: string;\n /** Tooltip for the \"history\" header button */\n headerHistoryTooltip?: string;\n /** Tooltip for the \"close\" header button */\n headerCloseTooltip?: string;\n /** Tooltip for the folding header button when collapsed (expand action) */\n headerFoldingCollapsedTooltip?: string;\n /** Tooltip for the folding header button when opened (collapse action) */\n headerFoldingOpenedTooltip?: string;\n /** Tooltip for the header menu button */\n headerMenuTooltip?: string;\n /** Empty state / welcome title */\n emptyStateTitle?: React.ReactNode;\n /** Empty state / welcome description */\n emptyStateDescription?: React.ReactNode;\n /** Title above suggestions on welcome screen */\n emptyStateSuggestionsTitle?: React.ReactNode;\n /** \"Show more\" button label on welcome screen */\n emptyStateShowMoreText?: string;\n /** Prompt textarea placeholder */\n promptPlaceholder?: string;\n /** Title above suggestions rendered inside PromptInput (`promptInputProps.suggestionsProps.suggestTitle`) */\n promptSuggestTitle?: React.ReactNode;\n /** Submit button tooltip (send / ready state) */\n submitSendTooltip?: string;\n /** Submit button tooltip (cancel / streaming state) */\n submitCancelTooltip?: string;\n /** Label rendered next to the submit button in cancelable state (`submitButtonCancelableText`) */\n submitButtonCancelableText?: string;\n /** Message list error alert main text */\n errorText?: string;\n /** History search/filter placeholder */\n historySearchPlaceholder?: string;\n /** History panel empty state when there are no chats */\n historyEmptyPlaceholder?: React.ReactNode;\n /** History panel empty state when search has no results */\n historyEmptyFilteredPlaceholder?: React.ReactNode;\n /** Disclaimer body text (must be a string; use `disclaimerProps.children` for custom nodes) */\n disclaimerText?: string;\n}\n\n/**\n * Unified test identifiers (`data-qa`) for ChatContainer and its subtree.\n *\n * - Pass a **string** for backward compatibility: only the root container gets `data-qa`.\n * - Pass **`{ prefix: 'x' }`** to opt in to `${prefix}-${suffix}` for every slot below (see README).\n * - Pass **explicit keys** to override individual elements; they win over `prefix` and nested `*Props.qa`.\n */\nexport interface ChatContainerQa {\n /** Applied to child slots when explicit keys are omitted; also used as root if `root` is omitted */\n prefix?: string;\n /** Root chat container */\n root?: string;\n /** Header root */\n header?: string;\n /** Overrides default `header-action-newChat` */\n headerNewChat?: string;\n /** Overrides default `header-action-history` */\n headerHistory?: string;\n /** Overrides default `header-action-folding` */\n headerFolding?: string;\n /** Overrides default `header-action-close` */\n headerClose?: string;\n /** Overrides default `header-menu-button` */\n headerMenuButton?: string;\n /** ChatContent root */\n content?: string;\n /** Empty state (EmptyContainer) */\n emptyState?: string;\n /** MessageList scroll area */\n messageList?: string;\n /** Action popup in MessageList */\n actionPopup?: string;\n /** PromptInput root */\n promptInput?: string;\n promptInputHeader?: string;\n promptInputBody?: string;\n promptInputFooter?: string;\n /** Submit button in prompt footer */\n submitButton?: string;\n /** Disclaimer text block */\n disclaimer?: string;\n /** History list (inside popup) */\n history?: string;\n}\n\n/** Outcome of an export operation for its originating conversation. */\nexport type ChatExportResult = {\n action: 'copy' | 'download';\n /** Undefined for an unsaved conversation. */\n chatId?: string;\n} & ({status: 'success'} | {status: 'error'; error: unknown});\n\nexport interface ChatExportConfig extends ChatMarkdownOptions {\n /** Disable export until the full conversation history is loaded. */\n loading?: boolean;\n filename?: string;\n /** Replace built-in feedback. Stale results after switching chats are not delivered. */\n onResult?: (result: ChatExportResult) => void;\n}\n\n/**\n * Props for ChatContainer component\n */\nexport interface ChatContainerProps {\n /** Stable account-scoped activity source; accepts local and server-backed stores. */\n chatActivity?: {\n store: ChatActivityStore;\n /** False while the host panel is closed or collapsed. */\n isPanelVisible: boolean;\n /** The completed response actually rendered for activeChat; omit while loading it. */\n renderedResponseId?: string;\n };\n /** Opt-in Markdown export. Supply complete history in messages, including off-screen messages. */\n chatExport?: ChatExportConfig;\n // Chat data\n /** Array of chats for history */\n chats?: ChatType[];\n /** Currently active chat */\n activeChat?: ChatType | null;\n /** Array of messages in current chat */\n messages?: TChatMessage[];\n\n // Main callbacks\n /** Callback when user sends a message */\n onSendMessage: (data: TSubmitData) => Promise<void | false>;\n /** Callback when user selects a chat from history */\n onSelectChat?: (chat: ChatType) => void;\n /** Callback when user creates a new chat */\n onCreateChat?: () => void;\n /** Callback when user deletes a chat */\n onDeleteChat?: (chat: ChatType) => Promise<void>;\n /** Callback when user deletes all chats */\n onDeleteAllChats?: () => Promise<void>;\n /** Callback when user folds or unfolds the chat */\n onFold?: (value: 'collapsed' | 'opened') => void;\n /** Callback when user closes the chat */\n onClose?: () => void;\n /** Callback when user cancels streaming */\n onCancel?: () => Promise<void>;\n\n // Layout\n /**\n * Enables mobile mode for the chat and all inner components.\n * When omitted, falls back to the `useMobile()` value from the\n * `@gravity-ui/uikit` `MobileProvider` context.\n */\n isMobile?: boolean;\n /**\n * In mobile mode, shrinks the container to the visible part of the viewport while the\n * on-screen keyboard is open, so the prompt input and the disclaimer stay above it.\n * Set to `false` when the host application handles the keyboard itself.\n *\n * @default true\n */\n adjustToKeyboard?: boolean;\n /**\n * Renders the header above the content instead of stacking it on top: the message list and\n * the welcome screen scroll underneath. The header is taken out of the flow, so the content\n * has to be offset by its height manually — the offset depends on the layout. Set an explicit\n * height first: `--g-aikit-chat-container-header-height` is `auto` by default and\n * `--g-aikit-chat-container-mobile-header-height` is `60px` in mobile mode. Pair it with a\n * transparent `--g-aikit-chat-container-header-background` to let the content show through.\n *\n * @example\n * .my-chat {\n * --g-aikit-chat-container-header-height: 60px;\n * --g-aikit-chat-container-header-background: transparent;\n * }\n * .my-chat .g-aikit-chat-container__content {\n * padding-top: var(--g-aikit-chat-container-header-height);\n * }\n */\n floatingHeader?: boolean;\n\n // States\n /** Chat status: submitted, streaming, ready, error */\n status?: ChatStatus;\n /** Error state */\n error?: Error | null;\n /** Show message actions on hover */\n showActionsOnHover?: boolean;\n /** Callback to retry after error */\n onRetry?: () => void;\n\n // Context\n /** Array of context items to display in prompt input header */\n contextItems?: ContextItemConfig[];\n /** Show context indicator in prompt input header */\n showContextIndicator?: boolean;\n /** Props for the context indicator */\n contextIndicatorProps?: ContextIndicatorProps;\n /** Transform options for markdown rendering */\n transformOptions?: OptionsType;\n /** Should parse incomplete markdown (e.g., during streaming) */\n shouldParseIncompleteMarkdown?: boolean;\n /** Enables Mermaid diagrams with an application-provided lazy loader. */\n mermaidOptions?: MermaidOptions;\n /** Open all markdown links rendered by the default message renderers in a new tab */\n openMarkdownLinksInNewTab?: boolean;\n /**\n * Grouped MDX/markdown rendering props forwarded to the message list:\n * `mdxOptions`, `getMarkdownExtraProps` and `getMdxContext`.\n */\n mdxProps?: MdxProps;\n\n // Configuration\n /** MessageList configuration for actions and loader behavior */\n messageListConfig?: MessageListConfig;\n /** Enable the built-in Gravity mascot. Custom mascot configuration takes precedence. */\n showMascot?: boolean;\n /** Mascot renderer, assets and lifecycle configuration. Enables custom mascots independently of `showMascot`. */\n mascotConfig?: MascotConfig;\n\n // Component props overrides\n /** Props override for Header component */\n headerProps?: Partial<\n Omit<HeaderProps, 'handleNewChat' | 'handleHistoryToggle' | 'handleFolding' | 'handleClose'>\n >;\n /** Props override for ChatContent component */\n contentProps?: Partial<Omit<ChatContentProps, 'view' | 'messageListProps'>>;\n /** Props override for EmptyContainer (welcome screen) */\n emptyContainerProps?: Partial<EmptyContainerProps>;\n /** Props override for PromptInput component */\n promptInputProps?: Partial<Omit<PromptInputProps, 'onSend' | 'onCancel'>>;\n /** Props override for Disclaimer component */\n disclaimerProps?: Partial<DisclaimerProps>;\n /** Props override for History component */\n historyProps?: Partial<\n Omit<\n HistoryProps,\n 'chats' | 'selectedChat' | 'onSelectChat' | 'onDeleteChat' | 'anchorElement'\n >\n >;\n\n // Configuration\n /** Welcome screen configuration for empty state */\n welcomeConfig?: WelcomeConfig;\n /** Unified flat text overrides for ChatContainer subtree */\n texts?: ChatContainerTexts;\n /** Show chat history feature */\n showHistory?: boolean;\n /** Show new chat button */\n showNewChat?: boolean;\n /** Show folding button */\n showFolding?: boolean;\n /** Show close button */\n showClose?: boolean;\n /** Hide header title when chat is empty */\n hideTitleOnEmptyChat?: boolean;\n\n // Styling\n /** Additional CSS class */\n className?: string;\n /** Additional CSS class for header section */\n headerClassName?: string;\n /** Additional CSS class for content section */\n contentClassName?: string;\n /** Additional CSS class for footer section */\n footerClassName?: string;\n /**\n * QA/test identifiers. A string sets only the root `data-qa`. Use {@link ChatContainerQa} for a full map or `prefix`.\n */\n qa?: string | ChatContainerQa;\n}\n"]}
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import { InputControlSize } from '@gravity-ui/uikit';
3
3
  import { ChatType } from "../../../types/index.js";
4
+ import type { ChatActivity } from "../../../utils/chatActivityStore.js";
4
5
  /**
5
6
  * Props for ChatItem component
6
7
  */
7
8
  export interface ChatItemProps {
8
9
  chat: ChatType;
10
+ activity?: ChatActivity;
11
+ showActivity?: boolean;
9
12
  showActions: boolean;
10
13
  pinned?: boolean;
11
14
  onPinnedChange?: (chatId: string, pinned: boolean) => void;
@@ -23,4 +26,4 @@ export interface ChatItemProps {
23
26
  *
24
27
  * @returns React element
25
28
  */
26
- export declare function ChatItem({ chat, showActions, isActive, actionTabIndex, onDeleteClick, size, pinned, onPinnedChange, pinningDisabled, }: ChatItemProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function ChatItem({ chat, activity, showActivity, showActions, isActive, actionTabIndex, onDeleteClick, size, pinned, onPinnedChange, pinningDisabled, }: ChatItemProps): import("react/jsx-runtime").JSX.Element;
@@ -21,7 +21,7 @@ function handleActionKeyDown(event) {
21
21
  *
22
22
  * @returns React element
23
23
  */
24
- function ChatItem({ chat, showActions, isActive, actionTabIndex, onDeleteClick, size, pinned, onPinnedChange, pinningDisabled, }) {
24
+ function ChatItem({ chat, activity, showActivity, showActions, isActive, actionTabIndex, onDeleteClick, size, pinned, onPinnedChange, pinningDisabled, }) {
25
25
  const { t } = i18n_1.i18n.useTranslation();
26
26
  const [isDeleteProccesing, setIsDeleteProcessing] = (0, react_1.useState)(false);
27
27
  const [hasOverflow, setHasOverflow] = (0, react_1.useState)(false);
@@ -59,7 +59,7 @@ function ChatItem({ chat, showActions, isActive, actionTabIndex, onDeleteClick,
59
59
  active: isActive,
60
60
  mobile: isMobile,
61
61
  ['is-delete-processing']: isDeleteProccesing,
62
- }), onClick: handleClick, children: [pinned && ((0, jsx_runtime_1.jsx)("span", { role: "img", "aria-label": t('pinned'), children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Pin, size: 16 }) })), hasOverflow ? ((0, jsx_runtime_1.jsx)(uikit_1.Tooltip, { content: chatLabel, openDelay: 300, children: label })) : (label), showDeleteAction ? ((0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { tabIndex: actionTabIndex, view: "flat", size: deleteButtonSize, color: "secondary", loading: isDeleteProccesing, className: b('delete-button'), "aria-label": t('tooltip-delete'), onClick: handleDeleteChat, onKeyDown: handleActionKeyDown, tooltipTitle: t('tooltip-delete'), children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { className: b('icon-button'), data: icons_1.TrashBin, size: deleteIconSize }) })) : null, showActions && onPinnedChange && ((0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { tabIndex: actionTabIndex, view: "flat", size: deleteButtonSize, "aria-disabled": Boolean(pinningDisabled || isDeleteProccesing), className: b('pin-button'), "aria-label": t(pinned ? 'action-unpin' : 'action-pin'), tooltipTitle: t(pinned ? 'action-unpin' : 'action-pin'), onKeyDown: handleActionKeyDown, onClick: (event) => {
62
+ }), onClick: handleClick, children: [showActivity && ((0, jsx_runtime_1.jsx)("span", { className: b('activity-slot'), children: !(activity === null || activity === void 0 ? void 0 : activity.isGenerating) && (activity === null || activity === void 0 ? void 0 : activity.hasUnread) && ((0, jsx_runtime_1.jsx)(uikit_1.Tooltip, { content: t('activity-unread'), children: (0, jsx_runtime_1.jsx)("span", { className: b('unread-dot'), role: "img", "aria-label": t('activity-unread') }) })) })), pinned && ((0, jsx_runtime_1.jsx)("span", { role: "img", "aria-label": t('pinned'), children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Pin, size: 16 }) })), hasOverflow ? ((0, jsx_runtime_1.jsx)(uikit_1.Tooltip, { content: chatLabel, openDelay: 300, children: label })) : (label), showActivity && ((0, jsx_runtime_1.jsx)("span", { className: b('activity-slot'), children: (activity === null || activity === void 0 ? void 0 : activity.isGenerating) && ((0, jsx_runtime_1.jsx)(uikit_1.Tooltip, { content: t('activity-generating'), children: (0, jsx_runtime_1.jsx)("span", { role: "img", "aria-label": t('activity-generating'), children: (0, jsx_runtime_1.jsx)(uikit_1.Spin, { size: "xs" }) }) })) })), showDeleteAction ? ((0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { tabIndex: actionTabIndex, view: "flat", size: deleteButtonSize, color: "secondary", loading: isDeleteProccesing, className: b('delete-button'), "aria-label": t('tooltip-delete'), onClick: handleDeleteChat, onKeyDown: handleActionKeyDown, tooltipTitle: t('tooltip-delete'), children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { className: b('icon-button'), data: icons_1.TrashBin, size: deleteIconSize }) })) : null, showActions && onPinnedChange && ((0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { tabIndex: actionTabIndex, view: "flat", size: deleteButtonSize, "aria-disabled": Boolean(pinningDisabled || isDeleteProccesing), className: b('pin-button'), "aria-label": t(pinned ? 'action-unpin' : 'action-pin'), tooltipTitle: t(pinned ? 'action-unpin' : 'action-pin'), onKeyDown: handleActionKeyDown, onClick: (event) => {
63
63
  event.stopPropagation();
64
64
  if (!pinningDisabled && !isDeleteProccesing) {
65
65
  onPinnedChange(chat.id, !pinned);
@@ -1 +1 @@
1
- {"version":3,"file":"ChatItem.js","sourceRoot":"../../../../../src","sources":["components/templates/History/ChatItem.tsx"],"names":[],"mappings":";;AA2CA,4BAmHC;;AA9JD,iCAAyD;AAEzD,6CAA0D;AAC1D,6CAAmF;AAEnF,iFAAiG;AAEjG,6CAAwC;AACxC,oEAAsD;AAEtD,0CAA4B;AAE5B,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,SAAS,CAAC,CAAC;AAE3B,SAAS,mBAAmB,CAAC,KAA6C;IACtE,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;QAC7C,KAAK,CAAC,eAAe,E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putControlSize, Text, Tooltip, useMobile} from '@gravity-ui/uikit';\n\nimport {getControlIconSize, resolveMobileControlSize} from '../../../hooks/useMobileControlSize';\nimport {ChatType} from '../../../types';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\n\nimport {i18n} from './i18n';\n\nconst b = block('history');\n\nfunction handleActionKeyDown(event: React.KeyboardEvent<HTMLButtonElement>) {\n if (event.key === ' ' || event.key === 'Enter') {\n event.stopPropagation();\n }\n}\n\n/**\n * Props for ChatItem component\n */\nexport interface ChatItemProps {\n chat: ChatType;\n showActions: boolean;\n pinned?: boolean;\n onPinnedChange?: (chatId: string, pinned: boolean) => void;\n pinningDisabled?: boolean;\n isActive?: boolean;\n /** Row actions participate in Tab navigation only with an external search focus owner. */\n actionTabIndex?: 0 | -1;\n onDeleteClick?: (e: React.MouseEvent, chat: ChatType) => Promise<void>;\n /** Size of the row actions (default: `s`, `xl` in mobile mode) */\n size?: InputControlSize;\n}\n\n/**\n * Chat item component with hover state for actions.\n * In mobile mode there is no hover, so actions are always visible.\n *\n * @returns React element\n */\nexport function ChatItem({\n chat,\n showActions,\n isActive,\n actionTabIndex,\n onDeleteClick,\n size,\n pinned,\n onPinnedChange,\n pinningDisabled,\n}: ChatItemProps) {\n const {t} = i18n.useTranslation();\n const [isDeleteProccesing, setIsDeleteProcessing] = useState(false);\n const [hasOverflow, setHasOverflow] = useState(false);\n const labelRef = useRef<HTMLDivElement>(null);\n const chatLabel = chat.lastMessage || chat.name;\n const isMobile = useMobile();\n const deleteButtonSize = resolveMobileControlSize({\n size,\n desktopDefault: 's',\n mobileDefault: 'xl',\n isMobile,\n });\n const deleteIconSize = getControlIconSize(deleteButtonSize);\n\n useEffect(() => {\n const label = labelRef.current;\n setHasOverflow(Boolean(label && label.scrollWidth > label.clientWidth));\n }, [chatLabel, pinned, showActions, onPinnedChange]);\n\n const handleClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (isDeleteProccesing) {\n e.stopPropagation();\n }\n };\n\n const handleDeleteChat = async (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n try {\n setIsDeleteProcessing(true);\n await onDeleteClick?.(e, chat);\n } finally {\n setIsDeleteProcessing(false);\n }\n };\n\n const showDeleteAction = isDeleteProccesing || (showActions && onDeleteClick);\n\n const label = (\n <div className={b('chat-content')}>\n <Text variant=\"body-1\" ref={labelRef}>\n {chatLabel}\n </Text>\n </div>\n );\n\n return (\n <div\n className={b('chat-item', {\n active: isActive,\n mobile: isMobile,\n ['is-delete-processing']: isDeleteProccesing,\n })}\n onClick={handleClick}\n >\n {pinned && (\n <span role=\"img\" aria-label={t('pinned')}>\n <Icon data={Pin} size={16} />\n </span>\n )}\n {hasOverflow ? (\n <Tooltip content={chatLabel} openDelay={300}>\n {label}\n </Tooltip>\n ) : (\n label\n )}\n\n {showDeleteAction ? (\n <ActionButton\n tabIndex={actionTabIndex}\n view=\"flat\"\n size={deleteButtonSize}\n color=\"secondary\"\n loading={isDeleteProccesing}\n className={b('delete-button')}\n aria-label={t('tooltip-delete')}\n onClick={handleDeleteChat}\n onKeyDown={handleActionKeyDown}\n tooltipTitle={t('tooltip-delete')}\n >\n <Icon className={b('icon-button')} data={TrashBin} size={deleteIconSize} />\n </ActionButton>\n ) : null}\n {showActions && onPinnedChange && (\n <ActionButton\n tabIndex={actionTabIndex}\n view=\"flat\"\n size={deleteButtonSize}\n aria-disabled={Boolean(pinningDisabled || isDeleteProccesing)}\n className={b('pin-button')}\n aria-label={t(pinned ? 'action-unpin' : 'action-pin')}\n tooltipTitle={t(pinned ? 'action-unpin' : 'action-pin')}\n onKeyDown={handleActionKeyDown}\n onClick={(event) => {\n event.stopPropagation();\n if (!pinningDisabled && !isDeleteProccesing) {\n onPinnedChange(chat.id, !pinned);\n }\n }}\n >\n <Icon data={pinned ? PinSlash : Pin} size={deleteIconSize} />\n </ActionButton>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ChatItem.js","sourceRoot":"../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C/B,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,mBAAmB,EAC9B,YAAY,EAAE,CAAC,CAAC,gBAAgB,CAAC,YAEjC,uBAAC,YAAI,IAAC,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,gBAAQ,EAAE,IAAI,EAAE,cAAc,GAAI,GAChE,CAClB,CAAC,CAAC,CAAC,IAAI,EACP,WAAW,IAAI,cAAc,IAAI,CAC9B,uBAAC,2BAAY,IACT,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAC,MAAM,EACX,IAAI,EAAE,gBAAgB,mBACP,OAAO,CAAC,eAAe,IAAI,kBAAkB,CAAC,EAC7D,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,gBACd,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,EACrD,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,EACvD,SAAS,EAAE,mBAAmB,EAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBACf,KAAK,CAAC,eAAe,EAAE,CAAC;oBACxB,IAAI,CAAC,eAAe,IAAI,CAAC,kBAAkB,EAAE,CAAC;wBAC1C,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;oBACrC,CAAC;gBACL,CAAC,YAED,uBAAC,YAAI,IAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,gBAAQ,CAAC,CAAC,CAAC,WAAG,EAAE,IAAI,EAAE,cAAc,GAAI,GAClD,CAClB,IACC,CACT,CAAC;AACN,CAAC","sourcesContent":["import React, {useEffect, useRef, useState} from 'react';\n\nimport {Pin, PinSlash, TrashBin} from '@gravity-ui/icons';\nimport {Icon, InputControlSize, Spin, Text, Tooltip, useMobile} from '@gravity-ui/uikit';\n\nimport {getControlIconSize, resolveMobileControlSize} from '../../../hooks/useMobileControlSize';\nimport {ChatType} from '../../../types';\nimport type {ChatActivity} from '../../../utils/chatActivityStore';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\n\nimport {i18n} from './i18n';\n\nconst b = block('history');\n\nfunction handleActionKeyDown(event: React.KeyboardEvent<HTMLButtonElement>) {\n if (event.key === ' ' || event.key === 'Enter') {\n event.stopPropagation();\n }\n}\n\n/**\n * Props for ChatItem component\n */\nexport interface ChatItemProps {\n chat: ChatType;\n activity?: ChatActivity;\n showActivity?: boolean;\n showActions: boolean;\n pinned?: boolean;\n onPinnedChange?: (chatId: string, pinned: boolean) => void;\n pinningDisabled?: boolean;\n isActive?: boolean;\n /** Row actions participate in Tab navigation only with an external search focus owner. */\n actionTabIndex?: 0 | -1;\n onDeleteClick?: (e: React.MouseEvent, chat: ChatType) => Promise<void>;\n /** Size of the row actions (default: `s`, `xl` in mobile mode) */\n size?: InputControlSize;\n}\n\n/**\n * Chat item component with hover state for actions.\n * In mobile mode there is no hover, so actions are always visible.\n *\n * @returns React element\n */\nexport function ChatItem({\n chat,\n activity,\n showActivity,\n showActions,\n isActive,\n actionTabIndex,\n onDeleteClick,\n size,\n pinned,\n onPinnedChange,\n pinningDisabled,\n}: ChatItemProps) {\n const {t} = i18n.useTranslation();\n const [isDeleteProccesing, setIsDeleteProcessing] = useState(false);\n const [hasOverflow, setHasOverflow] = useState(false);\n const labelRef = useRef<HTMLDivElement>(null);\n const chatLabel = chat.lastMessage || chat.name;\n const isMobile = useMobile();\n const deleteButtonSize = resolveMobileControlSize({\n size,\n desktopDefault: 's',\n mobileDefault: 'xl',\n isMobile,\n });\n const deleteIconSize = getControlIconSize(deleteButtonSize);\n\n useEffect(() => {\n const label = labelRef.current;\n setHasOverflow(Boolean(label && label.scrollWidth > label.clientWidth));\n }, [chatLabel, pinned, showActions, onPinnedChange]);\n\n const handleClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (isDeleteProccesing) {\n e.stopPropagation();\n }\n };\n\n const handleDeleteChat = async (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n try {\n setIsDeleteProcessing(true);\n await onDeleteClick?.(e, chat);\n } finally {\n setIsDeleteProcessing(false);\n }\n };\n\n const showDeleteAction = isDeleteProccesing || (showActions && onDeleteClick);\n\n const label = (\n <div className={b('chat-content')}>\n <Text variant=\"body-1\" ref={labelRef}>\n {chatLabel}\n </Text>\n </div>\n );\n\n return (\n <div\n className={b('chat-item', {\n active: isActive,\n mobile: isMobile,\n ['is-delete-processing']: isDeleteProccesing,\n })}\n onClick={handleClick}\n >\n {showActivity && (\n <span className={b('activity-slot')}>\n {!activity?.isGenerating && activity?.hasUnread && (\n <Tooltip content={t('activity-unread')}>\n <span\n className={b('unread-dot')}\n role=\"img\"\n aria-label={t('activity-unread')}\n />\n </Tooltip>\n )}\n </span>\n )}\n {pinned && (\n <span role=\"img\" aria-label={t('pinned')}>\n <Icon data={Pin} size={16} />\n </span>\n )}\n {hasOverflow ? (\n <Tooltip content={chatLabel} openDelay={300}>\n {label}\n </Tooltip>\n ) : (\n label\n )}\n\n {showActivity && (\n <span className={b('activity-slot')}>\n {activity?.isGenerating && (\n <Tooltip content={t('activity-generating')}>\n <span role=\"img\" aria-label={t('activity-generating')}>\n <Spin size=\"xs\" />\n </span>\n </Tooltip>\n )}\n </span>\n )}\n {showDeleteAction ? (\n <ActionButton\n tabIndex={actionTabIndex}\n view=\"flat\"\n size={deleteButtonSize}\n color=\"secondary\"\n loading={isDeleteProccesing}\n className={b('delete-button')}\n aria-label={t('tooltip-delete')}\n onClick={handleDeleteChat}\n onKeyDown={handleActionKeyDown}\n tooltipTitle={t('tooltip-delete')}\n >\n <Icon className={b('icon-button')} data={TrashBin} size={deleteIconSize} />\n </ActionButton>\n ) : null}\n {showActions && onPinnedChange && (\n <ActionButton\n tabIndex={actionTabIndex}\n view=\"flat\"\n size={deleteButtonSize}\n aria-disabled={Boolean(pinningDisabled || isDeleteProccesing)}\n className={b('pin-button')}\n aria-label={t(pinned ? 'action-unpin' : 'action-pin')}\n tooltipTitle={t(pinned ? 'action-unpin' : 'action-pin')}\n onKeyDown={handleActionKeyDown}\n onClick={(event) => {\n event.stopPropagation();\n if (!pinningDisabled && !isDeleteProccesing) {\n onPinnedChange(chat.id, !pinned);\n }\n }}\n >\n <Icon data={pinned ? PinSlash : Pin} size={deleteIconSize} />\n </ActionButton>\n )}\n </div>\n );\n}\n"]}
@@ -55,6 +55,20 @@
55
55
  .g-aikit-history__chat-item_is-delete-processing {
56
56
  color: var(--g-color-text-secondary);
57
57
  }
58
+ .g-aikit-history__activity-slot {
59
+ display: flex;
60
+ width: 16px;
61
+ flex: 0 0 16px;
62
+ align-items: center;
63
+ justify-content: center;
64
+ }
65
+ .g-aikit-history__unread-dot {
66
+ display: block;
67
+ width: 8px;
68
+ height: 8px;
69
+ border-radius: 50%;
70
+ background: var(--g-color-text-info);
71
+ }
58
72
  .g-aikit-history__chat-content {
59
73
  height: var(--g-aikit-history-item-height);
60
74
  flex: 1;
@@ -31,7 +31,7 @@ function History(props) {
31
31
  const handleChatClick = () => {
32
32
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
33
33
  };
34
- const list = (0, jsx_runtime_1.jsx)(HistoryList_1.HistoryList, Object.assign({}, listProps, { onChatClick: handleChatClick }));
34
+ const list = (0, jsx_runtime_1.jsx)(HistoryList_1.HistoryList, Object.assign({}, listProps, { preserveOrder: open, onChatClick: handleChatClick }));
35
35
  if (isMobile) {
36
36
  return ((0, jsx_runtime_1.jsx)(uikit_1.Sheet, { id: sheetId, title: t('sheet-title'), open: open, onOpenChange: onOpenChange, className: b('sheet'), contentClassName: b('sheet-content', {
37
37
  'without-title': !showSheetTitle,
@@ -1 +1 @@
1
- {"version":3,"file":"History.js","sourceRoot":"../../../../../src","sources":["components/templates/History/History.tsx"],"names":[],"mappings":";;AA4CA,0BA+DC;;;AA3GD,0DAA0B;AAE1B,6CAAsF;AAEtF,+EAAuE;AACv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,EACvB,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,EACrB,gBAAgB,EAAE,CAAC,CAAC,eAAe,EAAE;gBACjC,eAAe,EAAE,CAAC,cAAc;gBAChC,eAAe,EAAE,cAAc;aAClC,CAAC,EACF,EAAE,EAAC,eAAe,EAClB,wBAAwB,kBAEvB,IAAI,GACD,CACX,CAAC;IACN,CAAC;IAED,OAAO,CACH,uBAAC,aAAK,IACF,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAC,YAAY,EACtB,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,UAAU,YAEtB,IAAI,GACD,CACX,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\n\nimport {Popup, type PopupProps, Sheet, useMobile, useUniqId} from '@gravity-ui/uikit';\n\nimport {useSheetKeyboardFit} from '../../../hooks/useSheetKeyboardFit';\nimport {block} from '../../../utils/cn';\n\nimport {HistoryList, type HistoryListProps} from './HistoryList';\nimport {i18n} from './i18n';\n\nimport './History.scss';\n\nconst b = block('history');\n\n/**\n * Props for the History component\n */\nexport interface HistoryProps extends Omit<HistoryListProps, 'onChatClick'> {\n /** Control popup open state */\n open?: boolean;\n /** Callback when popup open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Anchor element for the popup */\n anchorElement: HTMLElement | null;\n /** Show the mobile sheet title (default: `true`); it stays in `aria-label` either way */\n showSheetTitle?: boolean;\n /**\n * Keep the keyboard focus inside the desktop popup while it is open (default: `true`).\n *\n * The popup is rendered in a portal, so without focus management `Tab` from the trigger\n * button walks through the rest of the page instead of entering the popup, and the chat\n * list cannot be reached from the keyboard at all.\n */\n modal?: boolean;\n /** The element to focus when the desktop popup opens (default: the popup itself) */\n initialFocus?: PopupProps['initialFocus'];\n}\n\n/**\n * History component - wraps HistoryList in a Popup, and in a bottom Sheet in mobile mode\n *\n * @param props - Component props\n * @returns React component\n */\nexport function History(props: HistoryProps) {\n const {t} = i18n.useTranslation();\n const {\n open = false,\n onOpenChange,\n anchorElement,\n showSheetTitle = true,\n modal = true,\n initialFocus,\n ...listProps\n } = props;\n const isMobile = useMobile();\n const sheetId = useUniqId();\n const {isKeyboardOpen} = useSheetKeyboardFit(isMobile && open, `.${b('sheet')}`);\n\n // `Popup` runs its props through uikit's `filterDOMProps` without the `labelable` option, so an\n // `aria-label` passed to it never reaches the floating element. Set it on the element instead.\n const labelPopup = React.useCallback(\n (node: HTMLDivElement | null) => {\n node?.setAttribute('aria-label', t('sheet-title'));\n },\n [t],\n );\n\n const handleChatClick = () => {\n onOpenChange?.(false);\n };\n\n const list = <HistoryList {...listProps} onChatClick={handleChatClick} />;\n\n if (isMobile) {\n return (\n <Sheet\n id={sheetId}\n title={t('sheet-title')}\n open={open}\n onOpenChange={onOpenChange}\n className={b('sheet')}\n contentClassName={b('sheet-content', {\n 'without-title': !showSheetTitle,\n 'keyboard-open': isKeyboardOpen,\n })}\n qa=\"history-sheet\"\n allowHideOnContentScroll\n >\n {list}\n </Sheet>\n );\n }\n\n return (\n <Popup\n anchorElement={anchorElement}\n placement=\"bottom-end\"\n open={open}\n onOpenChange={onOpenChange}\n modal={modal}\n initialFocus={initialFocus}\n floatingRef={labelPopup}\n >\n {list}\n </Popup>\n );\n}\n"]}
1
+ {"version":3,"file":"History.js","sourceRoot":"../../../../../src","sources":["components/templates/History/History.tsx"],"names":[],"mappings":";;AA4CA,0BA+DC;;;AA3GD,0DAA0B;AAE1B,6CAAsF;AAEtF,+EAAuE;AACvE,6CAAwC;AAExC,kDAAiE;AACjE,0CAA4B;AAE5B,yBAAwB;AAExB,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,SAAS,CAAC,CAAC;AA0B3B;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,KAAmB;IACvC,MAAM,EAAC,CAAC,EAAC,GAAG,WAAI,CAAC,cA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aAClC,CAAC,EACF,EAAE,EAAC,eAAe,EAClB,wBAAwB,kBAEvB,IAAI,GACD,CACX,CAAC;IACN,CAAC;IAED,OAAO,CACH,uBAAC,aAAK,IACF,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAC,YAAY,EACtB,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,UAAU,YAEtB,IAAI,GACD,CACX,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\n\nimport {Popup, type PopupProps, Sheet, useMobile, useUniqId} from '@gravity-ui/uikit';\n\nimport {useSheetKeyboardFit} from '../../../hooks/useSheetKeyboardFit';\nimport {block} from '../../../utils/cn';\n\nimport {HistoryList, type HistoryListProps} from './HistoryList';\nimport {i18n} from './i18n';\n\nimport './History.scss';\n\nconst b = block('history');\n\n/**\n * Props for the History component\n */\nexport interface HistoryProps extends Omit<HistoryListProps, 'onChatClick'> {\n /** Control popup open state */\n open?: boolean;\n /** Callback when popup open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Anchor element for the popup */\n anchorElement: HTMLElement | null;\n /** Show the mobile sheet title (default: `true`); it stays in `aria-label` either way */\n showSheetTitle?: boolean;\n /**\n * Keep the keyboard focus inside the desktop popup while it is open (default: `true`).\n *\n * The popup is rendered in a portal, so without focus management `Tab` from the trigger\n * button walks through the rest of the page instead of entering the popup, and the chat\n * list cannot be reached from the keyboard at all.\n */\n modal?: boolean;\n /** The element to focus when the desktop popup opens (default: the popup itself) */\n initialFocus?: PopupProps['initialFocus'];\n}\n\n/**\n * History component - wraps HistoryList in a Popup, and in a bottom Sheet in mobile mode\n *\n * @param props - Component props\n * @returns React component\n */\nexport function History(props: HistoryProps) {\n const {t} = i18n.useTranslation();\n const {\n open = false,\n onOpenChange,\n anchorElement,\n showSheetTitle = true,\n modal = true,\n initialFocus,\n ...listProps\n } = props;\n const isMobile = useMobile();\n const sheetId = useUniqId();\n const {isKeyboardOpen} = useSheetKeyboardFit(isMobile && open, `.${b('sheet')}`);\n\n // `Popup` runs its props through uikit's `filterDOMProps` without the `labelable` option, so an\n // `aria-label` passed to it never reaches the floating element. Set it on the element instead.\n const labelPopup = React.useCallback(\n (node: HTMLDivElement | null) => {\n node?.setAttribute('aria-label', t('sheet-title'));\n },\n [t],\n );\n\n const handleChatClick = () => {\n onOpenChange?.(false);\n };\n\n const list = <HistoryList {...listProps} preserveOrder={open} onChatClick={handleChatClick} />;\n\n if (isMobile) {\n return (\n <Sheet\n id={sheetId}\n title={t('sheet-title')}\n open={open}\n onOpenChange={onOpenChange}\n className={b('sheet')}\n contentClassName={b('sheet-content', {\n 'without-title': !showSheetTitle,\n 'keyboard-open': isKeyboardOpen,\n })}\n qa=\"history-sheet\"\n allowHideOnContentScroll\n >\n {list}\n </Sheet>\n );\n }\n\n return (\n <Popup\n anchorElement={anchorElement}\n placement=\"bottom-end\"\n open={open}\n onOpenChange={onOpenChange}\n modal={modal}\n initialFocus={initialFocus}\n floatingRef={labelPopup}\n >\n {list}\n </Popup>\n );\n}\n"]}
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { DOMProps, InputControlSize, QAProps } from '@gravity-ui/uikit';
3
3
  import { DateLocaleConfig } from "../../../hooks/index.js";
4
4
  import { ChatType } from "../../../types/index.js";
5
+ import type { ChatActivityStore } from "../../../utils/chatActivityStore.js";
5
6
  import { ChatFilterFunction } from "../../../utils/chatUtils.js";
6
7
  import "./History.css";
7
8
  /** Result of lazy load more callback - either array of new chats or object with chats and hasMore flag */
@@ -19,6 +20,10 @@ export type HistoryLoadMode = 'full' | 'lazy';
19
20
  export interface HistoryListProps extends QAProps, DOMProps {
20
21
  /** Array of chat items */
21
22
  chats: ChatType[];
23
+ /** Shared account-scoped activity store. Opening history never acknowledges responses. */
24
+ activityStore?: ChatActivityStore;
25
+ /** Keep existing chat order stable while a popup is open. */
26
+ preserveOrder?: boolean;
22
27
  /** Controlled pinned identifiers. Omit to disable pinning. */
23
28
  pinnedChatIds?: readonly string[];
24
29
  /** Requests a pin state change; the application updates pinnedChatIds. */
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = tslib_1.__importStar(require("react"));
7
7
  const uikit_1 = require("@gravity-ui/uikit");
8
+ const useChatActivity_1 = require("../../../hooks/useChatActivity.js");
8
9
  const useMobileControlSize_1 = require("../../../hooks/useMobileControlSize.js");
9
10
  const chatUtils_1 = require("../../../utils/chatUtils.js");
10
11
  const cn_1 = require("../../../utils/cn.js");
@@ -24,7 +25,9 @@ const b = (0, cn_1.block)('history');
24
25
  function HistoryList(props) {
25
26
  var _a, _b;
26
27
  const { t } = i18n_1.i18n.useTranslation();
27
- const { chats, selectedChat, pinnedChatIds, onPinnedChange, pinningDisabled, onSelectChat, onDeleteChat, onLoadMore, hasMore = false, loadMode = 'full', searchable = true, groupBy = 'date', dateFormat, dateLocale, dateLocaleConfig, showActions = true, emptyPlaceholder, emptyFilteredPlaceholder, searchPlaceholder, className, qa, style, filterFunction = chatUtils_1.defaultChatFilter, loading = false, onChatClick, size: sizeProp, } = props;
28
+ const { chats, activityStore, preserveOrder = false, selectedChat, pinnedChatIds, onPinnedChange, pinningDisabled, onSelectChat, onDeleteChat, onLoadMore, hasMore = false, loadMode = 'full', searchable = true, groupBy = 'date', dateFormat, dateLocale, dateLocaleConfig, showActions = true, emptyPlaceholder, emptyFilteredPlaceholder, searchPlaceholder, className, qa, style, filterFunction = chatUtils_1.defaultChatFilter, loading = false, onChatClick, size: sizeProp, } = props;
29
+ const activity = (0, useChatActivity_1.useChatActivity)(activityStore);
30
+ const orderRef = (0, react_1.useRef)([]);
28
31
  const size = (0, useMobileControlSize_1.useMobileControlSize)(sizeProp, 'm', 'xl');
29
32
  const [filter, setFilter] = (0, react_1.useState)('');
30
33
  const [activeItemId, setActiveItemId] = (0, react_1.useState)(null);
@@ -41,8 +44,14 @@ function HistoryList(props) {
41
44
  const displayChats = (0, react_1.useMemo)(() => {
42
45
  const totalChats = loadMode === 'lazy' ? [...chats, ...loadedChats] : chats;
43
46
  const filteredChats = totalChats.filter((chat) => !deletedChats.has(chat.id));
44
- return filteredChats;
45
- }, [loadMode, chats, loadedChats, deletedChats]);
47
+ if (!preserveOrder)
48
+ return filteredChats;
49
+ const positions = new Map(orderRef.current.map((id, index) => [id, index]));
50
+ return filteredChats.sort((first, second) => { var _a, _b; return ((_a = positions.get(first.id)) !== null && _a !== void 0 ? _a : Infinity) - ((_b = positions.get(second.id)) !== null && _b !== void 0 ? _b : Infinity); });
51
+ }, [loadMode, chats, loadedChats, deletedChats, preserveOrder]);
52
+ (0, react_1.useEffect)(() => {
53
+ orderRef.current = displayChats.map((chat) => chat.id);
54
+ }, [displayChats]);
46
55
  const displayChatsLengthRef = (0, react_1.useRef)(displayChats.length);
47
56
  displayChatsLengthRef.current = displayChats.length;
48
57
  (0, react_1.useEffect)(() => {
@@ -152,6 +161,7 @@ function HistoryList(props) {
152
161
  e.stopPropagation();
153
162
  try {
154
163
  await (onDeleteChat === null || onDeleteChat === void 0 ? void 0 : onDeleteChat(chat));
164
+ activityStore === null || activityStore === void 0 ? void 0 : activityStore.deleteChat(chat.id);
155
165
  setDeletedChats((prevDeletedChats) => new Set([...prevDeletedChats, chat.id]));
156
166
  }
157
167
  catch (error) {
@@ -173,7 +183,7 @@ function HistoryList(props) {
173
183
  if (item.type === 'date-header') {
174
184
  return ((0, jsx_runtime_1.jsx)(DateHeaderItem_1.DateHeaderItem, { date: item.date, format: dateFormat, locale: dateLocale, localeConfig: dateLocaleConfig }, `date-${item.date}`));
175
185
  }
176
- return ((0, jsx_runtime_1.jsx)(ChatItem_1.ChatItem, { chat: item, showActions: showActions, pinned: pinnedChatIds === null || pinnedChatIds === void 0 ? void 0 : pinnedChatIds.includes(item.id), onPinnedChange: pinnedChatIds === undefined ? undefined : onPinnedChange, pinningDisabled: pinningDisabled, onDeleteClick: onDeleteChat ? handleDeleteClick : undefined, isActive: isActive, actionTabIndex: searchable ? 0 : -1, size: sizeProp }, item.id));
186
+ return ((0, jsx_runtime_1.jsx)(ChatItem_1.ChatItem, { chat: item, activity: activity.chats[item.id], showActivity: Boolean(activityStore), showActions: showActions, pinned: pinnedChatIds === null || pinnedChatIds === void 0 ? void 0 : pinnedChatIds.includes(item.id), onPinnedChange: pinnedChatIds === undefined ? undefined : onPinnedChange, pinningDisabled: pinningDisabled, onDeleteClick: onDeleteChat ? handleDeleteClick : undefined, isActive: isActive, actionTabIndex: searchable ? 0 : -1, size: sizeProp }, item.id));
177
187
  };
178
188
  const emptyState = emptyPlaceholder || (0, jsx_runtime_1.jsx)("div", { className: b('empty'), children: t('empty-state') });
179
189
  const emptyFilteredState = emptyFilteredPlaceholder || ((0, jsx_runtime_1.jsx)("div", { className: b('empty'), children: t('empty-filtered-state') }));