@box/box-ai-content-answers 1.8.1 → 1.8.2
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 +12 -15
- package/dist/esm/lib/box-ai-content-answers.js +50 -46
- package/dist/esm/lib/components/answer/answer-content.js +34 -23
- package/dist/esm/lib/components/answer/answer.js +95 -95
- package/dist/esm/lib/components/chat/chat.js +83 -81
- package/dist/esm/lib/components/common/inline-citation.js +27 -38
- package/dist/esm/lib/components/common/markdown-react.js +108 -93
- package/dist/esm/lib/utils/inlineCitationsUtils.js +20 -24
- package/dist/styles/markdown.css +1 -1
- package/dist/types/lib/box-ai-content-answers.d.ts +8 -0
- package/dist/types/lib/components/answer/answer-content.d.ts +13 -1
- package/dist/types/lib/components/answer/answer.d.ts +2 -0
- package/dist/types/lib/components/chat/chat.d.ts +1 -1
- package/dist/types/lib/components/common/inline-citation.d.ts +2 -0
- package/dist/types/lib/components/common/markdown-react.d.ts +2 -1
- package/dist/types/lib/types.d.ts +2 -0
- package/dist/types/lib/utils/inlineCitationsUtils.d.ts +9 -2
- package/package.json +4 -4
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { BoxAiLogo as
|
|
1
|
+
import { Text as w } from "@box/blueprint-web";
|
|
2
|
+
import { BoxAiLogo as L } from "@box/blueprint-web-assets/icons/Logo";
|
|
3
3
|
import { Size10 as b } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import { useIntl as
|
|
7
|
-
import { Answer as
|
|
8
|
-
import { MediaContainer as
|
|
9
|
-
import { Question as
|
|
10
|
-
import { SuggestedQuestions as
|
|
11
|
-
import { ThinkingBubble as
|
|
12
|
-
import
|
|
13
|
-
import { WelcomeMessage as
|
|
4
|
+
import P from "clsx";
|
|
5
|
+
import * as S from "react";
|
|
6
|
+
import { useIntl as ee } from "react-intl";
|
|
7
|
+
import { Answer as te } from "../answer/answer.js";
|
|
8
|
+
import { MediaContainer as oe } from "../common/media-container.js";
|
|
9
|
+
import { Question as ae } from "../question/question.js";
|
|
10
|
+
import { SuggestedQuestions as se } from "../suggested-questions/suggested-questions.js";
|
|
11
|
+
import { ThinkingBubble as ie } from "../thinkingBubble/thinkingBubble.js";
|
|
12
|
+
import re from "../welcome-message/messages.js";
|
|
13
|
+
import { WelcomeMessage as ne } from "../welcome-message/welcome-message.js";
|
|
14
14
|
import { jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
15
|
-
import '../../../../styles/chat.css';const
|
|
16
|
-
chat:
|
|
17
|
-
clearChatText:
|
|
18
|
-
landingPage:
|
|
19
|
-
askQuestionText:
|
|
20
|
-
iconAvatar:
|
|
21
|
-
sidebar:
|
|
22
|
-
},
|
|
15
|
+
import '../../../../styles/chat.css';const ce = "_chat_azszb_1", le = "_clearChatText_azszb_1", me = "_landingPage_azszb_7", pe = "_askQuestionText_azszb_15", de = "_iconAvatar_azszb_23", be = "_sidebar_azszb_39", a = {
|
|
16
|
+
chat: ce,
|
|
17
|
+
clearChatText: le,
|
|
18
|
+
landingPage: me,
|
|
19
|
+
askQuestionText: pe,
|
|
20
|
+
iconAvatar: de,
|
|
21
|
+
sidebar: be
|
|
22
|
+
}, Ne = ({
|
|
23
23
|
askSuggestedQuestion: _,
|
|
24
24
|
contentType: n,
|
|
25
25
|
hasCustomSuggestedQuestions: h,
|
|
@@ -28,125 +28,127 @@ import '../../../../styles/chat.css';const ne = "_chat_azszb_1", ce = "_clearCha
|
|
|
28
28
|
isFeedbackEnabled: z,
|
|
29
29
|
isFeedbackFormEnabled: C,
|
|
30
30
|
isInlineCitationsEnabled: g = !1,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
isInlineCitationV2Enabled: k,
|
|
32
|
+
isMarkdownEnabled: u,
|
|
33
|
+
isSessionLoading: F = !1,
|
|
34
|
+
onCitationClick: A,
|
|
35
|
+
onAnswerCopy: I,
|
|
36
|
+
embedTheAnswerButtonConfig: N,
|
|
37
|
+
onFeedbackFormSubmit: O,
|
|
38
|
+
onDropdownOpenChange: v,
|
|
39
|
+
onSuggestedQuestionInteraction: Q,
|
|
40
|
+
questions: j,
|
|
40
41
|
recordAction: c,
|
|
41
|
-
setAnswerFeedback:
|
|
42
|
+
setAnswerFeedback: y,
|
|
42
43
|
setAskSuggestedQuestion: l,
|
|
43
44
|
suggestedQuestions: m,
|
|
44
|
-
suggestedQuestionsRequestState:
|
|
45
|
-
shouldFeedbackFormIncludeFeedbackText:
|
|
46
|
-
shouldFeedbackIncludePromptData:
|
|
45
|
+
suggestedQuestionsRequestState: B,
|
|
46
|
+
shouldFeedbackFormIncludeFeedbackText: M,
|
|
47
|
+
shouldFeedbackIncludePromptData: q,
|
|
47
48
|
shouldShowLandingPage: o,
|
|
48
|
-
useAnimation:
|
|
49
|
+
useAnimation: R,
|
|
49
50
|
variant: t = "modal",
|
|
50
|
-
hostAppName:
|
|
51
|
-
isReactMarkdownEnabled:
|
|
52
|
-
welcomeMessageClearText:
|
|
51
|
+
hostAppName: W = "",
|
|
52
|
+
isReactMarkdownEnabled: D,
|
|
53
|
+
welcomeMessageClearText: E,
|
|
53
54
|
...p
|
|
54
55
|
}) => {
|
|
55
56
|
const {
|
|
56
|
-
formatMessage:
|
|
57
|
-
} =
|
|
58
|
-
|
|
57
|
+
formatMessage: G
|
|
58
|
+
} = ee(), [H, J] = S.useState(null), K = (s, i) => {
|
|
59
|
+
J(s ? i : null);
|
|
59
60
|
};
|
|
60
61
|
return /* @__PURE__ */ e("div", {
|
|
61
62
|
className: a.chat,
|
|
62
63
|
"data-testid": "content-answers-chat",
|
|
63
64
|
children: /* @__PURE__ */ f("div", {
|
|
64
|
-
className:
|
|
65
|
+
className: P({
|
|
65
66
|
[a.landingPage]: o,
|
|
66
67
|
[a.sidebar]: t === "sidebar"
|
|
67
68
|
}),
|
|
68
|
-
children: [o && /* @__PURE__ */ e(
|
|
69
|
+
children: [o && /* @__PURE__ */ e(oe.Figure, {
|
|
69
70
|
variant: t,
|
|
70
71
|
children: /* @__PURE__ */ e("div", {
|
|
71
72
|
className: a.iconAvatar,
|
|
72
|
-
children: /* @__PURE__ */ e(
|
|
73
|
+
children: /* @__PURE__ */ e(L, {
|
|
73
74
|
height: b,
|
|
74
75
|
role: "presentation",
|
|
75
76
|
width: b
|
|
76
77
|
})
|
|
77
78
|
})
|
|
78
|
-
}), /* @__PURE__ */ e(
|
|
79
|
+
}), /* @__PURE__ */ e(ne, {
|
|
79
80
|
contentType: "",
|
|
80
81
|
shouldShowLandingPage: o,
|
|
81
82
|
...p,
|
|
82
83
|
variant: t
|
|
83
|
-
}), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(
|
|
84
|
+
}), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(se, {
|
|
84
85
|
askSuggestedQuestion: _,
|
|
85
86
|
hasCustomSuggestedQuestions: h,
|
|
86
87
|
isLoading: T,
|
|
87
|
-
onSuggestedQuestionInteraction:
|
|
88
|
+
onSuggestedQuestionInteraction: Q,
|
|
88
89
|
recordAction: c,
|
|
89
90
|
setAskSuggestedQuestion: l,
|
|
90
91
|
suggestedQuestions: m,
|
|
91
|
-
suggestedQuestionsRequestState:
|
|
92
|
+
suggestedQuestionsRequestState: B,
|
|
92
93
|
variant: t
|
|
93
|
-
}), /* @__PURE__ */ e(
|
|
94
|
+
}), /* @__PURE__ */ e(w, {
|
|
94
95
|
as: "p",
|
|
95
96
|
className: a.clearChatText,
|
|
96
|
-
children:
|
|
97
|
+
children: E || G(re.welcomeClearChatText, {
|
|
97
98
|
type: n
|
|
98
99
|
})
|
|
99
100
|
}), !o && /* @__PURE__ */ e("ul", {
|
|
100
|
-
children:
|
|
101
|
+
children: j.map(({
|
|
101
102
|
answer: s,
|
|
102
103
|
thinkingAnswer: i,
|
|
103
|
-
citations:
|
|
104
|
+
citations: U,
|
|
104
105
|
id: r,
|
|
105
|
-
isCompleted:
|
|
106
|
-
isLoading:
|
|
107
|
-
error:
|
|
106
|
+
isCompleted: V,
|
|
107
|
+
isLoading: X,
|
|
108
|
+
error: Y,
|
|
108
109
|
prompt: d,
|
|
109
|
-
promptType:
|
|
110
|
-
feedbackValue:
|
|
110
|
+
promptType: Z,
|
|
111
|
+
feedbackValue: $
|
|
111
112
|
}) => /* @__PURE__ */ f("li", {
|
|
112
|
-
children: [/* @__PURE__ */ e(
|
|
113
|
+
children: [/* @__PURE__ */ e(ae, {
|
|
113
114
|
prompt: d,
|
|
114
115
|
variant: t
|
|
115
|
-
}), i && /* @__PURE__ */ e(
|
|
116
|
+
}), i && /* @__PURE__ */ e(ie, {
|
|
116
117
|
content: i,
|
|
117
118
|
isThinkingComplete: !!s,
|
|
118
|
-
onDropdownOpenChange:
|
|
119
|
+
onDropdownOpenChange: v,
|
|
119
120
|
variant: t
|
|
120
|
-
}), /* @__PURE__ */ e(
|
|
121
|
+
}), /* @__PURE__ */ e(te, {
|
|
121
122
|
answer: s,
|
|
122
|
-
citations:
|
|
123
|
+
citations: U,
|
|
123
124
|
contentType: n,
|
|
124
|
-
embedTheAnswerButtonConfig:
|
|
125
|
-
error:
|
|
126
|
-
feedbackValue:
|
|
127
|
-
hostAppName:
|
|
125
|
+
embedTheAnswerButtonConfig: N,
|
|
126
|
+
error: Y,
|
|
127
|
+
feedbackValue: $,
|
|
128
|
+
hostAppName: W,
|
|
128
129
|
isCitationsEnabled: x,
|
|
129
|
-
isCompleted:
|
|
130
|
+
isCompleted: V,
|
|
130
131
|
isFeedbackEnabled: z,
|
|
131
132
|
isFeedbackFormEnabled: C,
|
|
132
|
-
isFeedbackTooltipOpen:
|
|
133
|
+
isFeedbackTooltipOpen: H === r,
|
|
133
134
|
isInlineCitationsEnabled: g,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
isInlineCitationV2Enabled: k,
|
|
136
|
+
isLoading: X || F,
|
|
137
|
+
isMarkdownEnabled: u,
|
|
138
|
+
isReactMarkdownEnabled: D,
|
|
137
139
|
items: p.items,
|
|
138
|
-
onAnswerCopy:
|
|
139
|
-
onCitationClick:
|
|
140
|
-
onFeedbackFormSubmit:
|
|
141
|
-
onFeedbackTooltipOpenChange:
|
|
140
|
+
onAnswerCopy: I,
|
|
141
|
+
onCitationClick: A,
|
|
142
|
+
onFeedbackFormSubmit: O,
|
|
143
|
+
onFeedbackTooltipOpenChange: K,
|
|
142
144
|
prompt: d,
|
|
143
|
-
promptType:
|
|
145
|
+
promptType: Z,
|
|
144
146
|
questionId: r,
|
|
145
147
|
recordAction: c,
|
|
146
|
-
setAnswerFeedback:
|
|
147
|
-
shouldFeedbackFormIncludeFeedbackText:
|
|
148
|
-
shouldFeedbackIncludePromptData:
|
|
149
|
-
useAnimation:
|
|
148
|
+
setAnswerFeedback: y,
|
|
149
|
+
shouldFeedbackFormIncludeFeedbackText: M,
|
|
150
|
+
shouldFeedbackIncludePromptData: q,
|
|
151
|
+
useAnimation: R,
|
|
150
152
|
variant: t
|
|
151
153
|
})]
|
|
152
154
|
}, r))
|
|
@@ -155,6 +157,6 @@ import '../../../../styles/chat.css';const ne = "_chat_azszb_1", ce = "_clearCha
|
|
|
155
157
|
});
|
|
156
158
|
};
|
|
157
159
|
export {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
Ne as Chat,
|
|
161
|
+
Ne as default
|
|
160
162
|
};
|
|
@@ -1,47 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const A = ({
|
|
1
|
+
import { Tooltip as l, Link as s } from "@box/blueprint-web";
|
|
2
|
+
import { useCallback as m, useMemo as p } from "react";
|
|
3
|
+
import { useIntl as c } from "react-intl";
|
|
4
|
+
import { isBoxDomain as d } from "../../utils/inlineCitationsUtils.js";
|
|
5
|
+
import k from "../answer/messages.js";
|
|
6
|
+
import { s as t } from "../../../../chunks/markdown.module.js";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
const x = ({
|
|
10
9
|
fileName: n,
|
|
11
|
-
href:
|
|
10
|
+
href: i,
|
|
11
|
+
isInlineCitationV2Enabled: r = !1
|
|
12
12
|
}) => {
|
|
13
13
|
const {
|
|
14
|
-
formatMessage:
|
|
15
|
-
} =
|
|
16
|
-
window.open(
|
|
17
|
-
}, [
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"data-testid": "inline-citation-chip",
|
|
30
|
-
onClick: l,
|
|
31
|
-
value: "interactive",
|
|
32
|
-
children: [/* @__PURE__ */ i(t.Icon, {
|
|
33
|
-
className: "inline-citation-file-icon",
|
|
34
|
-
icon: r
|
|
35
|
-
}), /* @__PURE__ */ i(t.Label, {
|
|
36
|
-
className: "inline-citation-filename-label",
|
|
37
|
-
children: n
|
|
38
|
-
})]
|
|
39
|
-
})
|
|
14
|
+
formatMessage: a
|
|
15
|
+
} = c(), e = m(() => {
|
|
16
|
+
window.open(i, "_blank", "noopener,noreferrer");
|
|
17
|
+
}, [i]);
|
|
18
|
+
return p(() => d(i), [i]) ? /* @__PURE__ */ o(l, {
|
|
19
|
+
content: n,
|
|
20
|
+
children: /* @__PURE__ */ o(s, {
|
|
21
|
+
"aria-label": a(k.inlineCitationAriaLabel, {
|
|
22
|
+
fileName: n
|
|
23
|
+
}),
|
|
24
|
+
className: r ? t.inlineCitation : t.inlineCitationWrapper,
|
|
25
|
+
href: i,
|
|
26
|
+
onClick: e,
|
|
27
|
+
"data-target-id": "Link-inlineCitationAriaLabel",
|
|
28
|
+
children: n
|
|
40
29
|
})
|
|
41
|
-
}) : /* @__PURE__ */
|
|
30
|
+
}) : /* @__PURE__ */ o("span", {
|
|
42
31
|
children: n
|
|
43
32
|
});
|
|
44
33
|
};
|
|
45
34
|
export {
|
|
46
|
-
|
|
35
|
+
x as default
|
|
47
36
|
};
|
|
@@ -1,121 +1,136 @@
|
|
|
1
|
+
import { Link as p } from "@box/blueprint-web";
|
|
1
2
|
import d from "react-markdown";
|
|
2
|
-
import
|
|
3
|
-
import { isBoxCitation as
|
|
4
|
-
import
|
|
5
|
-
import { s as
|
|
6
|
-
import { jsxs as
|
|
7
|
-
const N = ({
|
|
8
|
-
children:
|
|
9
|
-
className:
|
|
3
|
+
import f from "remark-gfm";
|
|
4
|
+
import { isBoxDomain as N, isBoxCitation as b } from "../../utils/inlineCitationsUtils.js";
|
|
5
|
+
import g from "./inline-citation.js";
|
|
6
|
+
import { s as r } from "../../../../chunks/markdown.module.js";
|
|
7
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
8
|
+
const k = (t) => (t == null ? void 0 : t.startsWith("#user-content-fn")) ?? !1, h = (t) => t ? b(t) : !1, j = (t) => t ? t.startsWith("http://") || t.startsWith("https://") : !1, x = (t) => t ? N(t) : !1, L = ({
|
|
9
|
+
children: t,
|
|
10
|
+
className: e
|
|
10
11
|
}) => {
|
|
11
|
-
const
|
|
12
|
+
const a = e ? e.replace("language-", "") : "", c = (s) => s.trim().split(/\r?\n/).map((i, l) => /* @__PURE__ */ m("div", {
|
|
12
13
|
className: "hljs-line",
|
|
13
14
|
children: [/* @__PURE__ */ n("span", {
|
|
14
15
|
className: "hljs-line-number",
|
|
15
|
-
children:
|
|
16
|
+
children: l + 1
|
|
16
17
|
}), /* @__PURE__ */ n("span", {
|
|
17
18
|
className: "hljs-line-content",
|
|
18
|
-
children:
|
|
19
|
+
children: i
|
|
19
20
|
})]
|
|
20
|
-
}, `line-${
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
className:
|
|
21
|
+
}, `line-${i.substring(0, 20)}-${Date.now()}`));
|
|
22
|
+
return /* @__PURE__ */ m("div", {
|
|
23
|
+
className: r.hljs,
|
|
23
24
|
children: [/* @__PURE__ */ n("span", {
|
|
24
|
-
className:
|
|
25
|
-
children:
|
|
25
|
+
className: r.hljsLanguage,
|
|
26
|
+
children: a || "auto"
|
|
26
27
|
}), /* @__PURE__ */ n("code", {
|
|
27
|
-
children:
|
|
28
|
+
children: c(t)
|
|
28
29
|
})]
|
|
29
30
|
});
|
|
30
|
-
},
|
|
31
|
-
children:
|
|
31
|
+
}, v = ({
|
|
32
|
+
children: t
|
|
32
33
|
}) => /* @__PURE__ */ n("div", {
|
|
33
|
-
className:
|
|
34
|
+
className: r.tableWrapper,
|
|
34
35
|
children: /* @__PURE__ */ n("table", {
|
|
35
|
-
children:
|
|
36
|
+
children: t
|
|
36
37
|
})
|
|
37
|
-
}),
|
|
38
|
+
}), u = ({
|
|
39
|
+
children: t,
|
|
40
|
+
href: e
|
|
41
|
+
}) => !e || e === "" ? null : x(e) ? /* @__PURE__ */ n("a", {
|
|
38
42
|
href: e,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
children:
|
|
42
|
-
})
|
|
43
|
-
children: e
|
|
43
|
+
rel: "noopener noreferrer",
|
|
44
|
+
target: "_blank",
|
|
45
|
+
children: t
|
|
46
|
+
}) : /* @__PURE__ */ m("span", {
|
|
47
|
+
children: [t, " (", e, ")"]
|
|
48
|
+
}), B = ({
|
|
49
|
+
children: t
|
|
44
50
|
}) => /* @__PURE__ */ n("blockquote", {
|
|
45
|
-
className:
|
|
46
|
-
children:
|
|
47
|
-
}),
|
|
48
|
-
children:
|
|
51
|
+
className: r.blockquote,
|
|
52
|
+
children: t
|
|
53
|
+
}), q = ({
|
|
54
|
+
children: t
|
|
49
55
|
}) => /* @__PURE__ */ n("ol", {
|
|
50
|
-
className:
|
|
51
|
-
children:
|
|
52
|
-
}),
|
|
53
|
-
children:
|
|
56
|
+
className: r.orderedList,
|
|
57
|
+
children: t
|
|
58
|
+
}), w = ({
|
|
59
|
+
children: t
|
|
54
60
|
}) => {
|
|
55
|
-
var
|
|
56
|
-
const
|
|
61
|
+
var a;
|
|
62
|
+
const e = ((a = t == null ? void 0 : t.toString().match(/^(\d+)/)) == null ? void 0 : a[1]) || t;
|
|
57
63
|
return /* @__PURE__ */ n("span", {
|
|
58
|
-
className:
|
|
59
|
-
children:
|
|
64
|
+
className: r.footnote,
|
|
65
|
+
children: e
|
|
60
66
|
});
|
|
61
|
-
},
|
|
62
|
-
code:
|
|
63
|
-
table:
|
|
64
|
-
blockquote:
|
|
65
|
-
ol:
|
|
66
|
-
sup:
|
|
67
|
-
// Handle footnote references
|
|
68
|
-
// Custom paragraph component to handle inline elements properly
|
|
67
|
+
}, R = {
|
|
68
|
+
code: L,
|
|
69
|
+
table: v,
|
|
70
|
+
blockquote: B,
|
|
71
|
+
ol: q,
|
|
72
|
+
sup: w,
|
|
69
73
|
p: ({
|
|
70
|
-
children:
|
|
74
|
+
children: t
|
|
71
75
|
}) => /* @__PURE__ */ n("div", {
|
|
72
|
-
className:
|
|
73
|
-
children:
|
|
76
|
+
className: r.inlineParagraph,
|
|
77
|
+
children: t
|
|
74
78
|
}),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
a: u
|
|
80
|
+
}, M = ({
|
|
81
|
+
children: t,
|
|
82
|
+
isInlineCitationV2Enabled: e = !1
|
|
83
|
+
}) => {
|
|
84
|
+
const a = {
|
|
85
|
+
...R,
|
|
86
|
+
a: (c) => {
|
|
87
|
+
var i;
|
|
88
|
+
const {
|
|
89
|
+
href: s,
|
|
90
|
+
children: o
|
|
91
|
+
} = c;
|
|
92
|
+
if (k(s)) {
|
|
93
|
+
const l = ((i = o == null ? void 0 : o.toString().match(/^(\d+)/)) == null ? void 0 : i[1]) || o;
|
|
94
|
+
return /* @__PURE__ */ n(p, {
|
|
95
|
+
href: s,
|
|
96
|
+
children: /* @__PURE__ */ n("span", {
|
|
97
|
+
className: r.footnoteReference,
|
|
98
|
+
children: l
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (h(s)) {
|
|
103
|
+
const l = (o == null ? void 0 : o.toString()) || "";
|
|
104
|
+
return /* @__PURE__ */ n(g, {
|
|
105
|
+
fileName: l,
|
|
106
|
+
href: s,
|
|
107
|
+
isInlineCitationV2Enabled: e
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return j(s) ? /* @__PURE__ */ n(u, {
|
|
111
|
+
href: s,
|
|
112
|
+
children: o
|
|
113
|
+
}) : /* @__PURE__ */ n(u, {
|
|
114
|
+
href: s,
|
|
115
|
+
children: o
|
|
96
116
|
});
|
|
97
117
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
components: C,
|
|
109
|
-
remarkPlugins: [h],
|
|
110
|
-
children: e
|
|
111
|
-
})
|
|
112
|
-
});
|
|
118
|
+
};
|
|
119
|
+
return /* @__PURE__ */ n("div", {
|
|
120
|
+
className: r.markdownContent,
|
|
121
|
+
children: /* @__PURE__ */ n(d, {
|
|
122
|
+
components: a,
|
|
123
|
+
remarkPlugins: [f],
|
|
124
|
+
children: t
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
};
|
|
113
128
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
B as Blockquote,
|
|
130
|
+
L as CodeBlock,
|
|
131
|
+
w as Footnote,
|
|
132
|
+
u as Link,
|
|
133
|
+
q as Ol,
|
|
134
|
+
v as Table,
|
|
135
|
+
M as default
|
|
121
136
|
};
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = (e) => {
|
|
2
2
|
try {
|
|
3
3
|
const {
|
|
4
|
-
hostname:
|
|
4
|
+
hostname: t
|
|
5
5
|
} = new URL(e);
|
|
6
|
-
return
|
|
6
|
+
return t.endsWith(".box.com") || t.endsWith(".box.net");
|
|
7
7
|
} catch {
|
|
8
8
|
return !1;
|
|
9
9
|
}
|
|
10
|
-
},
|
|
10
|
+
}, f = (e) => e.includes(".box.com") || e.includes(".box.net"), p = (e, t = {}) => {
|
|
11
11
|
const {
|
|
12
|
-
items:
|
|
13
|
-
isCompleted:
|
|
14
|
-
isInlineCitationsEnabled:
|
|
15
|
-
baseUrl:
|
|
16
|
-
} =
|
|
17
|
-
if (!
|
|
12
|
+
items: i = [],
|
|
13
|
+
isCompleted: s = !0,
|
|
14
|
+
isInlineCitationsEnabled: r = !0,
|
|
15
|
+
baseUrl: c = typeof window < "u" ? window.location.origin : ""
|
|
16
|
+
} = t;
|
|
17
|
+
if (!i.length || !s || !r)
|
|
18
18
|
return e;
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
if (!n.name)
|
|
19
|
+
let o = e;
|
|
20
|
+
return i.forEach((n) => {
|
|
21
|
+
if (!n.name || !n.id || n.type !== "file")
|
|
22
22
|
return;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
a = a.replaceAll(s, `[${n.name}](${l})`);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}), a;
|
|
23
|
+
const a = `${c}/file/${n.id}`, l = n.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), d = new RegExp(`\\b${l}\\b`, "gi");
|
|
24
|
+
o = o.replace(d, `[${n.name}](${a})`);
|
|
25
|
+
}), o;
|
|
30
26
|
};
|
|
31
27
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
p as default,
|
|
29
|
+
p as injectInlineCitation,
|
|
30
|
+
f as isBoxCitation,
|
|
31
|
+
u as isBoxDomain
|
|
36
32
|
};
|
package/dist/styles/markdown.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._markdownContent_13xwk_1{display:block}._inlineParagraph_13xwk_5{display:block;margin:0 0 1em;line-height:1.6}._tableWrapper_13xwk_11{margin:var(--space-5) 0;overflow-x:auto}._tableWrapper_13xwk_11 table{width:max-content;min-width:100%;border-collapse:collapse}._tableWrapper_13xwk_11 table,._tableWrapper_13xwk_11 th,._tableWrapper_13xwk_11 td{padding:var(--space-2) var(--space-3);border:var(--border-1) solid var(--gray-10)}._tableWrapper_13xwk_11 th{color:var(--text-text-on-light);font-weight:var(--bp-font-weight-semibold);font-size:var(--bp-font-size-05);line-height:var(--bp-font-line-height-05);background-color:var(--gray-05)}._tableWrapper_13xwk_11 th,._tableWrapper_13xwk_11 td{max-width:calc(var(--space-20) * 3)}._hljs_13xwk_38{position:relative;display:flex;flex-direction:column;overflow-x:auto;background:var(--gray-100)}._hljs_13xwk_38 code{display:grid;white-space:pre}._hljsLanguage_13xwk_50{position:sticky;top:0;left:0;padding:var(--space-2) var(--space-3);color:var(--gray-white);font-weight:var(--bp-font-weight-semibold);font-size:var(--bp-font-size-05);line-height:var(--bp-font-line-height-05);background:var(--gray-90);border-bottom:var(--border-1) solid var(--gray-80)}._hljsContent_13xwk_63{flex:1 1 auto;padding:var(--space-5)}._hljsLine_13xwk_68{display:flex;align-items:flex-start}._hljsLineNumber_13xwk_73{flex:0 0 auto;box-sizing:border-box;width:var(--size-10);padding:var(--space-2) var(--space-1);color:var(--gray-40);text-align:center;background:var(--gray-90);border-right:var(--border-1) solid var(--gray-80);-webkit-user-select:none;user-select:none}._hljsLineContent_13xwk_85{padding:var(--space-2) 0 0 var(--space-1);overflow:hidden}._inlineCitation_13xwk_90._inlineCitation_13xwk_90._inlineCitation_13xwk_90{display:inline;color:var(--text-text-on-light-secondary, #6F6F6F);text-decoration:underline;text-decoration-style:dotted;text-decoration-thickness:1px;text-underline-offset:2px;vertical-align:baseline;cursor:pointer}._inlineCitation_13xwk_90._inlineCitation_13xwk_90._inlineCitation_13xwk_90:hover,._inlineCitation_13xwk_90._inlineCitation_13xwk_90._inlineCitation_13xwk_90:active{color:var(--text-text-on-light-secondary, #6F6F6F)}._inlineCitation_13xwk_90._inlineCitation_13xwk_90._inlineCitation_13xwk_90:focus-visible{color:var(--text-text-on-light-secondary, #6F6F6F)}._inlineCitation_13xwk_90._inlineCitation_13xwk_90._inlineCitation_13xwk_90:visited{color:var(--text-text-on-light-secondary, #6F6F6F);text-decoration:underline;text-decoration-style:dotted}._inlineCitationWrapper_13xwk_115{display:inline-block}
|
|
@@ -5,8 +5,16 @@ 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
|
+
/** Items that are going to be shown within a dropdown to indicate which files are supported and which ones won't */
|
|
9
|
+
items?: Array<{
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
}>;
|
|
8
14
|
/** Whether to use the new React Markdown renderer instead of the legacy Remarkable renderer */
|
|
9
15
|
isReactMarkdownEnabled?: boolean;
|
|
16
|
+
/** Whether to use the V2 inline citation component (stylized hyperlink) instead of plain hyperlink */
|
|
17
|
+
isInlineCitationV2Enabled?: boolean;
|
|
10
18
|
/** Callback when the user clicks on retry */
|
|
11
19
|
retryQuestion?: RetryQuestion;
|
|
12
20
|
/** Callback when the user clicks on stop response */
|