@box/box-ai-content-answers 0.149.14 → 0.151.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.
- package/dist/chunks/markdown.module.js +19 -0
- package/dist/esm/lib/components/answer/answer.js +123 -127
- package/dist/esm/lib/components/answer/messages.js +4 -0
- package/dist/esm/lib/components/answer/thumb-buttons.js +31 -31
- package/dist/esm/lib/components/common/inline-citation.js +47 -0
- package/dist/esm/lib/components/common/markdown-react.js +81 -59
- package/dist/esm/lib/components/common/markdown.js +723 -721
- package/dist/esm/lib/utils/inlineCitationsUtils.js +36 -0
- package/dist/i18n/bn-IN.js +1 -0
- package/dist/i18n/da-DK.js +1 -0
- package/dist/i18n/de-DE.js +1 -0
- package/dist/i18n/en-AU.js +1 -0
- package/dist/i18n/en-CA.js +1 -0
- package/dist/i18n/en-GB.js +1 -0
- package/dist/i18n/en-US.js +1 -0
- package/dist/i18n/en-US.properties +2 -0
- package/dist/i18n/en-x-pseudo.js +79 -78
- package/dist/i18n/en-x-pseudo.properties +78 -78
- package/dist/i18n/es-419.js +1 -0
- package/dist/i18n/es-ES.js +1 -0
- package/dist/i18n/fi-FI.js +1 -0
- package/dist/i18n/fr-CA.js +1 -0
- package/dist/i18n/fr-FR.js +1 -0
- package/dist/i18n/hi-IN.js +1 -0
- package/dist/i18n/it-IT.js +1 -0
- package/dist/i18n/ja-JP.js +1 -0
- package/dist/i18n/json/src/lib/components/answer/messages.json +1 -1
- package/dist/i18n/ko-KR.js +1 -0
- package/dist/i18n/nb-NO.js +1 -0
- package/dist/i18n/nl-NL.js +1 -0
- package/dist/i18n/pl-PL.js +1 -0
- package/dist/i18n/pt-BR.js +1 -0
- package/dist/i18n/ru-RU.js +1 -0
- package/dist/i18n/sv-SE.js +1 -0
- package/dist/i18n/tr-TR.js +1 -0
- package/dist/i18n/zh-CN.js +1 -0
- package/dist/i18n/zh-TW.js +1 -0
- package/dist/styles/markdown.css +1 -7
- package/dist/styles/markdown2.css +7 -0
- package/dist/types/lib/components/answer/answer.d.ts +1 -2
- package/dist/types/lib/components/answer/messages.d.ts +5 -0
- package/dist/types/lib/components/answer/stories/shared.d.ts +15 -3
- package/dist/types/lib/components/common/inline-citation.d.ts +7 -0
- package/dist/types/lib/utils/inlineCitationsUtils.d.ts +17 -0
- package/package.json +3 -3
- package/dist/esm/lib/utils/getBoxLinks.js +0 -13
- package/dist/types/lib/utils/getBoxLinks.d.ts +0 -15
|
@@ -55,15 +55,20 @@ export declare const testItemsWithBoxUrls: {
|
|
|
55
55
|
id: string;
|
|
56
56
|
name: string;
|
|
57
57
|
type: string;
|
|
58
|
-
url: string;
|
|
59
58
|
}[];
|
|
60
59
|
export declare const testItemsWithNonBoxUrls: {
|
|
61
60
|
id: string;
|
|
62
61
|
name: string;
|
|
63
62
|
type: string;
|
|
64
|
-
url: string;
|
|
65
63
|
}[];
|
|
66
|
-
export declare const
|
|
64
|
+
export declare const answerWithBoxUrls = "This answer contains Box files like document.pdf and presentation.pptx. These Box links should be clickable in legacy mode.";
|
|
65
|
+
export declare const answerWithNonBoxUrls = "This answer contains external files like document.pdf and presentation.pptx. These external links should show as plain text with URLs in parentheses in legacy mode.";
|
|
66
|
+
export declare const answerWithMixedUrls = "This answer contains both Box files like [document.pdf](https://app.box.com/file/123) and external links like [external doc](https://example.com/doc). The Box links should be clickable in legacy mode, while external links should show the URL in parentheses.";
|
|
67
|
+
export declare const answerWithBoxUrlsMarkdown = "This answer contains Box files like [document.pdf](https://app.box.com/file/123) and [presentation.pptx](https://app.box.com/file/456). These Box links should be clickable in legacy mode.";
|
|
68
|
+
export declare const answerWithNonBoxUrlsMarkdown = "This answer contains external files like [document.pdf](https://example.com/file/123) and [presentation.pptx](https://external-site.com/file/456). These external links should show as plain text with URLs in parentheses in legacy mode.";
|
|
69
|
+
export declare const answerWithMixedUrlsMarkdown = "This answer contains both Box files like [document.pdf](https://app.box.com/file/123) and external links like [external doc](https://example.com/doc). The Box links should be clickable in legacy mode, while external links should show the URL in parentheses.";
|
|
70
|
+
export declare const answerWithReactModeCitations = "This answer contains Box files like [document.pdf](https://app.box.com/file/123) and [presentation.pptx](https://app.box.com/file/456). These should render as FilterChip components in React mode.";
|
|
71
|
+
export declare const answerWithReactModeMixedUrls = "This answer contains both Box files like [document.pdf](https://app.box.com/file/123) and external files like [external-doc.pdf](https://external-site.com/file/999). Box files should be FilterChip components, external files should be plain text.";
|
|
67
72
|
export declare const expectedAnswerWithMixedUrls = "This answer contains both Box files like <a href=\"https://app.box.com/file/123\" target=\"_blank\">document.pdf</a> and external links like external doc (https://example.com/doc). The Box links should be clickable, while external links should show the URL in parentheses.";
|
|
68
73
|
export declare const DefaultAnswer: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
69
74
|
export declare const StoppedAnswer: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -84,3 +89,10 @@ export declare const AnswerWithInlineCitationsNullItems: (props: AnswerProps) =>
|
|
|
84
89
|
export declare const AnswerWithBoxUrls: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
85
90
|
export declare const AnswerWithNonBoxUrls: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
86
91
|
export declare const AnswerWithMixedUrlTypes: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
export declare const AnswerWithBoxUrlsReact: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
93
|
+
export declare const AnswerWithNonBoxUrlsReact: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
94
|
+
export declare const AnswerWithBoxUrlsMarkdown: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
export declare const AnswerWithNonBoxUrlsMarkdown: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
96
|
+
export declare const AnswerWithMixedUrlsMarkdown: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
97
|
+
export declare const AnswerWithReactModeCitations: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
98
|
+
export declare const AnswerWithReactModeMixedUrls: (props: AnswerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface InjectInlineCitationOptions {
|
|
2
|
+
items?: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}>;
|
|
6
|
+
isCompleted?: boolean;
|
|
7
|
+
isInlineCitationsEnabled?: boolean;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const isBoxDomain: (url: string) => boolean;
|
|
11
|
+
export declare const isBoxCitation: (url: string) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Injects inline citations into markdown text by converting file references to markdown links.
|
|
14
|
+
* Supports multiple formats: (filename.pdf), "filename.pptx", filename.js, [filename.pdf], {filename.pdf}
|
|
15
|
+
*/
|
|
16
|
+
export declare const injectInlineCitation: (text: string, options?: InjectInlineCitationOptions) => string;
|
|
17
|
+
export default injectInlineCitation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.151.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.56.1",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
20
|
"@box/blueprint-web": "^12.76.0",
|
|
21
21
|
"@box/blueprint-web-assets": "^4.68.0",
|
|
22
|
-
"@box/box-ai-agent-selector": "^0.
|
|
23
|
-
"@box/item-icon": "^0.
|
|
22
|
+
"@box/box-ai-agent-selector": "^0.61.0",
|
|
23
|
+
"@box/item-icon": "^0.25.0",
|
|
24
24
|
"@box/storybook-utils": "^0.14.4",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BOX_SUPPORTED_FILE_EXTENSIONS as o } from "./constants.js";
|
|
2
|
-
function s(t) {
|
|
3
|
-
const e = /(https?:\/\/([^\/\s\)]+\.)?box\.com[^\s\)]*)/gi, n = t.match(e) || [];
|
|
4
|
-
return [...new Set(n)];
|
|
5
|
-
}
|
|
6
|
-
function i(t) {
|
|
7
|
-
const e = new RegExp(`\\b[\\w\\-.]+\\.(${o.join("|")})\\b`, "gi"), n = t.match(e) || [];
|
|
8
|
-
return [...new Set(n)];
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
s as extractBoxLinks,
|
|
12
|
-
i as extractFileNames
|
|
13
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for tracking files and links in AI responses
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Gets all box.com file links from text
|
|
6
|
-
* @param text - The text content to analyze
|
|
7
|
-
* @returns Array of box.com file links
|
|
8
|
-
*/
|
|
9
|
-
export declare function extractBoxLinks(text: string): string[];
|
|
10
|
-
/**
|
|
11
|
-
* Extracts file names with extensions from text content
|
|
12
|
-
* @param text - The text content to analyze
|
|
13
|
-
* @returns Array of detected file names
|
|
14
|
-
*/
|
|
15
|
-
export declare function extractFileNames(text: string): string[];
|