@promptbook/utils 0.112.0-23 → 0.112.0-25

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 (29) hide show
  1. package/esm/index.es.js +1 -1
  2. package/esm/src/_packages/components.index.d.ts +2 -0
  3. package/esm/src/_packages/types.index.d.ts +2 -0
  4. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  5. package/esm/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +2 -0
  6. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  7. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +14 -2
  8. package/esm/src/book-components/Chat/Chat/ChatRatingModal.d.ts +5 -0
  9. package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +5 -1
  10. package/esm/src/book-components/Chat/hooks/useChatRatings.d.ts +5 -1
  11. package/esm/src/book-components/Chat/utils/createCitationFootnoteRenderModel.d.ts +53 -0
  12. package/esm/src/book-components/Chat/utils/createCitationFootnoteRenderModel.test.d.ts +1 -0
  13. package/esm/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +47 -0
  14. package/esm/src/version.d.ts +1 -1
  15. package/package.json +1 -1
  16. package/umd/index.umd.js +1 -1
  17. package/umd/src/_packages/components.index.d.ts +2 -0
  18. package/umd/src/_packages/types.index.d.ts +2 -0
  19. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  20. package/umd/src/book-components/Chat/Chat/ChatMessageItem.test.d.ts +2 -0
  21. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  22. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +14 -2
  23. package/umd/src/book-components/Chat/Chat/ChatRatingModal.d.ts +5 -0
  24. package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +5 -1
  25. package/umd/src/book-components/Chat/hooks/useChatRatings.d.ts +5 -1
  26. package/umd/src/book-components/Chat/utils/createCitationFootnoteRenderModel.d.ts +53 -0
  27. package/umd/src/book-components/Chat/utils/createCitationFootnoteRenderModel.test.d.ts +1 -0
  28. package/umd/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +47 -0
  29. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -18,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
18
18
  * @generated
19
19
  * @see https://github.com/webgptorg/promptbook
20
20
  */
21
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-23';
21
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-25';
22
22
  /**
23
23
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
24
24
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -16,6 +16,7 @@ import { AgentChat } from '../book-components/Chat/AgentChat/AgentChat';
16
16
  import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
17
17
  import { Chat } from '../book-components/Chat/Chat/Chat';
18
18
  import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
19
+ import type { ChatFeedbackMode } from '../book-components/Chat/Chat/ChatProps';
19
20
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
20
21
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
21
22
  import { ChatSoundToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
@@ -92,6 +93,7 @@ export { AgentChat };
92
93
  export type { AgentChatProps };
93
94
  export { Chat };
94
95
  export type { ChatFeedbackResponse };
96
+ export type { ChatFeedbackMode };
95
97
  export type { ChatSoundSystem };
96
98
  export type { ChatProps };
97
99
  export { ChatSoundToggle };
@@ -17,6 +17,7 @@ import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChat
17
17
  import type { AgentChipData } from '../book-components/Chat/AgentChip/AgentChip';
18
18
  import type { AgentChipProps } from '../book-components/Chat/AgentChip/AgentChip';
19
19
  import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
20
+ import type { ChatFeedbackMode } from '../book-components/Chat/Chat/ChatProps';
20
21
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
21
22
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
22
23
  import type { ChatSoundToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
@@ -440,6 +441,7 @@ export type { AgentChatProps };
440
441
  export type { AgentChipData };
441
442
  export type { AgentChipProps };
442
443
  export type { ChatFeedbackResponse };
444
+ export type { ChatFeedbackMode };
443
445
  export type { ChatSoundSystem };
444
446
  export type { ChatProps };
445
447
  export type { ChatSoundToggleProps };
@@ -26,6 +26,10 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'pa
26
26
  * Enables the feedback (rating) UI for this message bubble.
27
27
  */
28
28
  isFeedbackEnabled?: boolean;
29
+ /**
30
+ * Chooses which feedback controls should be rendered.
31
+ */
32
+ feedbackMode?: ChatProps['feedbackMode'];
29
33
  /**
30
34
  * Called when the copy button is pressed.
31
35
  */
@@ -0,0 +1,2 @@
1
+ /** @jest-environment jsdom */
2
+ export {};
@@ -20,6 +20,10 @@ export type ChatMessageListProps = {
20
20
  mode: 'LIGHT' | 'DARK';
21
21
  isCopyButtonEnabled?: boolean;
22
22
  isFeedbackEnabled?: boolean;
23
+ /**
24
+ * Chooses which feedback controls should be rendered.
25
+ */
26
+ feedbackMode?: ChatProps['feedbackMode'];
23
27
  onCopy?: () => void;
24
28
  onMessage?: (messageContent: string) => Promisable<void>;
25
29
  onActionButton?: ChatProps['onActionButton'];
@@ -18,6 +18,12 @@ export type ChatFeedbackResponse = {
18
18
  */
19
19
  readonly message?: string;
20
20
  };
21
+ /**
22
+ * Visual mode for post-response feedback actions.
23
+ *
24
+ * @public exported from `@promptbook/components`
25
+ */
26
+ export type ChatFeedbackMode = 'off' | 'stars' | 'report_issue';
21
27
  /**
22
28
  * Interface for sound system that can be passed to Chat component
23
29
  * This allows the chat to trigger sounds without tight coupling
@@ -275,11 +281,11 @@ export type ChatProps = {
275
281
  onCreateAgent?: (bookContent: string) => void;
276
282
  /**
277
283
  * Optional callback for handling user feedback on messages
278
- * When provided, star rating buttons (1-5 stars) will be displayed next to each message
284
+ * When provided, message feedback actions are displayed according to `feedbackMode`.
279
285
  *
280
286
  * @param feedback - Object containing the feedback data
281
287
  * @param feedback.message - The message being rated
282
- * @param feedback.rating - Star rating from 1 to 5
288
+ * @param feedback.rating - Numeric feedback rating value
283
289
  * @param feedback.textRating - Optional text feedback/note from user
284
290
  * @param feedback.chatThread - Complete chat thread as string
285
291
  * @param feedback.expectedAnswer - Optional expected answer provided by user
@@ -293,6 +299,12 @@ export type ChatProps = {
293
299
  expectedAnswer: string | null;
294
300
  url: string;
295
301
  }): Promisable<void>;
302
+ /**
303
+ * Selects which feedback action UI is shown on assistant responses.
304
+ *
305
+ * @default 'stars'
306
+ */
307
+ readonly feedbackMode?: ChatFeedbackMode;
296
308
  /**
297
309
  * Optional callback for handling file uploads
298
310
  * When provided, enables file upload functionality via drag-and-drop and file button
@@ -1,5 +1,6 @@
1
1
  import type { id } from '../../../types/typeAliases';
2
2
  import type { ChatMessage } from '../types/ChatMessage';
3
+ import type { ChatFeedbackMode } from './ChatProps';
3
4
  /**
4
5
  * Props for the rating modal used in Chat.
5
6
  *
@@ -13,6 +14,10 @@ export type ChatRatingModalProps = {
13
14
  hoveredRating: number;
14
15
  messageRatings: Map<id, number>;
15
16
  textRating: string;
17
+ /**
18
+ * Chooses which feedback flow the modal should render.
19
+ */
20
+ feedbackMode: ChatFeedbackMode;
16
21
  mode: 'LIGHT' | 'DARK';
17
22
  isMobile: boolean;
18
23
  onClose: () => void;
@@ -19,6 +19,10 @@ export type SourceChipProps = {
19
19
  * Optional suffix text to display after the citation label.
20
20
  */
21
21
  suffix?: string;
22
+ /**
23
+ * Controls whether the technical citation id is shown inside the chip label.
24
+ */
25
+ isCitationIdVisible?: boolean;
22
26
  };
23
27
  /**
24
28
  * SourceChip component - displays a chip with source document information
@@ -36,4 +40,4 @@ export type SourceChipProps = {
36
40
  *
37
41
  * @private utility of `ChatMessageItem` component
38
42
  */
39
- export declare function SourceChip({ citation, onClick, className, suffix }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
43
+ export declare function SourceChip({ citation, onClick, className, suffix, isCitationIdVisible }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import type { Promisable } from 'type-fest';
2
2
  import type { id } from '../../../types/typeAliases';
3
3
  import type { ChatMessage } from '../types/ChatMessage';
4
- import type { ChatFeedbackResponse } from '../Chat/ChatProps';
4
+ import type { ChatFeedbackMode, ChatFeedbackResponse } from '../Chat/ChatProps';
5
5
  /**
6
6
  * Input parameters for the chat rating hook.
7
7
  *
@@ -23,6 +23,10 @@ export type UseChatRatingsOptions = {
23
23
  expectedAnswer: string | null;
24
24
  url: string;
25
25
  }) => Promisable<ChatFeedbackResponse | void>;
26
+ /**
27
+ * Feedback mode currently used by the chat UI.
28
+ */
29
+ feedbackMode: ChatFeedbackMode;
26
30
  /**
27
31
  * Whether the UI should apply mobile-specific behavior.
28
32
  */
@@ -0,0 +1,53 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import { type ParsedCitation } from './parseCitationsFromContent';
3
+ /**
4
+ * Minimal message shape required to derive inline citation references and footnotes.
5
+ *
6
+ * @private utility of `<Chat/>`
7
+ */
8
+ type CitationFootnoteMessage = Pick<ChatMessage, 'content' | 'citations'>;
9
+ /**
10
+ * One rendered citation footnote entry shown below the message body.
11
+ *
12
+ * @private utility of `<Chat/>`
13
+ */
14
+ export type CitationFootnoteEntry = {
15
+ /**
16
+ * Visible footnote number assigned by first appearance in the message body.
17
+ */
18
+ readonly number: number;
19
+ /**
20
+ * Citation metadata rendered for this footnote.
21
+ */
22
+ readonly citation: ParsedCitation;
23
+ };
24
+ /**
25
+ * Render-ready message citation payload containing transformed content plus footnotes.
26
+ *
27
+ * @private utility of `<Chat/>`
28
+ */
29
+ export type CitationFootnoteRenderModel = {
30
+ /**
31
+ * Markdown/HTML content with inline citation tokens replaced by numeric superscripts.
32
+ */
33
+ readonly content: ChatMessage['content'];
34
+ /**
35
+ * Deduplicated footnotes ordered by first appearance in the message body.
36
+ */
37
+ readonly footnotes: ReadonlyArray<CitationFootnoteEntry>;
38
+ };
39
+ /**
40
+ * Creates one render model that replaces raw citation tokens with numeric footnotes.
41
+ *
42
+ * Supported input markers:
43
+ * - OpenAI-style full markers that already include the document source name.
44
+ * - Bracketed id-only tokens, for example `[0:0]` or `[8:13]`
45
+ *
46
+ * Footnotes are deduplicated by document source while preserving the first-seen order.
47
+ *
48
+ * @param message - Message content plus optional structured citation metadata.
49
+ * @returns Render-ready content and matching footnote entries.
50
+ * @private utility of `<Chat/>`
51
+ */
52
+ export declare function createCitationFootnoteRenderModel(message: CitationFootnoteMessage): CitationFootnoteRenderModel;
53
+ export {};
@@ -26,6 +26,45 @@ export type HoistedMenuItem = {
26
26
  */
27
27
  isActive?: boolean;
28
28
  };
29
+ /**
30
+ * Shared actions provided to hoisted mobile menu-section renderers.
31
+ *
32
+ * @private mechanism inside Promptbook
33
+ */
34
+ export type HoistedMobileMenuSectionRenderOptions = {
35
+ /**
36
+ * Closes the owning mobile header menu.
37
+ */
38
+ readonly closeMenu: () => void;
39
+ };
40
+ /**
41
+ * Mobile-only section hoisted into the shared application menu.
42
+ *
43
+ * @private mechanism inside Promptbook
44
+ */
45
+ export type HoistedMobileMenuSection = {
46
+ /**
47
+ * Stable identifier used to preserve section open state.
48
+ */
49
+ readonly key: string;
50
+ /**
51
+ * Visible section label rendered by the mobile menu.
52
+ */
53
+ readonly label: ReactNode;
54
+ /**
55
+ * Whether the section should start expanded whenever the menu opens.
56
+ */
57
+ readonly isDefaultOpen?: boolean;
58
+ /**
59
+ * Lazily renders section content inside the mobile header menu.
60
+ */
61
+ readonly renderContent: (options: HoistedMobileMenuSectionRenderOptions) => ReactNode;
62
+ };
63
+ /**
64
+ * Value exposed through the shared menu-hoisting context.
65
+ *
66
+ * @private mechanism inside Promptbook
67
+ */
29
68
  type MenuHoistingContextType = {
30
69
  /**
31
70
  * The currently hoisted menu items
@@ -35,6 +74,14 @@ type MenuHoistingContextType = {
35
74
  * Set the hoisted menu items
36
75
  */
37
76
  setMenu: (items: HoistedMenuItem[]) => void;
77
+ /**
78
+ * Mobile-only sections hoisted into the shared application menu.
79
+ */
80
+ mobileMenuSections: HoistedMobileMenuSection[];
81
+ /**
82
+ * Sets the mobile-only hoisted menu sections.
83
+ */
84
+ setMobileMenuSections: (sections: HoistedMobileMenuSection[]) => void;
38
85
  };
39
86
  /**
40
87
  * Provider for menu hoisting
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.112.0-22`).
18
+ * It follows semantic versioning (e.g., `0.112.0-24`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/utils",
3
- "version": "0.112.0-23",
3
+ "version": "0.112.0-25",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-23';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-25';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -16,6 +16,7 @@ import { AgentChat } from '../book-components/Chat/AgentChat/AgentChat';
16
16
  import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChatProps';
17
17
  import { Chat } from '../book-components/Chat/Chat/Chat';
18
18
  import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
19
+ import type { ChatFeedbackMode } from '../book-components/Chat/Chat/ChatProps';
19
20
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
20
21
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
21
22
  import { ChatSoundToggle } from '../book-components/Chat/Chat/ChatSoundToggle';
@@ -92,6 +93,7 @@ export { AgentChat };
92
93
  export type { AgentChatProps };
93
94
  export { Chat };
94
95
  export type { ChatFeedbackResponse };
96
+ export type { ChatFeedbackMode };
95
97
  export type { ChatSoundSystem };
96
98
  export type { ChatProps };
97
99
  export { ChatSoundToggle };
@@ -17,6 +17,7 @@ import type { AgentChatProps } from '../book-components/Chat/AgentChat/AgentChat
17
17
  import type { AgentChipData } from '../book-components/Chat/AgentChip/AgentChip';
18
18
  import type { AgentChipProps } from '../book-components/Chat/AgentChip/AgentChip';
19
19
  import type { ChatFeedbackResponse } from '../book-components/Chat/Chat/ChatProps';
20
+ import type { ChatFeedbackMode } from '../book-components/Chat/Chat/ChatProps';
20
21
  import type { ChatSoundSystem } from '../book-components/Chat/Chat/ChatProps';
21
22
  import type { ChatProps } from '../book-components/Chat/Chat/ChatProps';
22
23
  import type { ChatSoundToggleProps } from '../book-components/Chat/Chat/ChatSoundToggle';
@@ -440,6 +441,7 @@ export type { AgentChatProps };
440
441
  export type { AgentChipData };
441
442
  export type { AgentChipProps };
442
443
  export type { ChatFeedbackResponse };
444
+ export type { ChatFeedbackMode };
443
445
  export type { ChatSoundSystem };
444
446
  export type { ChatProps };
445
447
  export type { ChatSoundToggleProps };
@@ -26,6 +26,10 @@ type ChatMessageItemProps = Pick<ChatProps, 'onMessage' | 'onActionButton' | 'pa
26
26
  * Enables the feedback (rating) UI for this message bubble.
27
27
  */
28
28
  isFeedbackEnabled?: boolean;
29
+ /**
30
+ * Chooses which feedback controls should be rendered.
31
+ */
32
+ feedbackMode?: ChatProps['feedbackMode'];
29
33
  /**
30
34
  * Called when the copy button is pressed.
31
35
  */
@@ -0,0 +1,2 @@
1
+ /** @jest-environment jsdom */
2
+ export {};
@@ -20,6 +20,10 @@ export type ChatMessageListProps = {
20
20
  mode: 'LIGHT' | 'DARK';
21
21
  isCopyButtonEnabled?: boolean;
22
22
  isFeedbackEnabled?: boolean;
23
+ /**
24
+ * Chooses which feedback controls should be rendered.
25
+ */
26
+ feedbackMode?: ChatProps['feedbackMode'];
23
27
  onCopy?: () => void;
24
28
  onMessage?: (messageContent: string) => Promisable<void>;
25
29
  onActionButton?: ChatProps['onActionButton'];
@@ -18,6 +18,12 @@ export type ChatFeedbackResponse = {
18
18
  */
19
19
  readonly message?: string;
20
20
  };
21
+ /**
22
+ * Visual mode for post-response feedback actions.
23
+ *
24
+ * @public exported from `@promptbook/components`
25
+ */
26
+ export type ChatFeedbackMode = 'off' | 'stars' | 'report_issue';
21
27
  /**
22
28
  * Interface for sound system that can be passed to Chat component
23
29
  * This allows the chat to trigger sounds without tight coupling
@@ -275,11 +281,11 @@ export type ChatProps = {
275
281
  onCreateAgent?: (bookContent: string) => void;
276
282
  /**
277
283
  * Optional callback for handling user feedback on messages
278
- * When provided, star rating buttons (1-5 stars) will be displayed next to each message
284
+ * When provided, message feedback actions are displayed according to `feedbackMode`.
279
285
  *
280
286
  * @param feedback - Object containing the feedback data
281
287
  * @param feedback.message - The message being rated
282
- * @param feedback.rating - Star rating from 1 to 5
288
+ * @param feedback.rating - Numeric feedback rating value
283
289
  * @param feedback.textRating - Optional text feedback/note from user
284
290
  * @param feedback.chatThread - Complete chat thread as string
285
291
  * @param feedback.expectedAnswer - Optional expected answer provided by user
@@ -293,6 +299,12 @@ export type ChatProps = {
293
299
  expectedAnswer: string | null;
294
300
  url: string;
295
301
  }): Promisable<void>;
302
+ /**
303
+ * Selects which feedback action UI is shown on assistant responses.
304
+ *
305
+ * @default 'stars'
306
+ */
307
+ readonly feedbackMode?: ChatFeedbackMode;
296
308
  /**
297
309
  * Optional callback for handling file uploads
298
310
  * When provided, enables file upload functionality via drag-and-drop and file button
@@ -1,5 +1,6 @@
1
1
  import type { id } from '../../../types/typeAliases';
2
2
  import type { ChatMessage } from '../types/ChatMessage';
3
+ import type { ChatFeedbackMode } from './ChatProps';
3
4
  /**
4
5
  * Props for the rating modal used in Chat.
5
6
  *
@@ -13,6 +14,10 @@ export type ChatRatingModalProps = {
13
14
  hoveredRating: number;
14
15
  messageRatings: Map<id, number>;
15
16
  textRating: string;
17
+ /**
18
+ * Chooses which feedback flow the modal should render.
19
+ */
20
+ feedbackMode: ChatFeedbackMode;
16
21
  mode: 'LIGHT' | 'DARK';
17
22
  isMobile: boolean;
18
23
  onClose: () => void;
@@ -19,6 +19,10 @@ export type SourceChipProps = {
19
19
  * Optional suffix text to display after the citation label.
20
20
  */
21
21
  suffix?: string;
22
+ /**
23
+ * Controls whether the technical citation id is shown inside the chip label.
24
+ */
25
+ isCitationIdVisible?: boolean;
22
26
  };
23
27
  /**
24
28
  * SourceChip component - displays a chip with source document information
@@ -36,4 +40,4 @@ export type SourceChipProps = {
36
40
  *
37
41
  * @private utility of `ChatMessageItem` component
38
42
  */
39
- export declare function SourceChip({ citation, onClick, className, suffix }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
43
+ export declare function SourceChip({ citation, onClick, className, suffix, isCitationIdVisible }: SourceChipProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import type { Promisable } from 'type-fest';
2
2
  import type { id } from '../../../types/typeAliases';
3
3
  import type { ChatMessage } from '../types/ChatMessage';
4
- import type { ChatFeedbackResponse } from '../Chat/ChatProps';
4
+ import type { ChatFeedbackMode, ChatFeedbackResponse } from '../Chat/ChatProps';
5
5
  /**
6
6
  * Input parameters for the chat rating hook.
7
7
  *
@@ -23,6 +23,10 @@ export type UseChatRatingsOptions = {
23
23
  expectedAnswer: string | null;
24
24
  url: string;
25
25
  }) => Promisable<ChatFeedbackResponse | void>;
26
+ /**
27
+ * Feedback mode currently used by the chat UI.
28
+ */
29
+ feedbackMode: ChatFeedbackMode;
26
30
  /**
27
31
  * Whether the UI should apply mobile-specific behavior.
28
32
  */
@@ -0,0 +1,53 @@
1
+ import type { ChatMessage } from '../types/ChatMessage';
2
+ import { type ParsedCitation } from './parseCitationsFromContent';
3
+ /**
4
+ * Minimal message shape required to derive inline citation references and footnotes.
5
+ *
6
+ * @private utility of `<Chat/>`
7
+ */
8
+ type CitationFootnoteMessage = Pick<ChatMessage, 'content' | 'citations'>;
9
+ /**
10
+ * One rendered citation footnote entry shown below the message body.
11
+ *
12
+ * @private utility of `<Chat/>`
13
+ */
14
+ export type CitationFootnoteEntry = {
15
+ /**
16
+ * Visible footnote number assigned by first appearance in the message body.
17
+ */
18
+ readonly number: number;
19
+ /**
20
+ * Citation metadata rendered for this footnote.
21
+ */
22
+ readonly citation: ParsedCitation;
23
+ };
24
+ /**
25
+ * Render-ready message citation payload containing transformed content plus footnotes.
26
+ *
27
+ * @private utility of `<Chat/>`
28
+ */
29
+ export type CitationFootnoteRenderModel = {
30
+ /**
31
+ * Markdown/HTML content with inline citation tokens replaced by numeric superscripts.
32
+ */
33
+ readonly content: ChatMessage['content'];
34
+ /**
35
+ * Deduplicated footnotes ordered by first appearance in the message body.
36
+ */
37
+ readonly footnotes: ReadonlyArray<CitationFootnoteEntry>;
38
+ };
39
+ /**
40
+ * Creates one render model that replaces raw citation tokens with numeric footnotes.
41
+ *
42
+ * Supported input markers:
43
+ * - OpenAI-style full markers that already include the document source name.
44
+ * - Bracketed id-only tokens, for example `[0:0]` or `[8:13]`
45
+ *
46
+ * Footnotes are deduplicated by document source while preserving the first-seen order.
47
+ *
48
+ * @param message - Message content plus optional structured citation metadata.
49
+ * @returns Render-ready content and matching footnote entries.
50
+ * @private utility of `<Chat/>`
51
+ */
52
+ export declare function createCitationFootnoteRenderModel(message: CitationFootnoteMessage): CitationFootnoteRenderModel;
53
+ export {};
@@ -26,6 +26,45 @@ export type HoistedMenuItem = {
26
26
  */
27
27
  isActive?: boolean;
28
28
  };
29
+ /**
30
+ * Shared actions provided to hoisted mobile menu-section renderers.
31
+ *
32
+ * @private mechanism inside Promptbook
33
+ */
34
+ export type HoistedMobileMenuSectionRenderOptions = {
35
+ /**
36
+ * Closes the owning mobile header menu.
37
+ */
38
+ readonly closeMenu: () => void;
39
+ };
40
+ /**
41
+ * Mobile-only section hoisted into the shared application menu.
42
+ *
43
+ * @private mechanism inside Promptbook
44
+ */
45
+ export type HoistedMobileMenuSection = {
46
+ /**
47
+ * Stable identifier used to preserve section open state.
48
+ */
49
+ readonly key: string;
50
+ /**
51
+ * Visible section label rendered by the mobile menu.
52
+ */
53
+ readonly label: ReactNode;
54
+ /**
55
+ * Whether the section should start expanded whenever the menu opens.
56
+ */
57
+ readonly isDefaultOpen?: boolean;
58
+ /**
59
+ * Lazily renders section content inside the mobile header menu.
60
+ */
61
+ readonly renderContent: (options: HoistedMobileMenuSectionRenderOptions) => ReactNode;
62
+ };
63
+ /**
64
+ * Value exposed through the shared menu-hoisting context.
65
+ *
66
+ * @private mechanism inside Promptbook
67
+ */
29
68
  type MenuHoistingContextType = {
30
69
  /**
31
70
  * The currently hoisted menu items
@@ -35,6 +74,14 @@ type MenuHoistingContextType = {
35
74
  * Set the hoisted menu items
36
75
  */
37
76
  setMenu: (items: HoistedMenuItem[]) => void;
77
+ /**
78
+ * Mobile-only sections hoisted into the shared application menu.
79
+ */
80
+ mobileMenuSections: HoistedMobileMenuSection[];
81
+ /**
82
+ * Sets the mobile-only hoisted menu sections.
83
+ */
84
+ setMobileMenuSections: (sections: HoistedMobileMenuSection[]) => void;
38
85
  };
39
86
  /**
40
87
  * Provider for menu hoisting
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.112.0-22`).
18
+ * It follows semantic versioning (e.g., `0.112.0-24`).
19
19
  *
20
20
  * @generated
21
21
  */