@box/box-ai-content-answers 0.148.7 → 0.148.9
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.
- package/dist/esm/lib/box-ai-content-answers.js +28 -26
- package/dist/esm/lib/components/answer/answer-content.js +33 -23
- package/dist/esm/lib/components/answer/answer.js +53 -51
- package/dist/esm/lib/components/api-wrapper/content-answers-component.js +65 -63
- package/dist/esm/lib/components/chat/chat.js +50 -48
- package/dist/esm/lib/components/common/markdown-react.js +99 -0
- package/dist/esm/lib/components/common/markdown.js +337 -339
- package/dist/types/lib/box-ai-content-answers.d.ts +2 -0
- package/dist/types/lib/components/answer/answer-content.d.ts +3 -1
- package/dist/types/lib/components/answer/answer.d.ts +2 -0
- package/dist/types/lib/components/api-wrapper/types.d.ts +2 -0
- package/dist/types/lib/components/chat/chat.d.ts +1 -1
- package/dist/types/lib/components/common/markdown-react.d.ts +26 -0
- package/dist/types/lib/types.d.ts +2 -0
- package/package.json +8 -4
|
@@ -5,6 +5,8 @@ export type BoxAiContentAnswersProps = Omit<ContentProps, 'isErrorMessageShown'
|
|
|
5
5
|
/** Flag to indicate if the host application has custom suggested questions */
|
|
6
6
|
hasCustomSuggestedQuestions?: boolean;
|
|
7
7
|
hostAppName?: string;
|
|
8
|
+
/** Whether to use the new React Markdown renderer instead of the legacy Remarkable renderer */
|
|
9
|
+
isReactMarkdownEnabled?: boolean;
|
|
8
10
|
/** Callback when the user clicks on retry */
|
|
9
11
|
retryQuestion?: RetryQuestion;
|
|
10
12
|
/** Callback when the user clicks on stop response */
|
|
@@ -4,7 +4,9 @@ export interface AnswerContentProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
4
4
|
answer?: string;
|
|
5
5
|
/** Whether to render the answer with markdown */
|
|
6
6
|
isMarkdownEnabled?: boolean;
|
|
7
|
+
/** Whether to use the new React-based markdown renderer instead of the legacy one */
|
|
8
|
+
isReactMarkdownEnabled?: boolean;
|
|
7
9
|
variant?: StyleVariant;
|
|
8
10
|
}
|
|
9
|
-
export declare const AnswerContent: ({ answer, isMarkdownEnabled, className, variant, ...rest }: AnswerContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const AnswerContent: ({ answer, isMarkdownEnabled, isReactMarkdownEnabled, className, variant, ...rest }: AnswerContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export default AnswerContent;
|
|
@@ -46,6 +46,8 @@ export interface AnswerProps {
|
|
|
46
46
|
/** If keyframe animation for appearing answer should be applied */
|
|
47
47
|
useAnimation?: boolean;
|
|
48
48
|
variant?: StyleVariant;
|
|
49
|
+
/** Whether to use the new React Markdown renderer instead of the legacy Remarkable renderer */
|
|
50
|
+
isReactMarkdownEnabled?: boolean;
|
|
49
51
|
setAnswerFeedback?: (questionId: string, feedbackValue: FeedbackValue) => void;
|
|
50
52
|
/** ID of a question that this answer answers to, used for providing feedback */
|
|
51
53
|
questionId?: string;
|
|
@@ -76,6 +76,8 @@ export type ApiWrapperProps = {
|
|
|
76
76
|
isCitationsEnabled?: boolean;
|
|
77
77
|
isLoading?: boolean;
|
|
78
78
|
isMarkdownEnabled?: boolean;
|
|
79
|
+
/** Whether to use the new React Markdown renderer instead of the legacy Remarkable renderer */
|
|
80
|
+
isReactMarkdownEnabled?: boolean;
|
|
79
81
|
isOpen?: boolean;
|
|
80
82
|
isStreamingEnabled?: boolean;
|
|
81
83
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ChatProps } from '../../types';
|
|
2
|
-
export declare const Chat: ({ askSuggestedQuestion, contentType, hasCustomSuggestedQuestions, hasRequestInProgress, isCitationsEnabled, isFeedbackEnabled, isFeedbackFormEnabled, isInlineCitationsEnabled, isMarkdownEnabled, isSessionLoading, onCitationClick, onAnswerCopy, onFeedbackFormSubmit, onSuggestedQuestionInteraction, questions, recordAction, setAnswerFeedback, setAskSuggestedQuestion, suggestedQuestions, suggestedQuestionsRequestState, shouldFeedbackFormIncludeFeedbackText, shouldShowLandingPage, useAnimation, variant, hostAppName, welcomeMessageClearText, ...welcomeMessageProps }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Chat: ({ askSuggestedQuestion, contentType, hasCustomSuggestedQuestions, hasRequestInProgress, isCitationsEnabled, isFeedbackEnabled, isFeedbackFormEnabled, isInlineCitationsEnabled, isMarkdownEnabled, isSessionLoading, onCitationClick, onAnswerCopy, onFeedbackFormSubmit, onSuggestedQuestionInteraction, questions, recordAction, setAnswerFeedback, setAskSuggestedQuestion, suggestedQuestions, suggestedQuestionsRequestState, shouldFeedbackFormIncludeFeedbackText, shouldShowLandingPage, useAnimation, variant, hostAppName, isReactMarkdownEnabled, welcomeMessageClearText, ...welcomeMessageProps }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Chat;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
declare const CodeBlock: React.FC<{
|
|
3
|
+
children: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
}>;
|
|
6
|
+
declare const Table: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
declare const Link: React.FC<{
|
|
10
|
+
href?: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
declare const Blockquote: React.FC<{
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}>;
|
|
16
|
+
declare const Ol: React.FC<{
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
declare const Footnote: React.FC<{
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}>;
|
|
22
|
+
declare const MarkdownRenderer: React.FC<{
|
|
23
|
+
children: string;
|
|
24
|
+
}>;
|
|
25
|
+
export default MarkdownRenderer;
|
|
26
|
+
export { Blockquote, CodeBlock, Footnote, Link, Ol, Table };
|
|
@@ -131,6 +131,8 @@ export type ChatProps = WelcomeMessageProps & {
|
|
|
131
131
|
shouldFeedbackFormIncludeFeedbackText?: boolean;
|
|
132
132
|
variant?: StyleVariant;
|
|
133
133
|
hostAppName?: string;
|
|
134
|
+
/** Whether to use the new React Markdown renderer instead of the legacy Remarkable renderer */
|
|
135
|
+
isReactMarkdownEnabled?: boolean;
|
|
134
136
|
/** Custom clear chat message to be shown instead of This chat will be cleared when you close this {contentType} */
|
|
135
137
|
welcomeMessageClearText?: string;
|
|
136
138
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.148.
|
|
3
|
+
"version": "0.148.9",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.56.1",
|
|
@@ -17,16 +17,20 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.
|
|
20
|
+
"@box/blueprint-web": "^12.68.0",
|
|
21
21
|
"@box/blueprint-web-assets": "^4.66.0",
|
|
22
|
-
"@box/box-ai-agent-selector": "^0.58.
|
|
23
|
-
"@box/item-icon": "^0.23.
|
|
22
|
+
"@box/box-ai-agent-selector": "^0.58.10",
|
|
23
|
+
"@box/item-icon": "^0.23.9",
|
|
24
24
|
"@box/storybook-utils": "^0.14.2",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|
|
27
27
|
"react-dom": "^18.3.0",
|
|
28
28
|
"react-intl": "^6.4.2"
|
|
29
29
|
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"react-markdown": "^10.1.0",
|
|
32
|
+
"remark-gfm": "^4.0.1"
|
|
33
|
+
},
|
|
30
34
|
"publishConfig": {
|
|
31
35
|
"access": "public"
|
|
32
36
|
},
|