@box/box-ai-content-answers 1.43.33 → 1.43.35
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/answer-content.js +32 -0
- package/dist/chunks/answer.js +184 -0
- package/dist/chunks/box-ai-content-answers.js +78 -0
- package/dist/chunks/chat.js +117 -0
- package/dist/chunks/citation.js +124 -0
- package/dist/chunks/clear-conversation-button.js +36 -44
- package/dist/chunks/content.js +89 -0
- package/dist/chunks/content2.js +218 -0
- package/dist/chunks/contextual-items-message.js +43 -0
- package/dist/chunks/embed-the-answer-button.js +52 -0
- package/dist/chunks/feedback-tooltip.js +130 -0
- package/dist/chunks/footer-actions.js +44 -0
- package/dist/chunks/inline-error.js +62 -0
- package/dist/chunks/items-dropdown.js +67 -0
- package/dist/chunks/markdown.js +6818 -0
- package/dist/chunks/markdown.module.js +13 -15
- package/dist/chunks/media-container.js +32 -0
- package/dist/chunks/question.js +29 -0
- package/dist/chunks/references.js +43 -0
- package/dist/chunks/stopResponseButton.js +47 -47
- package/dist/chunks/suggested-questions.js +70 -0
- package/dist/chunks/suggestions.js +35 -0
- package/dist/chunks/thinkingBubble.js +111 -0
- package/dist/chunks/thumb-buttons.js +103 -0
- package/dist/chunks/types.js +14 -24
- package/dist/chunks/unsupported-items-notice.js +25 -0
- package/dist/chunks/warning-message.js +21 -27
- package/dist/esm/index.js +11 -29
- package/dist/esm/lib/box-ai-content-answers.js +2 -111
- package/dist/esm/lib/components/answer/answer-content.js +2 -54
- package/dist/esm/lib/components/answer/answer.js +2 -194
- package/dist/esm/lib/components/answer/citation.js +2 -139
- package/dist/esm/lib/components/answer/constants.js +2 -5
- package/dist/esm/lib/components/answer/copy-button.js +45 -62
- package/dist/esm/lib/components/answer/embed-the-answer-button.js +2 -65
- package/dist/esm/lib/components/answer/feedback-tooltip.js +2 -153
- package/dist/esm/lib/components/answer/inline-error.js +2 -75
- package/dist/esm/lib/components/answer/loading-indicator.js +26 -29
- package/dist/esm/lib/components/answer/messages.js +146 -148
- package/dist/esm/lib/components/answer/no-citations.js +28 -37
- package/dist/esm/lib/components/answer/references.js +2 -70
- package/dist/esm/lib/components/answer/thumb-buttons.js +2 -126
- package/dist/esm/lib/components/api-wrapper/actions.js +2 -12
- package/dist/esm/lib/components/api-wrapper/api-wrapper.js +8 -13
- package/dist/esm/lib/components/api-wrapper/constants.js +29 -30
- package/dist/esm/lib/components/api-wrapper/content-answers-component.js +82 -138
- package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +210 -246
- package/dist/esm/lib/components/api-wrapper/records.js +37 -43
- package/dist/esm/lib/components/api-wrapper/reducer.js +41 -64
- package/dist/esm/lib/components/api-wrapper/utils/format.js +12 -15
- package/dist/esm/lib/components/api-wrapper/utils/request.js +11 -14
- package/dist/esm/lib/components/api-wrapper/utils/stream.js +116 -139
- package/dist/esm/lib/components/chat/chat.js +2 -161
- package/dist/esm/lib/components/chat/index.js +2 -4
- package/dist/esm/lib/components/common/agentUtils.js +4 -8
- package/dist/esm/lib/components/common/constants.js +19 -19
- package/dist/esm/lib/components/common/focusInputUtils.js +4 -6
- package/dist/esm/lib/components/common/inline-citation.js +23 -35
- package/dist/esm/lib/components/common/keyInputUtils.js +2 -5
- package/dist/esm/lib/components/common/markdown-react.js +96 -133
- package/dist/esm/lib/components/common/markdown.js +2 -12988
- package/dist/esm/lib/components/common/media-container.js +2 -49
- package/dist/esm/lib/components/common/mock-data.js +305 -263
- package/dist/esm/lib/components/common/performance.js +3 -6
- package/dist/esm/lib/components/content/content.js +2 -115
- package/dist/esm/lib/components/content/index.js +2 -4
- package/dist/esm/lib/components/footer/constants.js +12 -16
- package/dist/esm/lib/components/footer/footer-actions.js +2 -51
- package/dist/esm/lib/components/footer/footer.js +150 -164
- package/dist/esm/lib/components/footer/index.js +1 -3
- package/dist/esm/lib/components/footer/messages.js +34 -36
- package/dist/esm/lib/components/footer/stopResponseButton.js +2 -11
- package/dist/esm/lib/components/modal/clear-conversation-button.js +2 -12
- package/dist/esm/lib/components/modal/hooks/useEventListeners.js +10 -15
- package/dist/esm/lib/components/modal/hooks/useStopPropagationOnEsc.js +18 -20
- package/dist/esm/lib/components/modal/messages.js +18 -20
- package/dist/esm/lib/components/modal/modal.js +142 -169
- package/dist/esm/lib/components/modal/title.js +13 -23
- package/dist/esm/lib/components/modal-error/index.js +2 -4
- package/dist/esm/lib/components/modal-error/messages.js +14 -16
- package/dist/esm/lib/components/modal-error/modal-error.js +31 -40
- package/dist/esm/lib/components/question/question.js +2 -35
- package/dist/esm/lib/components/sidebar/content.js +2 -269
- package/dist/esm/lib/components/sidebar/context.js +15 -17
- package/dist/esm/lib/components/sidebar/messages.js +26 -28
- package/dist/esm/lib/components/sidebar/sidebar.js +79 -103
- package/dist/esm/lib/components/sidebar/title.js +13 -22
- package/dist/esm/lib/components/suggested-questions/messages.js +14 -16
- package/dist/esm/lib/components/suggested-questions/mocks.js +36 -29
- package/dist/esm/lib/components/suggested-questions/suggested-questions.js +2 -79
- package/dist/esm/lib/components/suggested-questions/suggestions.js +2 -46
- package/dist/esm/lib/components/thinkingBubble/boxAILoadingIndicator.js +275 -246
- package/dist/esm/lib/components/thinkingBubble/messages.js +23 -25
- package/dist/esm/lib/components/thinkingBubble/thinkingBubble.js +2 -125
- package/dist/esm/lib/components/welcome-message/contextual-items-message.js +2 -57
- package/dist/esm/lib/components/welcome-message/items-dropdown.js +2 -82
- package/dist/esm/lib/components/welcome-message/messages.js +50 -61
- package/dist/esm/lib/components/welcome-message/unsupported-items-notice.js +2 -35
- package/dist/esm/lib/components/welcome-message/warning-message.js +2 -6
- package/dist/esm/lib/components/welcome-message/welcome-message.js +52 -75
- package/dist/esm/lib/constants.js +9 -12
- package/dist/esm/lib/hooks/usePromptFocus.js +26 -31
- package/dist/esm/lib/messages.js +54 -56
- package/dist/esm/lib/utils/constants.js +2 -165
- package/dist/esm/lib/utils/inlineCitationsUtils.js +17 -31
- package/dist/styles/answer-content.css +1 -1
- package/dist/styles/answer.css +1 -1
- package/dist/styles/box-ai-content-answers.css +1 -1
- package/dist/styles/chat.css +1 -1
- package/dist/styles/citation.css +1 -1
- package/dist/styles/clear-conversation-button.css +1 -1
- package/dist/styles/content.css +1 -1
- package/dist/styles/content2.css +1 -1
- package/dist/styles/contextual-items-message.css +1 -1
- package/dist/styles/embed-the-answer-button.css +1 -1
- package/dist/styles/feedback-tooltip.css +1 -1
- package/dist/styles/footer-actions.css +1 -1
- package/dist/styles/inline-error.css +1 -1
- package/dist/styles/items-dropdown.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/markdown.css +8 -1
- package/dist/styles/markdown2.css +1 -1
- package/dist/styles/media-container.css +1 -1
- package/dist/styles/question.css +1 -1
- package/dist/styles/stopResponseButton.css +1 -1
- package/dist/styles/suggested-questions.css +1 -1
- package/dist/styles/suggestions.css +1 -1
- package/dist/styles/thinkingBubble.css +1 -1
- package/dist/styles/unsupported-items-notice.css +1 -1
- package/dist/styles/warning-message.css +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as e } from "./markdown.js";
|
|
2
|
+
import t from "../esm/lib/utils/inlineCitationsUtils.js";
|
|
3
|
+
import n from "../esm/lib/components/common/markdown-react.js";
|
|
4
|
+
import r from "clsx";
|
|
5
|
+
import "react";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/answer-content.css';var s = {
|
|
8
|
+
answerContent: "_answerContent_9f3o6_2",
|
|
9
|
+
answerMarkdown: "_answerMarkdown_9f3o6_16"
|
|
10
|
+
}, c = ({ answer: c, items: l, isCompleted: u, isInlineCitationV2Enabled: d, isInlineCitationsEnabled: f, isMarkdownEnabled: p, isReactMarkdownEnabled: m = !1, className: h, variant: g = "modal", ..._ }) => {
|
|
11
|
+
let v = g === "sidebar", y = (r) => {
|
|
12
|
+
let i = t(r, {
|
|
13
|
+
items: l,
|
|
14
|
+
isCompleted: u,
|
|
15
|
+
isInlineCitationsEnabled: f
|
|
16
|
+
});
|
|
17
|
+
return m ? /* @__PURE__ */ a(n, {
|
|
18
|
+
isInlineCitationV2Enabled: d,
|
|
19
|
+
children: i
|
|
20
|
+
}) : /* @__PURE__ */ a("div", { dangerouslySetInnerHTML: { __html: e(i) } });
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ o(i, { children: [!p && /* @__PURE__ */ a("div", {
|
|
23
|
+
className: r(s.answerContent, v && s.sidebar, "Answer-text", h),
|
|
24
|
+
..._,
|
|
25
|
+
children: c
|
|
26
|
+
}), p && c && /* @__PURE__ */ a("div", {
|
|
27
|
+
className: r(s.answerContent, s.answerMarkdown, v && s.sidebar, "Answer-text", h),
|
|
28
|
+
..._,
|
|
29
|
+
children: y(c)
|
|
30
|
+
})] });
|
|
31
|
+
};
|
|
32
|
+
export { c as t };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { t as e } from "./types.js";
|
|
2
|
+
import { t } from "./media-container.js";
|
|
3
|
+
import n from "../esm/lib/components/answer/messages.js";
|
|
4
|
+
import { BoxAILoadingIndicator as r } from "../esm/lib/components/thinkingBubble/boxAILoadingIndicator.js";
|
|
5
|
+
import { t as i } from "./answer-content.js";
|
|
6
|
+
import { CopyButton as a } from "../esm/lib/components/answer/copy-button.js";
|
|
7
|
+
import { t as o } from "./embed-the-answer-button.js";
|
|
8
|
+
import { t as s } from "./inline-error.js";
|
|
9
|
+
import { t as c } from "./references.js";
|
|
10
|
+
import { t as l } from "./thumb-buttons.js";
|
|
11
|
+
import u from "clsx";
|
|
12
|
+
import { memo as d, useEffect as f, useState as p } from "react";
|
|
13
|
+
import { Text as m } from "@box/blueprint-web";
|
|
14
|
+
import { useIntl as ee } from "react-intl";
|
|
15
|
+
import { Gray65 as h, Size4 as g } from "@box/blueprint-web-assets/tokens/tokens";
|
|
16
|
+
import { AlertTriangle as _ } from "@box/blueprint-web-assets/icons/Line";
|
|
17
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
18
|
+
import '../styles/answer.css';var b = {
|
|
19
|
+
answer: "_answer_1miuw_2",
|
|
20
|
+
loadingContainer: "_loadingContainer_1miuw_6",
|
|
21
|
+
loadingText: "_loadingText_1miuw_13",
|
|
22
|
+
fadeIn: "_fadeIn_1miuw_1",
|
|
23
|
+
alertIcon: "_alertIcon_1miuw_22",
|
|
24
|
+
error: "_error_1miuw_25",
|
|
25
|
+
footer: "_footer_1miuw_29",
|
|
26
|
+
copyButtonContainer: "_copyButtonContainer_1miuw_35",
|
|
27
|
+
feedbackButtonsContainer: "_feedbackButtonsContainer_1miuw_36",
|
|
28
|
+
shouldHaveMarginTop: "_shouldHaveMarginTop_1miuw_40",
|
|
29
|
+
shouldUseAnimation: "_shouldUseAnimation_1miuw_43",
|
|
30
|
+
shouldAnimateHeight: "_shouldAnimateHeight_1miuw_47",
|
|
31
|
+
footerButtons: "_footerButtons_1miuw_51",
|
|
32
|
+
iconAvatar: "_iconAvatar_1miuw_57",
|
|
33
|
+
embedTheAnswerButtonContainer: "_embedTheAnswerButtonContainer_1miuw_72",
|
|
34
|
+
buttonsVisible: "_buttonsVisible_1miuw_80"
|
|
35
|
+
}, x = new Set([
|
|
36
|
+
e.RATE_LIMITING,
|
|
37
|
+
e.NO_CONTENT,
|
|
38
|
+
e.PRECONDITION_FAILED,
|
|
39
|
+
e.GENERAL,
|
|
40
|
+
e.AGENT_NOT_FOUND
|
|
41
|
+
]), S = /* @__PURE__ */ d(({ answer: d, citations: S, error: C, contentType: te, hostAppName: w, feedbackValue: T, isCitationsEnabled: E = !1, isCompleted: D = !1, isFeedbackEnabled: O = !1, isFeedbackFormEnabled: k, isFeedbackTooltipOpen: A, isInlineCitationsEnabled: j = !1, isInlineCitationV2Enabled: M, isLoading: N = !1, isMarkdownEnabled: P = !1, items: F = [], onAnswerCopy: I, embedTheAnswerButtonConfig: L, onCitationClick: R, onFeedbackFormSubmit: z, onFeedbackTooltipOpenChange: ne, prompt: B, promptType: V, recordAction: H, shouldFeedbackFormIncludeFeedbackText: U, shouldFeedbackIncludePromptData: W, useAnimation: G = !0, variant: K = "modal", isReactMarkdownEnabled: q, setAnswerFeedback: J, questionId: Y }) => {
|
|
42
|
+
let X = x.has(C), Z = N && !d && !C, [re, ie] = p(D), { formatMessage: Q } = ee();
|
|
43
|
+
f(() => {
|
|
44
|
+
d && H && D && F.some((e) => d.includes(e.name)) && H({
|
|
45
|
+
action: "programmatic",
|
|
46
|
+
component: K,
|
|
47
|
+
feature: "answers",
|
|
48
|
+
target: "links_detected",
|
|
49
|
+
data: {
|
|
50
|
+
hostAppName: w,
|
|
51
|
+
linkCount: F.length,
|
|
52
|
+
fileNameCount: F.length
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}, [
|
|
56
|
+
d,
|
|
57
|
+
K,
|
|
58
|
+
w,
|
|
59
|
+
D,
|
|
60
|
+
H,
|
|
61
|
+
F
|
|
62
|
+
]), f(() => {
|
|
63
|
+
setTimeout(() => ie(D), 0);
|
|
64
|
+
}, [D]);
|
|
65
|
+
let $ = () => /* @__PURE__ */ v(_, {
|
|
66
|
+
className: b.alertIcon,
|
|
67
|
+
color: h,
|
|
68
|
+
"data-testid": "content-answers-error-alert-icon",
|
|
69
|
+
height: g,
|
|
70
|
+
role: "presentation",
|
|
71
|
+
width: g
|
|
72
|
+
}), ae = () => /* @__PURE__ */ y(m, {
|
|
73
|
+
as: "p",
|
|
74
|
+
className: b.error,
|
|
75
|
+
color: "textOnLightSecondary",
|
|
76
|
+
"data-testid": "content-answers-error",
|
|
77
|
+
variant: "caption",
|
|
78
|
+
children: [
|
|
79
|
+
C === e.RESPONSE_INTERRUPTED && Q(n.responseInterruptedError),
|
|
80
|
+
C === e.RESPONSE_FAILED && Q(n.responseFailedError),
|
|
81
|
+
C === e.RESPONSE_STOPPED && Q(n.responseStoppedError),
|
|
82
|
+
C !== e.RESPONSE_STOPPED && $()
|
|
83
|
+
]
|
|
84
|
+
}), oe = () => C === e.RESPONSE_STOPPED ? d ? null : $() : /* @__PURE__ */ y("div", {
|
|
85
|
+
className: u(b.footerButtons, "footer-buttons-container", { [b.buttonsVisible]: A }),
|
|
86
|
+
children: [O ? /* @__PURE__ */ v("div", {
|
|
87
|
+
className: b.feedbackButtonsContainer,
|
|
88
|
+
children: /* @__PURE__ */ v(l, {
|
|
89
|
+
feedbackValue: T,
|
|
90
|
+
hostAppName: w,
|
|
91
|
+
isFeedbackFormEnabled: k,
|
|
92
|
+
isFeedbackTooltipOpen: A,
|
|
93
|
+
items: F,
|
|
94
|
+
onFeedbackFormSubmit: z,
|
|
95
|
+
onFeedbackTooltipOpenChange: ne,
|
|
96
|
+
prompt: B,
|
|
97
|
+
promptType: V,
|
|
98
|
+
questionId: Y,
|
|
99
|
+
recordAction: H,
|
|
100
|
+
response: d,
|
|
101
|
+
setAnswerFeedback: J,
|
|
102
|
+
shouldFeedbackFormIncludeFeedbackText: U,
|
|
103
|
+
shouldFeedbackIncludePromptData: W,
|
|
104
|
+
variant: K
|
|
105
|
+
})
|
|
106
|
+
}) : null, /* @__PURE__ */ v("div", {
|
|
107
|
+
className: b.copyButtonContainer,
|
|
108
|
+
children: /* @__PURE__ */ v(a, {
|
|
109
|
+
answer: d,
|
|
110
|
+
onAnswerCopy: I,
|
|
111
|
+
recordAction: H
|
|
112
|
+
})
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
return /* @__PURE__ */ y("div", {
|
|
116
|
+
"aria-live": "polite",
|
|
117
|
+
className: b.answer,
|
|
118
|
+
"data-testid": "content-answers-answer",
|
|
119
|
+
children: [
|
|
120
|
+
Z && /* @__PURE__ */ y("div", {
|
|
121
|
+
className: b.loadingContainer,
|
|
122
|
+
children: [/* @__PURE__ */ v(r, {}), /* @__PURE__ */ v(m, {
|
|
123
|
+
as: "span",
|
|
124
|
+
className: b.loadingText,
|
|
125
|
+
color: "textOnLightDefault",
|
|
126
|
+
variant: "titleMedium",
|
|
127
|
+
children: Q(n.analyzingRequest)
|
|
128
|
+
})]
|
|
129
|
+
}),
|
|
130
|
+
!X && !Z && /* @__PURE__ */ v(t, {
|
|
131
|
+
className: "answer",
|
|
132
|
+
variant: K,
|
|
133
|
+
children: /* @__PURE__ */ y(t.Content, {
|
|
134
|
+
isUsedInsideSidebar: K === "sidebar",
|
|
135
|
+
variant: "answer",
|
|
136
|
+
children: [/* @__PURE__ */ v(i, {
|
|
137
|
+
answer: d,
|
|
138
|
+
isCompleted: D,
|
|
139
|
+
isInlineCitationsEnabled: j,
|
|
140
|
+
isInlineCitationV2Enabled: M,
|
|
141
|
+
isMarkdownEnabled: P,
|
|
142
|
+
isReactMarkdownEnabled: q,
|
|
143
|
+
items: F,
|
|
144
|
+
variant: K
|
|
145
|
+
}), D && /* @__PURE__ */ y("div", {
|
|
146
|
+
className: u(b.footer, {
|
|
147
|
+
[b.shouldHaveMarginTop]: d,
|
|
148
|
+
[b.shouldAnimateHeight]: re,
|
|
149
|
+
[b.shouldUseAnimation]: G
|
|
150
|
+
}),
|
|
151
|
+
"data-testid": "content-answers-answer-footer",
|
|
152
|
+
children: [
|
|
153
|
+
C && ae(),
|
|
154
|
+
E && !C && /* @__PURE__ */ v(c, {
|
|
155
|
+
citations: S,
|
|
156
|
+
onCitationClick: R,
|
|
157
|
+
recordAction: H
|
|
158
|
+
}),
|
|
159
|
+
oe()
|
|
160
|
+
]
|
|
161
|
+
})]
|
|
162
|
+
})
|
|
163
|
+
}),
|
|
164
|
+
!X && !Z && D && L?.onAction && /* @__PURE__ */ v("div", {
|
|
165
|
+
className: b.embedTheAnswerButtonContainer,
|
|
166
|
+
children: /* @__PURE__ */ v(o, {
|
|
167
|
+
answer: d,
|
|
168
|
+
embedTheAnswerButtonConfig: L,
|
|
169
|
+
hostAppName: w,
|
|
170
|
+
questionId: Y,
|
|
171
|
+
recordAction: H,
|
|
172
|
+
variant: K
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
X && /* @__PURE__ */ v(s, {
|
|
176
|
+
contentType: te,
|
|
177
|
+
error: C,
|
|
178
|
+
recordAction: H,
|
|
179
|
+
variant: K
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
export { S as t };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { r as e } from "./types.js";
|
|
2
|
+
import { t } from "./content.js";
|
|
3
|
+
import { Footer as n } from "../esm/lib/components/footer/footer.js";
|
|
4
|
+
import r from "clsx";
|
|
5
|
+
import * as i from "react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/box-ai-content-answers.css';var s = {
|
|
8
|
+
container: "_container_h5a00_1",
|
|
9
|
+
contentAnswers: "_contentAnswers_h5a00_8",
|
|
10
|
+
sidebar: "_sidebar_h5a00_19"
|
|
11
|
+
}, c = ({ className: c, contentType: l, contentName: u, error: d, hasCustomSuggestedQuestions: f, hasRequestInProgress: p, isAIStudioAgentSelectorEnabled: m, isDebugModeEnabled: h, isStopResponseEnabled: g, isStreamingEnabled: _, items: v, promptValue: y, questions: b, recordAction: x, retryQuestion: S, setPromptValue: C, showLoadingIndicator: w, stopQuestion: T, submitQuestion: E, suggestedQuestions: D, useAnimation: O, onAgentEditorToggle: k, onUserIntentToUseAI: A, promptButtonClickHandler: j, variant: M = "modal", hostAppName: N, isReactMarkdownEnabled: P, isInlineCitationV2Enabled: F, ...I }) => {
|
|
12
|
+
let [L, R] = i.useState(null), [z, B] = i.useState(d != null), [V, H] = i.useState(!1), U = d === e.LARGE_FILE, W = (!z || U) && !w, G = (e) => {
|
|
13
|
+
x && x({
|
|
14
|
+
...e,
|
|
15
|
+
component: M
|
|
16
|
+
});
|
|
17
|
+
}, K = () => {
|
|
18
|
+
A && A(!1);
|
|
19
|
+
}, q = (e) => {
|
|
20
|
+
R(e), A && A(!0);
|
|
21
|
+
}, J = () => {
|
|
22
|
+
A && A(!0);
|
|
23
|
+
};
|
|
24
|
+
return i.useEffect(() => {
|
|
25
|
+
B(d != null);
|
|
26
|
+
}, [d]), /* @__PURE__ */ a("div", {
|
|
27
|
+
className: r(c, s.container),
|
|
28
|
+
children: /* @__PURE__ */ o("div", {
|
|
29
|
+
className: r(s.contentAnswers, M === "sidebar" && s.sidebar),
|
|
30
|
+
children: [!V && /* @__PURE__ */ a(t, {
|
|
31
|
+
...I,
|
|
32
|
+
askSuggestedQuestion: L,
|
|
33
|
+
contentName: u,
|
|
34
|
+
contentType: l,
|
|
35
|
+
error: d,
|
|
36
|
+
hasCustomSuggestedQuestions: f,
|
|
37
|
+
hasRequestInProgress: p,
|
|
38
|
+
hostAppName: N,
|
|
39
|
+
isErrorMessageShown: z,
|
|
40
|
+
isInlineCitationV2Enabled: F,
|
|
41
|
+
isReactMarkdownEnabled: P,
|
|
42
|
+
isStreamingEnabled: _,
|
|
43
|
+
items: v,
|
|
44
|
+
onSuggestedQuestionInteraction: K,
|
|
45
|
+
questions: b,
|
|
46
|
+
recordAction: G,
|
|
47
|
+
setAskSuggestedQuestion: q,
|
|
48
|
+
showLoadingIndicator: w,
|
|
49
|
+
suggestedQuestions: D,
|
|
50
|
+
useAnimation: _ && O,
|
|
51
|
+
variant: M
|
|
52
|
+
}), W && /* @__PURE__ */ a(n, {
|
|
53
|
+
askSuggestedQuestion: L,
|
|
54
|
+
enableDebugMode: h,
|
|
55
|
+
hasRequestInProgress: p,
|
|
56
|
+
isAIStudioAgentSelectorEnabled: m,
|
|
57
|
+
isDebugModeShown: V,
|
|
58
|
+
isStopResponseEnabled: g,
|
|
59
|
+
isStreamingEnabled: _,
|
|
60
|
+
lastQuestion: b[b.length - 1],
|
|
61
|
+
onRetryQuestion: S,
|
|
62
|
+
onStopQuestion: T,
|
|
63
|
+
onUserInteraction: J,
|
|
64
|
+
promptButtonClickHandler: j,
|
|
65
|
+
promptValue: y,
|
|
66
|
+
recordAction: G,
|
|
67
|
+
sendQuestion: E,
|
|
68
|
+
setAskSuggestedQuestion: R,
|
|
69
|
+
setPromptValue: C,
|
|
70
|
+
toggleDebugMode: () => {
|
|
71
|
+
H(!V);
|
|
72
|
+
},
|
|
73
|
+
variant: M
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
export { c as t };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { t as e } from "./media-container.js";
|
|
2
|
+
import { t } from "./answer.js";
|
|
3
|
+
import { t as n } from "./question.js";
|
|
4
|
+
import { t as r } from "./suggested-questions.js";
|
|
5
|
+
import { t as i } from "./thinkingBubble.js";
|
|
6
|
+
import a from "../esm/lib/components/welcome-message/messages.js";
|
|
7
|
+
import { WelcomeMessage as o } from "../esm/lib/components/welcome-message/welcome-message.js";
|
|
8
|
+
import s from "clsx";
|
|
9
|
+
import * as c from "react";
|
|
10
|
+
import { Text as l } from "@box/blueprint-web";
|
|
11
|
+
import { useIntl as u } from "react-intl";
|
|
12
|
+
import { BoxAiLogo as d } from "@box/blueprint-web-assets/icons/Logo";
|
|
13
|
+
import { Size10 as f } from "@box/blueprint-web-assets/tokens/tokens";
|
|
14
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
15
|
+
import '../styles/chat.css';var h = {
|
|
16
|
+
chat: "_chat_15mnd_2",
|
|
17
|
+
clearChatText: "_clearChatText_15mnd_2",
|
|
18
|
+
landingPage: "_landingPage_15mnd_8",
|
|
19
|
+
askQuestionText: "_askQuestionText_15mnd_16",
|
|
20
|
+
iconAvatar: "_iconAvatar_15mnd_24",
|
|
21
|
+
sidebar: "_sidebar_15mnd_42"
|
|
22
|
+
}, g = ({ askSuggestedQuestion: g, contentType: _, hasCustomSuggestedQuestions: v, hasRequestInProgress: y, isCitationsEnabled: b, isFeedbackEnabled: x, isFeedbackFormEnabled: S, isInlineCitationsEnabled: C = !1, isInlineCitationV2Enabled: w, isMarkdownEnabled: T, isSessionLoading: E = !1, onCitationClick: D, onAnswerCopy: O, embedTheAnswerButtonConfig: k, onFeedbackFormSubmit: A, onDropdownOpenChange: j, onSuggestedQuestionInteraction: M, questions: N, recordAction: P, setAnswerFeedback: F, setAskSuggestedQuestion: I, suggestedQuestions: L, suggestedQuestionsRequestState: R, shouldFeedbackFormIncludeFeedbackText: z, shouldFeedbackIncludePromptData: B, shouldShowLandingPage: V, useAnimation: H, variant: U = "modal", hostAppName: W = "", isReactMarkdownEnabled: G, welcomeMessageClearText: K, ...q }) => {
|
|
23
|
+
let { formatMessage: J } = u(), [Y, X] = c.useState(null), Z = (e, t) => {
|
|
24
|
+
X(e ? t : null);
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ p("div", {
|
|
27
|
+
className: h.chat,
|
|
28
|
+
"data-testid": "content-answers-chat",
|
|
29
|
+
children: /* @__PURE__ */ m("div", {
|
|
30
|
+
className: s({
|
|
31
|
+
[h.landingPage]: V,
|
|
32
|
+
[h.sidebar]: U === "sidebar"
|
|
33
|
+
}),
|
|
34
|
+
children: [
|
|
35
|
+
V && /* @__PURE__ */ p(e.Figure, {
|
|
36
|
+
variant: U,
|
|
37
|
+
children: /* @__PURE__ */ p("div", {
|
|
38
|
+
className: h.iconAvatar,
|
|
39
|
+
children: /* @__PURE__ */ p(d, {
|
|
40
|
+
height: f,
|
|
41
|
+
role: "presentation",
|
|
42
|
+
width: f
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ p(o, {
|
|
47
|
+
contentType: "",
|
|
48
|
+
shouldShowLandingPage: V,
|
|
49
|
+
...q,
|
|
50
|
+
variant: U
|
|
51
|
+
}),
|
|
52
|
+
V && L !== void 0 && I !== void 0 && /* @__PURE__ */ p(r, {
|
|
53
|
+
askSuggestedQuestion: g,
|
|
54
|
+
hasCustomSuggestedQuestions: v,
|
|
55
|
+
isLoading: y,
|
|
56
|
+
onSuggestedQuestionInteraction: M,
|
|
57
|
+
recordAction: P,
|
|
58
|
+
setAskSuggestedQuestion: I,
|
|
59
|
+
suggestedQuestions: L,
|
|
60
|
+
suggestedQuestionsRequestState: R,
|
|
61
|
+
variant: U
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ p(l, {
|
|
64
|
+
as: "p",
|
|
65
|
+
className: h.clearChatText,
|
|
66
|
+
children: K || J(a.welcomeClearChatText, { type: _ })
|
|
67
|
+
}),
|
|
68
|
+
!V && /* @__PURE__ */ p("ul", { children: N.map(({ answer: e, thinkingAnswer: r, citations: a, id: o, isCompleted: s, isLoading: c, error: l, prompt: u, promptType: d, feedbackValue: f }) => /* @__PURE__ */ m("li", { children: [
|
|
69
|
+
/* @__PURE__ */ p(n, {
|
|
70
|
+
prompt: u,
|
|
71
|
+
variant: U
|
|
72
|
+
}),
|
|
73
|
+
r && /* @__PURE__ */ p(i, {
|
|
74
|
+
content: r,
|
|
75
|
+
isThinkingComplete: !!e,
|
|
76
|
+
onDropdownOpenChange: j,
|
|
77
|
+
variant: U
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ p(t, {
|
|
80
|
+
answer: e,
|
|
81
|
+
citations: a,
|
|
82
|
+
contentType: _,
|
|
83
|
+
embedTheAnswerButtonConfig: k,
|
|
84
|
+
error: l,
|
|
85
|
+
feedbackValue: f,
|
|
86
|
+
hostAppName: W,
|
|
87
|
+
isCitationsEnabled: b,
|
|
88
|
+
isCompleted: s,
|
|
89
|
+
isFeedbackEnabled: x,
|
|
90
|
+
isFeedbackFormEnabled: S,
|
|
91
|
+
isFeedbackTooltipOpen: Y === o,
|
|
92
|
+
isInlineCitationsEnabled: C,
|
|
93
|
+
isInlineCitationV2Enabled: w,
|
|
94
|
+
isLoading: c || E,
|
|
95
|
+
isMarkdownEnabled: T,
|
|
96
|
+
isReactMarkdownEnabled: G,
|
|
97
|
+
items: q.items,
|
|
98
|
+
onAnswerCopy: O,
|
|
99
|
+
onCitationClick: D,
|
|
100
|
+
onFeedbackFormSubmit: A,
|
|
101
|
+
onFeedbackTooltipOpenChange: Z,
|
|
102
|
+
prompt: u,
|
|
103
|
+
promptType: d,
|
|
104
|
+
questionId: o,
|
|
105
|
+
recordAction: P,
|
|
106
|
+
setAnswerFeedback: F,
|
|
107
|
+
shouldFeedbackFormIncludeFeedbackText: z,
|
|
108
|
+
shouldFeedbackIncludePromptData: B,
|
|
109
|
+
useAnimation: H,
|
|
110
|
+
variant: U
|
|
111
|
+
})
|
|
112
|
+
] }, o)) })
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
export { g as t };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { n as e } from "./types.js";
|
|
2
|
+
import t from "../esm/lib/components/answer/messages.js";
|
|
3
|
+
import { LOGGER_ACTION_CLICK as n, LOGGER_BASE_CONFIG as r } from "../esm/lib/components/common/constants.js";
|
|
4
|
+
import "../esm/lib/components/answer/constants.js";
|
|
5
|
+
import i from "clsx";
|
|
6
|
+
import { useCallback as a, useEffect as o, useRef as s, useState as c } from "react";
|
|
7
|
+
import { Popover as l, Status as u, Text as d, TextButton as f } from "@box/blueprint-web";
|
|
8
|
+
import { useIntl as p } from "react-intl";
|
|
9
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
10
|
+
import { ArrowUpRightSquare as g } from "@box/blueprint-web-assets/icons/Fill";
|
|
11
|
+
import _ from "lodash/debounce";
|
|
12
|
+
import v from "lodash/truncate";
|
|
13
|
+
import '../styles/citation.css';var y = {
|
|
14
|
+
citationTrigger: "_citationTrigger_4yo68_1",
|
|
15
|
+
citationStatus: "_citationStatus_4yo68_5",
|
|
16
|
+
animate: "_animate_4yo68_26",
|
|
17
|
+
fadeIn: "_fadeIn_4yo68_30",
|
|
18
|
+
cardTooltip: "_cardTooltip_4yo68_34",
|
|
19
|
+
cardTooltipTitle: "_cardTooltipTitle_4yo68_38",
|
|
20
|
+
cardTooltipCitation: "_cardTooltipCitation_4yo68_42",
|
|
21
|
+
cardTooltipButton: "_cardTooltipButton_4yo68_47"
|
|
22
|
+
}, b = ({ animate: b, content: x, id: S, recordAction: C, fileId: w, title: T, onCitationClick: E, source: D }) => {
|
|
23
|
+
let [O, k] = c(!1), [A, j] = c(!b), { formatMessage: M } = p(), N = !!E && D !== e.HUBS_METADATA, P = s(null), F;
|
|
24
|
+
F = T ? M(t.cardTooltipTitleWithDocumentName, { title: T.toString() }) : M(t.cardTooltipTitle);
|
|
25
|
+
let I = _((e) => {
|
|
26
|
+
k(e), e === !0 && C && C({
|
|
27
|
+
...r,
|
|
28
|
+
feature: "answers-citations",
|
|
29
|
+
target: "hovered",
|
|
30
|
+
data: { index: S }
|
|
31
|
+
});
|
|
32
|
+
}, 100), L = () => {
|
|
33
|
+
I(!0);
|
|
34
|
+
}, R = () => {
|
|
35
|
+
I(!1);
|
|
36
|
+
}, z = a(() => {
|
|
37
|
+
E && C && (E(w, T), C({
|
|
38
|
+
...r,
|
|
39
|
+
feature: "answers-citations",
|
|
40
|
+
target: n,
|
|
41
|
+
data: { index: S }
|
|
42
|
+
}));
|
|
43
|
+
}, [
|
|
44
|
+
E,
|
|
45
|
+
C,
|
|
46
|
+
S,
|
|
47
|
+
w,
|
|
48
|
+
T
|
|
49
|
+
]);
|
|
50
|
+
o(() => {
|
|
51
|
+
b && j(!0);
|
|
52
|
+
}, []);
|
|
53
|
+
let B = x ? v(x.toString(), {
|
|
54
|
+
length: 500,
|
|
55
|
+
separator: /,? +/
|
|
56
|
+
}) : void 0;
|
|
57
|
+
return /* @__PURE__ */ h(l.Root, {
|
|
58
|
+
modal: !1,
|
|
59
|
+
open: O,
|
|
60
|
+
children: [/* @__PURE__ */ m(l.Trigger, {
|
|
61
|
+
className: y.citationTrigger,
|
|
62
|
+
onMouseEnter: L,
|
|
63
|
+
onMouseLeave: R,
|
|
64
|
+
children: /* @__PURE__ */ m(u, {
|
|
65
|
+
ref: P,
|
|
66
|
+
"aria-label": O ? B : M(t.referenceAriaLabel, { number: S }),
|
|
67
|
+
className: i(y.citationStatus, {
|
|
68
|
+
[y.animate]: b,
|
|
69
|
+
[y.fadeIn]: A
|
|
70
|
+
}),
|
|
71
|
+
colorIndex: 0,
|
|
72
|
+
"data-testid": "content-answers-citation-status",
|
|
73
|
+
onBlur: R,
|
|
74
|
+
onFocus: L,
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
text: `${S}`
|
|
77
|
+
})
|
|
78
|
+
}), /* @__PURE__ */ m(l.ContentContainer, {
|
|
79
|
+
"aria-label": B,
|
|
80
|
+
collisionPadding: 10,
|
|
81
|
+
"data-testid": "content-answers-citation-card",
|
|
82
|
+
onBlur: R,
|
|
83
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
84
|
+
onEscapeKeyDown: () => {
|
|
85
|
+
P.current?.focus(), R();
|
|
86
|
+
},
|
|
87
|
+
onFocus: L,
|
|
88
|
+
onMouseEnter: L,
|
|
89
|
+
onMouseLeave: R,
|
|
90
|
+
onOpenAutoFocus: (e) => {
|
|
91
|
+
N || e.preventDefault();
|
|
92
|
+
},
|
|
93
|
+
side: "top",
|
|
94
|
+
sideOffset: 5,
|
|
95
|
+
children: /* @__PURE__ */ m(l.MainContent, { children: /* @__PURE__ */ h("div", {
|
|
96
|
+
className: y.cardTooltip,
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ m(d, {
|
|
99
|
+
as: "h4",
|
|
100
|
+
className: y.cardTooltipTitle,
|
|
101
|
+
variant: "bodyDefaultBold",
|
|
102
|
+
children: F
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ m(d, {
|
|
105
|
+
as: "p",
|
|
106
|
+
className: y.cardTooltipCitation,
|
|
107
|
+
color: "textOnLightDefault",
|
|
108
|
+
variant: "caption",
|
|
109
|
+
children: B
|
|
110
|
+
}),
|
|
111
|
+
N && /* @__PURE__ */ m(f, {
|
|
112
|
+
"aria-label": M(t.cardTooltipButton),
|
|
113
|
+
className: y.cardTooltipButton,
|
|
114
|
+
icon: g,
|
|
115
|
+
onClick: z,
|
|
116
|
+
"data-target-id": "TextButton-cardTooltipButton",
|
|
117
|
+
children: M(t.cardTooltipButton)
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
}) })
|
|
121
|
+
})]
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export { b as t };
|
|
@@ -1,45 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import '../styles/clear-conversation-button.css';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
onClick: n,
|
|
37
|
-
size: "small",
|
|
38
|
-
"data-target-id": "IconButton-clearConversationLabel"
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
L as C,
|
|
44
|
-
T as s
|
|
1
|
+
import e from "../esm/lib/components/modal/messages.js";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import { IconButton as n, Tooltip as r, useBlueprintModernization as i } from "@box/blueprint-web";
|
|
4
|
+
import { useIntl as a } from "react-intl";
|
|
5
|
+
import { Trash as o } from "@box/blueprint-web-assets/icons/Line";
|
|
6
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
7
|
+
import { Trash as c } from "@box/blueprint-web-assets/icons/Medium";
|
|
8
|
+
import '../styles/clear-conversation-button.css';var l = {
|
|
9
|
+
BoxAIIconColor: "_BoxAIIconColor_ild3b_1",
|
|
10
|
+
modalHeader: "_modalHeader_ild3b_5",
|
|
11
|
+
contentAnswersModal: "_contentAnswersModal_ild3b_10",
|
|
12
|
+
boxAiContentAnswers: "_boxAiContentAnswers_ild3b_18",
|
|
13
|
+
clearButton: "_clearButton_ild3b_26",
|
|
14
|
+
"modal-close-button": "_modal-close-button_ild3b_30",
|
|
15
|
+
contentAnswerModal: "_contentAnswerModal_ild3b_1",
|
|
16
|
+
modalHeaderContainer: "_modalHeaderContainer_ild3b_55",
|
|
17
|
+
agentSelectorTrigger: "_agentSelectorTrigger_ild3b_63",
|
|
18
|
+
agentSelectorContent: "_agentSelectorContent_ild3b_74"
|
|
19
|
+
}, u = ({ onClick: u, hasRequestInProgress: d, className: f }) => {
|
|
20
|
+
let p = a(), { enableModernizedComponents: m } = i(), h = m ? c : o;
|
|
21
|
+
return /* @__PURE__ */ s(r, {
|
|
22
|
+
content: p.formatMessage(e.clearConversationLabel),
|
|
23
|
+
"data-testid": "clear-conversation-tooltip",
|
|
24
|
+
variant: "standard",
|
|
25
|
+
children: /* @__PURE__ */ s(n, {
|
|
26
|
+
"aria-label": p.formatMessage(e.clearConversationLabel),
|
|
27
|
+
className: t(l.clearButton, f),
|
|
28
|
+
"data-testid": "clear-conversation-button",
|
|
29
|
+
disabled: d,
|
|
30
|
+
icon: h,
|
|
31
|
+
onClick: u,
|
|
32
|
+
size: "small",
|
|
33
|
+
"data-target-id": "IconButton-clearConversationLabel"
|
|
34
|
+
})
|
|
35
|
+
});
|
|
45
36
|
};
|
|
37
|
+
export { l as n, u as t };
|