@gravity-ui/aikit 3.2.0 → 3.2.1-beta.1aac79f032fbf3736ea779b72ad01fc80295d5fe.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 (24) hide show
  1. package/build/cjs/components/pages/ChatContainer/ChatContainer.css +16 -0
  2. package/build/cjs/components/pages/ChatContainer/ChatContainer.js +4 -2
  3. package/build/cjs/components/pages/ChatContainer/ChatContainer.js.map +1 -1
  4. package/build/cjs/components/pages/ChatContainer/useChatExport.js +46 -17
  5. package/build/cjs/components/pages/ChatContainer/useChatExport.js.map +1 -1
  6. package/build/cjs/components/pages/ChatContainer/useChatExportFeedbackPosition.d.ts +3 -0
  7. package/build/cjs/components/pages/ChatContainer/useChatExportFeedbackPosition.js +35 -0
  8. package/build/cjs/components/pages/ChatContainer/useChatExportFeedbackPosition.js.map +1 -0
  9. package/build/cjs/package.json +1 -1
  10. package/build/cjs/utils/chatMarkdown.js +101 -2
  11. package/build/cjs/utils/chatMarkdown.js.map +1 -1
  12. package/build/docs/components/pages/ChatContainer.md +8 -3
  13. package/build/esm/components/pages/ChatContainer/ChatContainer.css +16 -0
  14. package/build/esm/components/pages/ChatContainer/ChatContainer.js +5 -3
  15. package/build/esm/components/pages/ChatContainer/ChatContainer.js.map +1 -1
  16. package/build/esm/components/pages/ChatContainer/useChatExport.js +47 -18
  17. package/build/esm/components/pages/ChatContainer/useChatExport.js.map +1 -1
  18. package/build/esm/components/pages/ChatContainer/useChatExportFeedbackPosition.d.ts +3 -0
  19. package/build/esm/components/pages/ChatContainer/useChatExportFeedbackPosition.js +32 -0
  20. package/build/esm/components/pages/ChatContainer/useChatExportFeedbackPosition.js.map +1 -0
  21. package/build/esm/package.json +1 -1
  22. package/build/esm/utils/chatMarkdown.js +101 -2
  23. package/build/esm/utils/chatMarkdown.js.map +1 -1
  24. package/package.json +1 -1
@@ -3,6 +3,103 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMessageMarkdown = getMessageMarkdown;
4
4
  exports.serializeChatMarkdown = serializeChatMarkdown;
5
5
  exports.downloadChatMarkdown = downloadChatMarkdown;
6
+ const marked_1 = require("marked");
7
+ function escapeMarkdownSyntax(text) {
8
+ return text.replace(/&/g, '&amp;').replace(/[\\`*_{}[\]()<>#+.!|~-]/g, '\\$&');
9
+ }
10
+ function escapePlainText(text) {
11
+ let cursor = 0;
12
+ let result = '';
13
+ for (const match of text.matchAll(/(?:https?:\/\/|www\.)[^\s<>]+/gi)) {
14
+ const token = marked_1.Lexer.lexInline(match[0])[0];
15
+ if ((token === null || token === void 0 ? void 0 : token.type) !== 'link')
16
+ continue;
17
+ const offset = match.index;
18
+ const href = token.href.replace(/&/g, '&amp;').replace(/</g, '%3C').replace(/>/g, '%3E');
19
+ result += escapeMarkdownSyntax(text.slice(cursor, offset));
20
+ result += `[${escapeMarkdownSyntax(token.raw)}](<${href}>)`;
21
+ cursor = offset + token.raw.length;
22
+ }
23
+ return result + escapeMarkdownSyntax(text.slice(cursor));
24
+ }
25
+ function rewriteChildren(raw, tokens, rewrite) {
26
+ let cursor = 0;
27
+ let result = '';
28
+ for (const token of tokens) {
29
+ const offset = raw.indexOf(token.raw, cursor);
30
+ if (offset < 0)
31
+ continue;
32
+ result += raw.slice(cursor, offset) + rewrite(token);
33
+ cursor = offset + token.raw.length;
34
+ }
35
+ return result + raw.slice(cursor);
36
+ }
37
+ function closeCodeFence(raw) {
38
+ const fence = raw.match(/^ {0,3}(`{3,}|~{3,})/);
39
+ if (!fence)
40
+ return raw;
41
+ const closing = new RegExp(`\\n {0,3}${fence[1][0]}{${fence[1].length},}[ \\t]*(?:\\n)?$`);
42
+ return closing.test(raw) ? raw : `${raw}\n${fence[1]}\n`;
43
+ }
44
+ /** Resolve references per message before joining independent Markdown documents. */
45
+ function isolateMarkdown(markdown) {
46
+ const rewrite = (token) => {
47
+ var _a, _b, _c, _d, _e, _f;
48
+ if (token.type === 'def')
49
+ return '';
50
+ if ((token.type === 'link' || token.type === 'image') &&
51
+ /^!?\[/.test(token.raw) &&
52
+ token.raw.endsWith(']')) {
53
+ const href = token.href
54
+ .replace(/</g, '%3C')
55
+ .replace(/>/g, '%3E')
56
+ .replace(/\s/g, encodeURIComponent);
57
+ const title = token.title
58
+ ? ` "${token.title.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`
59
+ : '';
60
+ return `${token.type === 'image' ? '!' : ''}[${token.text}](<${href}>${title})`;
61
+ }
62
+ if (token.type === 'code') {
63
+ return closeCodeFence(token.raw);
64
+ }
65
+ if (token.type === 'blockquote') {
66
+ const text = ((_a = token.tokens) !== null && _a !== void 0 ? _a : []).map(rewrite).join('');
67
+ return text === token.text
68
+ ? token.raw
69
+ : text
70
+ .split('\n')
71
+ .map((line) => `> ${line}`)
72
+ .join('\n') + '\n';
73
+ }
74
+ if (token.type === 'list')
75
+ return rewriteChildren(token.raw, token.items, rewrite);
76
+ if (token.type === 'list_item') {
77
+ const text = ((_b = token.tokens) !== null && _b !== void 0 ? _b : []).map(rewrite).join('');
78
+ if (text === token.text)
79
+ return token.raw;
80
+ const prefix = (_d = (_c = token.raw.match(/^\s*(?:[-+*]|\d+[.)])\s+/)) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : '- ';
81
+ const checkbox = token.task ? `[${token.checked ? 'x' : ' '}] ` : '';
82
+ const trailingNewlines = (_f = (_e = token.raw.match(/\n+$/)) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : '';
83
+ const body = text.replace(/\n+$/, '');
84
+ return (prefix +
85
+ checkbox +
86
+ body.split('\n').join(`\n${' '.repeat(prefix.length)}`) +
87
+ trailingNewlines);
88
+ }
89
+ if (token.type === 'table') {
90
+ return rewriteChildren(token.raw, [...token.header, ...token.rows.flat()].map((cell) => ({
91
+ type: 'text',
92
+ raw: cell.text,
93
+ text: cell.text,
94
+ tokens: cell.tokens,
95
+ })), rewrite);
96
+ }
97
+ return 'tokens' in token && token.tokens
98
+ ? rewriteChildren(token.raw, token.tokens, rewrite)
99
+ : token.raw;
100
+ };
101
+ return marked_1.Lexer.lex(markdown).map(rewrite).join('');
102
+ }
6
103
  /** Extract public text only. Thinking, tool payloads and unknown content are excluded by default. */
7
104
  function getMessageMarkdown(message, options = {}) {
8
105
  var _a, _b, _c;
@@ -11,7 +108,9 @@ function getMessageMarkdown(message, options = {}) {
11
108
  }
12
109
  const parts = [];
13
110
  if (typeof message.content === 'string') {
14
- parts.push(message.content);
111
+ parts.push(message.role === 'user' && message.format !== 'markdown'
112
+ ? escapePlainText(message.content)
113
+ : message.content);
15
114
  }
16
115
  else {
17
116
  const content = Array.isArray(message.content) ? message.content : [message.content];
@@ -50,7 +149,7 @@ function serializeChatMarkdown(messages, options = {}) {
50
149
  const labels = (_a = options.roleLabels) !== null && _a !== void 0 ? _a : { user: 'User', assistant: 'Assistant' };
51
150
  return messages
52
151
  .flatMap((message) => {
53
- const text = getMessageMarkdown(message, options);
152
+ const text = isolateMarkdown(getMessageMarkdown(message, options));
54
153
  return text ? [`## ${labels[message.role]}\n\n${text}`] : [];
55
154
  })
56
155
  .join('\n\n');
@@ -1 +1 @@
1
- {"version":3,"file":"chatMarkdown.js","sourceRoot":"../../../src","sources":["utils/chatMarkdown.ts"],"names":[],"mappings":";;AAaA,gDA0CC;AAGD,sDAWC;AAED,oDAcC;AAzED,qGAAqG;AACrG,SAAgB,kBAAkB,CAC9B,OAAsC,EACtC,UAA+B,EAAE;;IAEjC,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC1D,OAAO,EAAE,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;Q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B,4CAA4C;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC1F,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;YAAS,CAAC;QACP,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,2EAA2E;QAC3E,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;AACL,CAAC","sourcesContent":["import type {TChatMessage, TMessageContent} from '../types/messages';\n\nexport interface ChatMarkdownOptions {\n /** Localized role labels used in Markdown headings. */\n roleLabels?: {user: string; assistant: string};\n /** Return only user-visible Markdown for custom content; never serialize raw payloads. */\n getContentMarkdown?: (\n content: TMessageContent,\n message: TChatMessage<TMessageContent>,\n ) => string | undefined;\n}\n\n/** Extract public text only. Thinking, tool payloads and unknown content are excluded by default. */\nexport function getMessageMarkdown(\n message: TChatMessage<TMessageContent>,\n options: ChatMarkdownOptions = {},\n): string {\n if (message.role !== 'user' && message.role !== 'assistant') {\n return '';\n }\n const parts: string[] = [];\n if (typeof message.content === 'string') {\n parts.push(message.content);\n } else {\n const content = Array.isArray(message.content) ? message.content : [message.content];\n for (const item of content) {\n if (item.type === 'text') {\n if (\n typeof item.data === 'object' &&\n item.data !== null &&\n 'text' in item.data &&\n typeof item.data.text === 'string'\n ) {\n parts.push(item.data.text);\n }\n } else if (item.type !== 'thinking' && item.type !== 'tool') {\n const text = options.getContentMarkdown?.(item, message);\n if (text) parts.push(text);\n }\n }\n }\n if (message.role === 'user') {\n for (const file of message.fileAttachments ?? []) {\n parts.push(file.name.replace(/[\\\\`*_{}[\\]()<>#+.!|~-]/g, '\\\\$&'));\n }\n for (const image of message.images ?? []) {\n // Inline image data can be large and is not a portable attachment link.\n if (/^https?:\\/\\//i.test(image)) {\n parts.push(\n `<${image.replace(/</g, '%3C').replace(/>/g, '%3E').replace(/\\s/g, encodeURIComponent)}>`,\n );\n }\n }\n }\n return parts.filter((part) => part.trim()).join('\\n\\n');\n}\n\n/** Preserve source order and Markdown, without reading rendered or virtualized DOM content. */\nexport function serializeChatMarkdown(\n messages: readonly TChatMessage<TMessageContent>[],\n options: ChatMarkdownOptions = {},\n): string {\n const labels = options.roleLabels ?? {user: 'User', assistant: 'Assistant'};\n return messages\n .flatMap((message) => {\n const text = getMessageMarkdown(message, options);\n return text ? [`## ${labels[message.role]}\\n\\n${text}`] : [];\n })\n .join('\\n\\n');\n}\n\nexport function downloadChatMarkdown(markdown: string, filename = 'chat.md'): void {\n const url = URL.createObjectURL(new Blob([markdown], {type: 'text/markdown;charset=utf-8'}));\n const link = document.createElement('a');\n try {\n link.href = url;\n // eslint-disable-next-line no-control-regex\n link.download = filename.replace(/[\\\\/\\u0000-\\u001f]/g, '_').replace(/(?:\\.md)?$/, '.md');\n document.body.appendChild(link);\n link.click();\n } finally {\n link.remove();\n // Allow the browser to start consuming the object URL before releasing it.\n setTimeout(() => URL.revokeObjectURL(url), 0);\n }\n}\n"]}
1
+ {"version":3,"file":"chatMarkdown.js","sourceRoot":"../../../src","sources":["utils/chatMarkdown.ts"],"names":[],"mappings":";;AAqHA,gDA8CC;AAGD,sDAWC;AAED,oDAcC;AAjMD,mCAAyC;AAczC,SAAS,oBAAoB,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACjC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,iCAAiC,CAA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, type Token} from 'marked';\n\nimport type {TChatMessage, TMessageContent} from '../types/messages';\n\nexport interface ChatMarkdownOptions {\n /** Localized role labels used in Markdown headings. */\n roleLabels?: {user: string; assistant: string};\n /** Return only user-visible Markdown for custom content; never serialize raw payloads. */\n getContentMarkdown?: (\n content: TMessageContent,\n message: TChatMessage<TMessageContent>,\n ) => string | undefined;\n}\n\nfunction escapeMarkdownSyntax(text: string): string {\n return text.replace(/&/g, '&amp;').replace(/[\\\\`*_{}[\\]()<>#+.!|~-]/g, '\\\\$&');\n}\n\nfunction escapePlainText(text: string): string {\n let cursor = 0;\n let result = '';\n for (const match of text.matchAll(/(?:https?:\\/\\/|www\\.)[^\\s<>]+/gi)) {\n const token = Lexer.lexInline(match[0])[0];\n if (token?.type !== 'link') continue;\n const offset = match.index;\n const href = token.href.replace(/&/g, '&amp;').replace(/</g, '%3C').replace(/>/g, '%3E');\n result += escapeMarkdownSyntax(text.slice(cursor, offset));\n result += `[${escapeMarkdownSyntax(token.raw)}](<${href}>)`;\n cursor = offset + token.raw.length;\n }\n return result + escapeMarkdownSyntax(text.slice(cursor));\n}\n\nfunction rewriteChildren(raw: string, tokens: Token[], rewrite: (token: Token) => string): string {\n let cursor = 0;\n let result = '';\n for (const token of tokens) {\n const offset = raw.indexOf(token.raw, cursor);\n if (offset < 0) continue;\n result += raw.slice(cursor, offset) + rewrite(token);\n cursor = offset + token.raw.length;\n }\n return result + raw.slice(cursor);\n}\n\nfunction closeCodeFence(raw: string): string {\n const fence = raw.match(/^ {0,3}(`{3,}|~{3,})/);\n if (!fence) return raw;\n const closing = new RegExp(`\\\\n {0,3}${fence[1][0]}{${fence[1].length},}[ \\\\t]*(?:\\\\n)?$`);\n return closing.test(raw) ? raw : `${raw}\\n${fence[1]}\\n`;\n}\n\n/** Resolve references per message before joining independent Markdown documents. */\nfunction isolateMarkdown(markdown: string): string {\n const rewrite = (token: Token): string => {\n if (token.type === 'def') return '';\n if (\n (token.type === 'link' || token.type === 'image') &&\n /^!?\\[/.test(token.raw) &&\n token.raw.endsWith(']')\n ) {\n const href = token.href\n .replace(/</g, '%3C')\n .replace(/>/g, '%3E')\n .replace(/\\s/g, encodeURIComponent);\n const title = token.title\n ? ` \"${token.title.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')}\"`\n : '';\n return `${token.type === 'image' ? '!' : ''}[${token.text}](<${href}>${title})`;\n }\n if (token.type === 'code') {\n return closeCodeFence(token.raw);\n }\n if (token.type === 'blockquote') {\n const text = (token.tokens ?? []).map(rewrite).join('');\n return text === token.text\n ? token.raw\n : text\n .split('\\n')\n .map((line) => `> ${line}`)\n .join('\\n') + '\\n';\n }\n if (token.type === 'list') return rewriteChildren(token.raw, token.items, rewrite);\n if (token.type === 'list_item') {\n const text = (token.tokens ?? []).map(rewrite).join('');\n if (text === token.text) return token.raw;\n const prefix = token.raw.match(/^\\s*(?:[-+*]|\\d+[.)])\\s+/)?.[0] ?? '- ';\n const checkbox = token.task ? `[${token.checked ? 'x' : ' '}] ` : '';\n const trailingNewlines = token.raw.match(/\\n+$/)?.[0] ?? '';\n const body = text.replace(/\\n+$/, '');\n return (\n prefix +\n checkbox +\n body.split('\\n').join(`\\n${' '.repeat(prefix.length)}`) +\n trailingNewlines\n );\n }\n if (token.type === 'table') {\n return rewriteChildren(\n token.raw,\n [...token.header, ...token.rows.flat()].map((cell) => ({\n type: 'text',\n raw: cell.text,\n text: cell.text,\n tokens: cell.tokens,\n })),\n rewrite,\n );\n }\n return 'tokens' in token && token.tokens\n ? rewriteChildren(token.raw, token.tokens, rewrite)\n : token.raw;\n };\n return Lexer.lex(markdown).map(rewrite).join('');\n}\n\n/** Extract public text only. Thinking, tool payloads and unknown content are excluded by default. */\nexport function getMessageMarkdown(\n message: TChatMessage<TMessageContent>,\n options: ChatMarkdownOptions = {},\n): string {\n if (message.role !== 'user' && message.role !== 'assistant') {\n return '';\n }\n const parts: string[] = [];\n if (typeof message.content === 'string') {\n parts.push(\n message.role === 'user' && message.format !== 'markdown'\n ? escapePlainText(message.content)\n : message.content,\n );\n } else {\n const content = Array.isArray(message.content) ? message.content : [message.content];\n for (const item of content) {\n if (item.type === 'text') {\n if (\n typeof item.data === 'object' &&\n item.data !== null &&\n 'text' in item.data &&\n typeof item.data.text === 'string'\n ) {\n parts.push(item.data.text);\n }\n } else if (item.type !== 'thinking' && item.type !== 'tool') {\n const text = options.getContentMarkdown?.(item, message);\n if (text) parts.push(text);\n }\n }\n }\n if (message.role === 'user') {\n for (const file of message.fileAttachments ?? []) {\n parts.push(file.name.replace(/[\\\\`*_{}[\\]()<>#+.!|~-]/g, '\\\\$&'));\n }\n for (const image of message.images ?? []) {\n // Inline image data can be large and is not a portable attachment link.\n if (/^https?:\\/\\//i.test(image)) {\n parts.push(\n `<${image.replace(/</g, '%3C').replace(/>/g, '%3E').replace(/\\s/g, encodeURIComponent)}>`,\n );\n }\n }\n }\n return parts.filter((part) => part.trim()).join('\\n\\n');\n}\n\n/** Preserve source order and Markdown, without reading rendered or virtualized DOM content. */\nexport function serializeChatMarkdown(\n messages: readonly TChatMessage<TMessageContent>[],\n options: ChatMarkdownOptions = {},\n): string {\n const labels = options.roleLabels ?? {user: 'User', assistant: 'Assistant'};\n return messages\n .flatMap((message) => {\n const text = isolateMarkdown(getMessageMarkdown(message, options));\n return text ? [`## ${labels[message.role]}\\n\\n${text}`] : [];\n })\n .join('\\n\\n');\n}\n\nexport function downloadChatMarkdown(markdown: string, filename = 'chat.md'): void {\n const url = URL.createObjectURL(new Blob([markdown], {type: 'text/markdown;charset=utf-8'}));\n const link = document.createElement('a');\n try {\n link.href = url;\n // eslint-disable-next-line no-control-regex\n link.download = filename.replace(/[\\\\/\\u0000-\\u001f]/g, '_').replace(/(?:\\.md)?$/, '.md');\n document.body.appendChild(link);\n link.click();\n } finally {\n link.remove();\n // Allow the browser to start consuming the object URL before releasing it.\n setTimeout(() => URL.revokeObjectURL(url), 0);\n }\n}\n"]}
@@ -1388,6 +1388,7 @@ and selecting individual messages:
1388
1388
  activeChat={chat}
1389
1389
  messages={allMessages}
1390
1390
  status={status}
1391
+ onSendMessage={sendMessage}
1391
1392
  chatExport={{loading: isHistoryLoading, filename: 'conversation.md'}}
1392
1393
  />
1393
1394
  ```
@@ -1407,7 +1408,8 @@ older pages. Export is disabled for empty conversations and while a response is
1407
1408
  being generated. Keep `activeChat.id` stable and unique per conversation so pending
1408
1409
  clipboard results and message selection remain scoped to the originating chat.
1409
1410
 
1410
- Source Markdown is preserved. System messages, reasoning, tool calls, metadata,
1411
+ Markdown formatting is preserved; plain user messages are escaped. Open code fences
1412
+ are closed at message boundaries, and reference links keep their own destinations. System messages, reasoning, tool calls, metadata,
1411
1413
  and unknown content are excluded. File attachment names and HTTP(S) image links
1412
1414
  are included; inline image data and private attachment IDs are omitted. For custom
1413
1415
  cards, use `getContentMarkdown` to return their user-visible title, result, and link.
@@ -1415,9 +1417,12 @@ Do not return raw card payloads or private metadata. Built-in reasoning and tool
1415
1417
  content never invoke this callback.
1416
1418
 
1417
1419
  Copy and download feedback is localized in English and Russian and appears in the
1418
- chat or the selection dialog. Clipboard failures leave the action available for retry.
1420
+ bottom-right corner of the chat, above its content and the selection dialog. Clipboard failures leave the action available for retry.
1419
1421
  The same actions use the header's mobile menu on small screens. Updating message
1420
- history closes the selection dialog to prevent exporting a different selection.
1422
+ content or order closes the selection dialog to prevent exporting a different selection.
1423
+ Recreating an equivalent message array preserves the selection. Custom serializers run
1424
+ only when opening the message picker or exporting. Failed previews fall back to
1425
+ built-in text; exporting a failing message reports the serializer error.
1421
1426
 
1422
1427
  For custom integrations, `getMessageMarkdown`, `serializeChatMarkdown`,
1423
1428
  `downloadChatMarkdown`, and `ChatMarkdownOptions` are available from the package
@@ -14,6 +14,22 @@
14
14
  overflow: hidden;
15
15
  background: var(--g-aikit-chat-container-background);
16
16
  }
17
+ .g-aikit-chat-container__export-overlay {
18
+ position: fixed;
19
+ z-index: 1100;
20
+ pointer-events: none;
21
+ }
22
+ .g-aikit-chat-container__export-feedback {
23
+ position: absolute;
24
+ pointer-events: auto;
25
+ right: var(--g-spacing-4);
26
+ bottom: var(--g-spacing-4);
27
+ max-width: calc(100% - 2 * var(--g-spacing-4));
28
+ width: max-content;
29
+ background: var(--g-color-base-background);
30
+ border-radius: var(--g-border-radius-m);
31
+ box-shadow: 0 4px 16px var(--g-color-sfx-shadow);
32
+ }
17
33
  .g-aikit-chat-container_mobile {
18
34
  --g-aikit-scroll-overscroll-behavior: contain;
19
35
  --g-aikit-layout-base-padding-m: var(--g-aikit-chat-container-mobile-padding);
@@ -1,7 +1,7 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Fragment, useCallback, useMemo, useRef } from 'react';
4
- import { Alert, MobileProvider, useForkRef, useMobile } from '@gravity-ui/uikit';
4
+ import { Alert, MobileProvider, Portal, useForkRef, useMobile } from '@gravity-ui/uikit';
5
5
  import { getMascotAnimationType, useKeyboardViewportFit } from "../../../hooks/index.js";
6
6
  import { block } from "../../../utils/cn.js";
7
7
  import { getMascotNode, resolveMascotAssets, resolveMascotCollection } from "../../../utils/mascot.js";
@@ -17,6 +17,7 @@ import { i18n } from "./i18n/index.js";
17
17
  import { useChatContainer } from "./useChatContainer.js";
18
18
  import { useChatContainerMascot } from "./useChatContainerMascot.js";
19
19
  import { useChatExport } from "./useChatExport.js";
20
+ import { useChatExportFeedbackPosition } from "./useChatExportFeedbackPosition.js";
20
21
  import { useKeyboardLayoutFit } from "./useKeyboardLayoutFit.js";
21
22
  import "./ChatContainer.css";
22
23
  const b = block('chat-container');
@@ -111,7 +112,8 @@ export function ChatContainer(props) {
111
112
  status,
112
113
  config: props.chatExport,
113
114
  });
114
- const exportFeedback = chatExport.notice && (_jsx("div", { role: "status", children: _jsx(Alert, { theme: chatExport.notice.error ? 'danger' : 'success', message: chatExport.notice.text, onClose: chatExport.dismissNotice }) }));
115
+ const exportFeedbackPosition = useChatExportFeedbackPosition(rootRef, Boolean(chatExport.notice));
116
+ const exportFeedback = chatExport.notice && (_jsx(Portal, { children: _jsx("div", { className: b('export-overlay'), style: exportFeedbackPosition, children: _jsx("div", { role: "status", className: b('export-feedback'), children: _jsx(Alert, { theme: chatExport.notice.error ? 'danger' : 'success', message: chatExport.notice.text, onClose: chatExport.dismissNotice }) }) }) }));
115
117
  const mascotConfig = customMascotConfig !== null && customMascotConfig !== void 0 ? customMascotConfig : (showMascot ? DEFAULT_MASCOT_CONFIG : undefined);
116
118
  const mascotState = useChatContainerMascot({
117
119
  config: mascotConfig,
@@ -385,6 +387,6 @@ export function ChatContainer(props) {
385
387
  mobile: isMobile,
386
388
  'keyboard-open': isKeyboardOpen,
387
389
  'floating-header': floatingHeader,
388
- }, className), style: rootStyle, "data-qa": resolveChatContainerRootQa(qaMap), children: [isKeyboardTracked && (_jsx("div", { className: b('viewport-probe'), ref: viewportProbeRef, "aria-hidden": true })), _jsxs("div", { className: b('header', headerClassName), ref: headerRef, children: [_jsx(Header, Object.assign({}, finalHeaderProps, { menuItems: [...((_d = finalHeaderProps.menuItems) !== null && _d !== void 0 ? _d : []), ...chatExport.menuItems] })), !chatExport.dialogProps.open && exportFeedback] }), _jsx("div", { className: b('content', { view: hookState.chatContentView }, contentClassName), children: _jsx(ChatContent, Object.assign({}, finalContentProps)) }), showFooter && (_jsxs("div", { className: b('footer', { view: hookState.chatContentView }, footerClassName), ref: footerRef, children: [finalPromptInputProps && (_jsx(PromptInput, Object.assign({}, finalPromptInputProps), hookState.promptInputKey)), finalDisclaimerProps && _jsx(Disclaimer, Object.assign({}, finalDisclaimerProps))] })), _jsx(History, Object.assign({}, finalHistoryProps)), props.chatExport && (_jsx(ChatExportDialog, Object.assign({}, chatExport.dialogProps, { feedback: exportFeedback })))] }) }));
390
+ }, className), style: rootStyle, "data-qa": resolveChatContainerRootQa(qaMap), children: [isKeyboardTracked && (_jsx("div", { className: b('viewport-probe'), ref: viewportProbeRef, "aria-hidden": true })), _jsx("div", { className: b('header', headerClassName), ref: headerRef, children: _jsx(Header, Object.assign({}, finalHeaderProps, { menuItems: [...((_d = finalHeaderProps.menuItems) !== null && _d !== void 0 ? _d : []), ...chatExport.menuItems] })) }), _jsx("div", { className: b('content', { view: hookState.chatContentView }, contentClassName), children: _jsx(ChatContent, Object.assign({}, finalContentProps)) }), showFooter && (_jsxs("div", { className: b('footer', { view: hookState.chatContentView }, footerClassName), ref: footerRef, children: [finalPromptInputProps && (_jsx(PromptInput, Object.assign({}, finalPromptInputProps), hookState.promptInputKey)), finalDisclaimerProps && _jsx(Disclaimer, Object.assign({}, finalDisclaimerProps))] })), _jsx(History, Object.assign({}, finalHistoryProps)), !chatExport.dialogProps.open && exportFeedback, props.chatExport && chatExport.dialogProps.open && (_jsx(ChatExportDialog, Object.assign({}, chatExport.dialogProps, { feedback: exportFeedback })))] }) }));
389
391
  }
390
392
  //# sourceMappingURL=ChatContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainer.js","sourceRoot":"../../../../../src","sources":["components/pages/ChatContainer/ChatContainer.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAqB,QAAQ,EAAkB,WAAW,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAEjG,OAAO,EAAC,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,gCAAuB;AAE9E,OAAO,EAAC,KAAK,EAAC,6BAA0B;AACxC,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAE,uBAAuB,EAAC,iCAA8B;AAClG,OAAO,EAAC,UAAU,EAAC,wCAA+B;AAClD,OAAO,EAAC,MAAM,EAAE,YAAY,EAAmB,wCAA+B;AAC9E,OAAO,EACH,WAAW,GAGd,6CAAoC;AACrC,OAAO,EAAC,WAAW,EAAC,mDAAgD;AACpE,OAAO,EAAC,OAAO,EAAC,yCAAgC;AAEhD,OAAO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} 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":";;AAAA,OAAO,EAAqB,QAAQ,EAAkB,WAAW,EAAE,OAAO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EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,IAC7E,GACA,EACN,cAAK,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,EAAC,IAAI,EAAE,SAAS,CAAC,eAAe,EAAC,EAAE,gBAAgB,CAAC,YAC7E,KAAC,WAAW,oBAAK,iBAAiB,EAAI,GACpC,EACL,UAAU,IAAI,CACX,eACI,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,SAAS,CAAC,eAAe,EAAC,EAAE,eAAe,CAAC,EAC1E,GAAG,EAAE,SAAS,aAEb,qBAAqB,IAAI,CACtB,KAAC,WAAW,oBAEJ,qBAAqB,GADpB,SAAS,CAAC,cAAc,CAE/B,CACL,EACA,oBAAoB,IAAI,KAAC,UAAU,oBAAK,oBAAoB,EAAI,IAC/D,CACT,EAED,KAAC,OAAO,oBAAK,iBAAiB,EAAI,EACjC,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,IAAI,cAAc,EAC9C,KAAK,CAAC,UAAU,IAAI,UAAU,CAAC,WAAW,CAAC,IAAI,IAAI,CAChD,KAAC,gBAAgB,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, Portal, 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 {useChatExportFeedbackPosition} from './useChatExportFeedbackPosition';\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 exportFeedbackPosition = useChatExportFeedbackPosition(\n rootRef,\n Boolean(chatExport.notice),\n );\n const exportFeedback = chatExport.notice && (\n <Portal>\n <div className={b('export-overlay')} style={exportFeedbackPosition}>\n <div role=\"status\" className={b('export-feedback')}>\n <Alert\n theme={chatExport.notice.error ? 'danger' : 'success'}\n message={chatExport.notice.text}\n onClose={chatExport.dismissNotice}\n />\n </div>\n </div>\n </Portal>\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 </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 {!chatExport.dialogProps.open && exportFeedback}\n {props.chatExport && chatExport.dialogProps.open && (\n <ChatExportDialog {...chatExport.dialogProps} feedback={exportFeedback} />\n )}\n </div>\n </MobileProvider>\n );\n}\n"]}