@box/box-ai-content-answers 0.158.0 → 0.159.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/esm/lib/components/answer/answer.js +153 -140
- package/dist/esm/lib/components/answer/embed-the-answer-button.js +65 -0
- package/dist/esm/lib/components/answer/messages.js +8 -0
- package/dist/esm/lib/components/chat/chat.js +74 -72
- package/dist/esm/lib/components/sidebar/content.js +78 -76
- package/dist/esm/lib/components/sidebar/sidebar.js +37 -35
- package/dist/i18n/bn-IN.js +7 -5
- package/dist/i18n/bn-IN.properties +11 -5
- package/dist/i18n/da-DK.js +7 -5
- package/dist/i18n/da-DK.properties +11 -5
- package/dist/i18n/de-DE.js +7 -5
- package/dist/i18n/de-DE.properties +11 -5
- package/dist/i18n/en-AU.js +3 -1
- package/dist/i18n/en-AU.properties +7 -1
- package/dist/i18n/en-CA.js +4 -2
- package/dist/i18n/en-CA.properties +8 -2
- package/dist/i18n/en-GB.js +3 -1
- package/dist/i18n/en-GB.properties +7 -1
- package/dist/i18n/en-US.js +2 -0
- package/dist/i18n/en-US.properties +4 -0
- package/dist/i18n/en-x-pseudo.js +88 -86
- package/dist/i18n/en-x-pseudo.properties +91 -85
- package/dist/i18n/es-419.js +7 -5
- package/dist/i18n/es-419.properties +11 -5
- package/dist/i18n/es-ES.js +7 -5
- package/dist/i18n/es-ES.properties +11 -5
- package/dist/i18n/fi-FI.js +7 -5
- package/dist/i18n/fi-FI.properties +11 -5
- package/dist/i18n/fr-CA.js +7 -5
- package/dist/i18n/fr-CA.properties +11 -5
- package/dist/i18n/fr-FR.js +7 -5
- package/dist/i18n/fr-FR.properties +11 -5
- package/dist/i18n/hi-IN.js +7 -5
- package/dist/i18n/hi-IN.properties +11 -5
- package/dist/i18n/it-IT.js +7 -5
- package/dist/i18n/it-IT.properties +11 -5
- package/dist/i18n/ja-JP.js +7 -5
- package/dist/i18n/ja-JP.properties +11 -5
- package/dist/i18n/json/src/lib/components/answer/messages.json +1 -1
- package/dist/i18n/ko-KR.js +7 -5
- package/dist/i18n/ko-KR.properties +11 -5
- package/dist/i18n/nb-NO.js +7 -5
- package/dist/i18n/nb-NO.properties +11 -5
- package/dist/i18n/nl-NL.js +7 -5
- package/dist/i18n/nl-NL.properties +11 -5
- package/dist/i18n/pl-PL.js +7 -5
- package/dist/i18n/pl-PL.properties +11 -5
- package/dist/i18n/pt-BR.js +7 -5
- package/dist/i18n/pt-BR.properties +11 -5
- package/dist/i18n/ru-RU.js +7 -5
- package/dist/i18n/ru-RU.properties +11 -5
- package/dist/i18n/sv-SE.js +7 -5
- package/dist/i18n/sv-SE.properties +11 -5
- package/dist/i18n/tr-TR.js +7 -5
- package/dist/i18n/tr-TR.properties +11 -5
- package/dist/i18n/zh-CN.js +7 -5
- package/dist/i18n/zh-CN.properties +11 -5
- package/dist/i18n/zh-TW.js +7 -5
- package/dist/i18n/zh-TW.properties +11 -5
- package/dist/styles/answer.css +1 -1
- package/dist/styles/embed-the-answer-button.css +1 -0
- package/dist/types/lib/components/answer/answer.d.ts +3 -1
- package/dist/types/lib/components/answer/embed-the-answer-button.d.ts +11 -0
- package/dist/types/lib/components/answer/messages.d.ts +10 -0
- package/dist/types/lib/components/chat/chat.d.ts +1 -1
- package/dist/types/lib/components/sidebar/content.d.ts +2 -0
- package/dist/types/lib/components/sidebar/sidebar.d.ts +2 -1
- package/dist/types/lib/stories/shared.d.ts +9 -0
- package/dist/types/lib/types.d.ts +10 -0
- package/package.json +4 -4
|
@@ -1,183 +1,196 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { AlertTriangle as
|
|
3
|
-
import { Gray65 as
|
|
4
|
-
import
|
|
5
|
-
import { memo as
|
|
6
|
-
import { useIntl as
|
|
1
|
+
import { Text as T } from "@box/blueprint-web";
|
|
2
|
+
import { AlertTriangle as X } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { Gray65 as Y, Size4 as S } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import R from "clsx";
|
|
5
|
+
import { memo as Z, useState as $, useEffect as j, useMemo as nn } from "react";
|
|
6
|
+
import { useIntl as en } from "react-intl";
|
|
7
7
|
import { A as r } from "../../../../chunks/types.js";
|
|
8
|
-
import { injectInlineCitation as
|
|
9
|
-
import { MediaContainer as
|
|
10
|
-
import { BoxAILoadingIndicator as
|
|
11
|
-
import { AnswerContent as
|
|
12
|
-
import { CopyButton as
|
|
13
|
-
import {
|
|
8
|
+
import { injectInlineCitation as tn } from "../../utils/inlineCitationsUtils.js";
|
|
9
|
+
import { MediaContainer as O } from "../common/media-container.js";
|
|
10
|
+
import { BoxAILoadingIndicator as on } from "../thinkingBubble/boxAILoadingIndicator.js";
|
|
11
|
+
import { AnswerContent as rn } from "./answer-content.js";
|
|
12
|
+
import { CopyButton as sn } from "./copy-button.js";
|
|
13
|
+
import { EmbedTheAnswerButton as an } from "./embed-the-answer-button.js";
|
|
14
|
+
import { InlineError as ln } from "./inline-error.js";
|
|
14
15
|
import u from "./messages.js";
|
|
15
|
-
import { References as
|
|
16
|
-
import { ThumbButtons as
|
|
17
|
-
import { jsxs as c, jsx as
|
|
18
|
-
import '../../../../styles/answer.css';const
|
|
19
|
-
answer:
|
|
20
|
-
loadingContainer:
|
|
21
|
-
loadingText:
|
|
22
|
-
fadeIn:
|
|
23
|
-
alertIcon:
|
|
24
|
-
error:
|
|
25
|
-
footer:
|
|
26
|
-
copyButtonContainer:
|
|
27
|
-
feedbackButtonsContainer:
|
|
28
|
-
shouldHaveMarginTop:
|
|
29
|
-
shouldUseAnimation:
|
|
30
|
-
shouldAnimateHeight:
|
|
31
|
-
footerButtons:
|
|
32
|
-
iconAvatar:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
16
|
+
import { References as cn } from "./references.js";
|
|
17
|
+
import { ThumbButtons as fn } from "./thumb-buttons.js";
|
|
18
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
19
|
+
import '../../../../styles/answer.css';const dn = "_answer_1efjn_1", _n = "_loadingContainer_1efjn_5", un = "_loadingText_1efjn_12", mn = "_fadeIn_1efjn_1", hn = "_alertIcon_1efjn_21", En = "_error_1efjn_24", Nn = "_footer_1efjn_28", pn = "_copyButtonContainer_1efjn_34", In = "_feedbackButtonsContainer_1efjn_35", gn = "_shouldHaveMarginTop_1efjn_39", Tn = "_shouldUseAnimation_1efjn_42", Sn = "_shouldAnimateHeight_1efjn_46", Rn = "_footerButtons_1efjn_50", jn = "_iconAvatar_1efjn_56", On = "_embedTheAnswerButtonContainer_1efjn_71", An = "_buttonsVisible_1efjn_79", n = {
|
|
20
|
+
answer: dn,
|
|
21
|
+
loadingContainer: _n,
|
|
22
|
+
loadingText: un,
|
|
23
|
+
fadeIn: mn,
|
|
24
|
+
alertIcon: hn,
|
|
25
|
+
error: En,
|
|
26
|
+
footer: Nn,
|
|
27
|
+
copyButtonContainer: pn,
|
|
28
|
+
feedbackButtonsContainer: In,
|
|
29
|
+
shouldHaveMarginTop: gn,
|
|
30
|
+
shouldUseAnimation: Tn,
|
|
31
|
+
shouldAnimateHeight: Sn,
|
|
32
|
+
footerButtons: Rn,
|
|
33
|
+
iconAvatar: jn,
|
|
34
|
+
embedTheAnswerButtonContainer: On,
|
|
35
|
+
buttonsVisible: An
|
|
36
|
+
}, Bn = /* @__PURE__ */ new Set([r.RATE_LIMITING, r.NO_CONTENT, r.PRECONDITION_FAILED, r.GENERAL, r.AGENT_NOT_FOUND]), Jn = /* @__PURE__ */ Z(({
|
|
37
|
+
answer: t,
|
|
38
|
+
citations: A,
|
|
39
|
+
error: o,
|
|
40
|
+
contentType: B,
|
|
41
|
+
hostAppName: f,
|
|
42
|
+
feedbackValue: b,
|
|
43
|
+
isCitationsEnabled: P = !1,
|
|
42
44
|
isCompleted: s = !1,
|
|
43
|
-
isFeedbackEnabled:
|
|
44
|
-
isFeedbackFormEnabled:
|
|
45
|
-
isFeedbackTooltipOpen:
|
|
46
|
-
isInlineCitationsEnabled:
|
|
47
|
-
isLoading:
|
|
48
|
-
isMarkdownEnabled:
|
|
49
|
-
items:
|
|
50
|
-
onAnswerCopy:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
isFeedbackEnabled: w = !1,
|
|
46
|
+
isFeedbackFormEnabled: x,
|
|
47
|
+
isFeedbackTooltipOpen: N,
|
|
48
|
+
isInlineCitationsEnabled: p = !1,
|
|
49
|
+
isLoading: C = !1,
|
|
50
|
+
isMarkdownEnabled: v = !1,
|
|
51
|
+
items: l = [],
|
|
52
|
+
onAnswerCopy: M,
|
|
53
|
+
embedTheAnswerButtonConfig: d,
|
|
54
|
+
onCitationClick: y,
|
|
55
|
+
onFeedbackFormSubmit: D,
|
|
56
|
+
onFeedbackTooltipOpenChange: L,
|
|
57
|
+
prompt: F,
|
|
58
|
+
promptType: H,
|
|
59
|
+
recordAction: a,
|
|
60
|
+
shouldFeedbackFormIncludeFeedbackText: U,
|
|
61
|
+
shouldFeedbackIncludePromptData: k,
|
|
62
|
+
useAnimation: G = !0,
|
|
63
|
+
variant: i = "modal",
|
|
64
|
+
isReactMarkdownEnabled: V,
|
|
65
|
+
setAnswerFeedback: z,
|
|
66
|
+
questionId: I
|
|
64
67
|
}) => {
|
|
65
|
-
const
|
|
66
|
-
formatMessage:
|
|
67
|
-
} =
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const m = Bn.has(o), h = C && !t && !o, [W, q] = $(s), {
|
|
69
|
+
formatMessage: _
|
|
70
|
+
} = en();
|
|
71
|
+
j(() => {
|
|
72
|
+
t && a && s && l.some((Q) => t.includes(Q.name)) && a({
|
|
70
73
|
action: "programmatic",
|
|
71
|
-
component:
|
|
74
|
+
component: i,
|
|
72
75
|
feature: "answers",
|
|
73
76
|
target: "links_detected",
|
|
74
77
|
data: {
|
|
75
|
-
hostAppName:
|
|
76
|
-
linkCount:
|
|
77
|
-
fileNameCount:
|
|
78
|
+
hostAppName: f,
|
|
79
|
+
linkCount: l.length,
|
|
80
|
+
fileNameCount: l.length
|
|
78
81
|
}
|
|
79
82
|
});
|
|
80
|
-
}, [
|
|
83
|
+
}, [t, i, f, s, a, l]), j(() => {
|
|
81
84
|
setTimeout(() => q(s), 0);
|
|
82
85
|
}, [s]);
|
|
83
|
-
const
|
|
84
|
-
className:
|
|
85
|
-
color:
|
|
86
|
+
const g = () => /* @__PURE__ */ e(X, {
|
|
87
|
+
className: n.alertIcon,
|
|
88
|
+
color: Y,
|
|
86
89
|
"data-testid": "content-answers-error-alert-icon",
|
|
87
|
-
height:
|
|
90
|
+
height: S,
|
|
88
91
|
role: "presentation",
|
|
89
|
-
width:
|
|
90
|
-
}),
|
|
92
|
+
width: S
|
|
93
|
+
}), J = () => /* @__PURE__ */ c(T, {
|
|
91
94
|
as: "p",
|
|
92
|
-
className:
|
|
95
|
+
className: n.error,
|
|
93
96
|
color: "textOnLightSecondary",
|
|
94
97
|
"data-testid": "content-answers-error",
|
|
95
98
|
variant: "caption",
|
|
96
|
-
children: [
|
|
97
|
-
}),
|
|
98
|
-
className:
|
|
99
|
-
[
|
|
99
|
+
children: [o === r.RESPONSE_INTERRUPTED && _(u.responseInterruptedError), o === r.RESPONSE_FAILED && _(u.responseFailedError), o === r.RESPONSE_STOPPED && _(u.responseStoppedError), o !== r.RESPONSE_STOPPED && g()]
|
|
100
|
+
}), K = () => o !== r.RESPONSE_STOPPED ? /* @__PURE__ */ c("div", {
|
|
101
|
+
className: R(n.footerButtons, "footer-buttons-container", {
|
|
102
|
+
[n.buttonsVisible]: N
|
|
100
103
|
}),
|
|
101
|
-
children: [
|
|
102
|
-
className:
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
-
feedbackValue:
|
|
105
|
-
hostAppName:
|
|
106
|
-
isFeedbackFormEnabled:
|
|
107
|
-
isFeedbackTooltipOpen:
|
|
108
|
-
items:
|
|
109
|
-
onFeedbackFormSubmit:
|
|
110
|
-
onFeedbackTooltipOpenChange:
|
|
111
|
-
prompt:
|
|
112
|
-
promptType:
|
|
113
|
-
questionId:
|
|
114
|
-
recordAction:
|
|
115
|
-
response:
|
|
116
|
-
setAnswerFeedback:
|
|
117
|
-
shouldFeedbackFormIncludeFeedbackText:
|
|
118
|
-
shouldFeedbackIncludePromptData:
|
|
119
|
-
variant:
|
|
104
|
+
children: [w ? /* @__PURE__ */ e("div", {
|
|
105
|
+
className: n.feedbackButtonsContainer,
|
|
106
|
+
children: /* @__PURE__ */ e(fn, {
|
|
107
|
+
feedbackValue: b,
|
|
108
|
+
hostAppName: f,
|
|
109
|
+
isFeedbackFormEnabled: x,
|
|
110
|
+
isFeedbackTooltipOpen: N,
|
|
111
|
+
items: l,
|
|
112
|
+
onFeedbackFormSubmit: D,
|
|
113
|
+
onFeedbackTooltipOpenChange: L,
|
|
114
|
+
prompt: F,
|
|
115
|
+
promptType: H,
|
|
116
|
+
questionId: I,
|
|
117
|
+
recordAction: a,
|
|
118
|
+
response: E,
|
|
119
|
+
setAnswerFeedback: z,
|
|
120
|
+
shouldFeedbackFormIncludeFeedbackText: U,
|
|
121
|
+
shouldFeedbackIncludePromptData: k,
|
|
122
|
+
variant: i
|
|
120
123
|
})
|
|
121
|
-
}) : null, /* @__PURE__ */
|
|
122
|
-
className:
|
|
123
|
-
children: /* @__PURE__ */
|
|
124
|
-
answer:
|
|
125
|
-
onAnswerCopy:
|
|
126
|
-
recordAction:
|
|
124
|
+
}) : null, /* @__PURE__ */ e("div", {
|
|
125
|
+
className: n.copyButtonContainer,
|
|
126
|
+
children: /* @__PURE__ */ e(sn, {
|
|
127
|
+
answer: t,
|
|
128
|
+
onAnswerCopy: M,
|
|
129
|
+
recordAction: a
|
|
127
130
|
})
|
|
128
131
|
})]
|
|
129
|
-
}) :
|
|
130
|
-
items:
|
|
132
|
+
}) : t ? null : g(), E = nn(() => t && tn(t, {
|
|
133
|
+
items: l,
|
|
131
134
|
isCompleted: s,
|
|
132
|
-
isInlineCitationsEnabled:
|
|
133
|
-
}), [
|
|
135
|
+
isInlineCitationsEnabled: p
|
|
136
|
+
}), [t, l, s, p]);
|
|
134
137
|
return /* @__PURE__ */ c("div", {
|
|
135
138
|
"aria-live": "polite",
|
|
136
|
-
className:
|
|
139
|
+
className: n.answer,
|
|
137
140
|
"data-testid": "content-answers-answer",
|
|
138
141
|
children: [h && /* @__PURE__ */ c("div", {
|
|
139
|
-
className:
|
|
140
|
-
children: [/* @__PURE__ */
|
|
142
|
+
className: n.loadingContainer,
|
|
143
|
+
children: [/* @__PURE__ */ e(on, {}), /* @__PURE__ */ e(T, {
|
|
141
144
|
as: "span",
|
|
142
|
-
className:
|
|
145
|
+
className: n.loadingText,
|
|
143
146
|
color: "textOnLightDefault",
|
|
144
147
|
variant: "titleMedium",
|
|
145
|
-
children:
|
|
148
|
+
children: _(u.analyzingRequest)
|
|
146
149
|
})]
|
|
147
|
-
}), !
|
|
150
|
+
}), !m && !h && /* @__PURE__ */ e(O, {
|
|
148
151
|
className: "answer",
|
|
149
|
-
variant:
|
|
150
|
-
children: /* @__PURE__ */ c(
|
|
151
|
-
isUsedInsideSidebar:
|
|
152
|
+
variant: i,
|
|
153
|
+
children: /* @__PURE__ */ c(O.Content, {
|
|
154
|
+
isUsedInsideSidebar: i === "sidebar",
|
|
152
155
|
variant: "answer",
|
|
153
|
-
children: [/* @__PURE__ */
|
|
154
|
-
answer:
|
|
155
|
-
isMarkdownEnabled:
|
|
156
|
-
isReactMarkdownEnabled:
|
|
157
|
-
variant:
|
|
156
|
+
children: [/* @__PURE__ */ e(rn, {
|
|
157
|
+
answer: E,
|
|
158
|
+
isMarkdownEnabled: v,
|
|
159
|
+
isReactMarkdownEnabled: V,
|
|
160
|
+
variant: i
|
|
158
161
|
}), s && /* @__PURE__ */ c("div", {
|
|
159
|
-
className:
|
|
160
|
-
[
|
|
161
|
-
[
|
|
162
|
-
[
|
|
162
|
+
className: R(n.footer, {
|
|
163
|
+
[n.shouldHaveMarginTop]: t,
|
|
164
|
+
[n.shouldAnimateHeight]: W,
|
|
165
|
+
[n.shouldUseAnimation]: G
|
|
163
166
|
}),
|
|
164
167
|
"data-testid": "content-answers-answer-footer",
|
|
165
|
-
children: [
|
|
166
|
-
citations:
|
|
167
|
-
onCitationClick:
|
|
168
|
-
recordAction:
|
|
169
|
-
}),
|
|
168
|
+
children: [o && J(), P && !o && /* @__PURE__ */ e(cn, {
|
|
169
|
+
citations: A,
|
|
170
|
+
onCitationClick: y,
|
|
171
|
+
recordAction: a
|
|
172
|
+
}), K()]
|
|
170
173
|
})]
|
|
171
174
|
})
|
|
172
|
-
}),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
}), !m && !h && s && (d == null ? void 0 : d.onAction) && /* @__PURE__ */ e("div", {
|
|
176
|
+
className: n.embedTheAnswerButtonContainer,
|
|
177
|
+
children: /* @__PURE__ */ e(an, {
|
|
178
|
+
answer: E,
|
|
179
|
+
embedTheAnswerButtonConfig: d,
|
|
180
|
+
hostAppName: f,
|
|
181
|
+
questionId: I,
|
|
182
|
+
recordAction: a,
|
|
183
|
+
variant: i
|
|
184
|
+
})
|
|
185
|
+
}), m && /* @__PURE__ */ e(ln, {
|
|
186
|
+
contentType: B,
|
|
187
|
+
error: o,
|
|
188
|
+
recordAction: a,
|
|
189
|
+
variant: i
|
|
177
190
|
})]
|
|
178
191
|
});
|
|
179
192
|
});
|
|
180
193
|
export {
|
|
181
|
-
|
|
182
|
-
|
|
194
|
+
Jn as Answer,
|
|
195
|
+
Jn as default
|
|
183
196
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Tooltip as N, Button as I } from "@box/blueprint-web";
|
|
2
|
+
import { BoxNotes as f } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { useState as F, useCallback as G } from "react";
|
|
4
|
+
import { useIntl as h } from "react-intl";
|
|
5
|
+
import { LOGGER_BASE_CONFIG as z, LOGGER_ACTION_CLICK as E } from "../common/constants.js";
|
|
6
|
+
import { focusInput as O } from "../common/focusInputUtils.js";
|
|
7
|
+
import p from "./messages.js";
|
|
8
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../styles/embed-the-answer-button.css';const v = "_embedTheAnswerButtonContainer_1dz6d_1", L = "_embedTheAnswerButton_1dz6d_1", b = "_completedText_1dz6d_37", l = {
|
|
10
|
+
embedTheAnswerButtonContainer: v,
|
|
11
|
+
embedTheAnswerButton: L,
|
|
12
|
+
completedText: b
|
|
13
|
+
}, M = ({
|
|
14
|
+
answer: o,
|
|
15
|
+
hostAppName: d,
|
|
16
|
+
embedTheAnswerButtonConfig: t,
|
|
17
|
+
questionId: u,
|
|
18
|
+
recordAction: s,
|
|
19
|
+
variant: _
|
|
20
|
+
}) => {
|
|
21
|
+
const {
|
|
22
|
+
formatMessage: n
|
|
23
|
+
} = h(), [a, m] = F(!1), x = () => {
|
|
24
|
+
!o || !(t != null && t.onAction) || a || (s == null || s({
|
|
25
|
+
...z,
|
|
26
|
+
action: E,
|
|
27
|
+
target: "add_to_note",
|
|
28
|
+
component: _,
|
|
29
|
+
data: {
|
|
30
|
+
hostAppName: d,
|
|
31
|
+
questionId: u || ""
|
|
32
|
+
}
|
|
33
|
+
}), t.onAction(o), m(!0), setTimeout(() => {
|
|
34
|
+
m(!1);
|
|
35
|
+
}, 5e3), O());
|
|
36
|
+
}, T = G((i) => {
|
|
37
|
+
i.target.matches(":focus-visible") || i.stopPropagation();
|
|
38
|
+
}, []);
|
|
39
|
+
if (!o || !(t != null && t.onAction))
|
|
40
|
+
return null;
|
|
41
|
+
const c = t.actionText || n(p.addToNote), r = t.completedText || n(p.addedToNote);
|
|
42
|
+
return /* @__PURE__ */ e(N, {
|
|
43
|
+
content: a ? r : c,
|
|
44
|
+
children: /* @__PURE__ */ e("div", {
|
|
45
|
+
className: l.embedTheAnswerButtonContainer,
|
|
46
|
+
children: a ? /* @__PURE__ */ e("span", {
|
|
47
|
+
className: l.completedText,
|
|
48
|
+
children: r
|
|
49
|
+
}) : /* @__PURE__ */ e(I, {
|
|
50
|
+
"aria-label": c,
|
|
51
|
+
className: l.embedTheAnswerButton,
|
|
52
|
+
icon: f,
|
|
53
|
+
onClick: x,
|
|
54
|
+
onFocusCapture: T,
|
|
55
|
+
size: "small",
|
|
56
|
+
variant: "tertiary",
|
|
57
|
+
children: c
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
M as EmbedTheAnswerButton,
|
|
64
|
+
M as default
|
|
65
|
+
};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { defineMessages as e } from "react-intl";
|
|
2
2
|
const t = e({
|
|
3
|
+
addToNote: {
|
|
4
|
+
id: "boxAI.contentAnswers.addToNote",
|
|
5
|
+
defaultMessage: "Add to Note"
|
|
6
|
+
},
|
|
7
|
+
addedToNote: {
|
|
8
|
+
id: "boxAI.contentAnswers.addedToNote",
|
|
9
|
+
defaultMessage: "Added"
|
|
10
|
+
},
|
|
3
11
|
basedOn: {
|
|
4
12
|
id: "boxAI.contentAnswers.basedOn",
|
|
5
13
|
defaultMessage: "Based on:"
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { BoxAiLogo as
|
|
1
|
+
import { Text as $ } from "@box/blueprint-web";
|
|
2
|
+
import { BoxAiLogo as w } from "@box/blueprint-web-assets/icons/Logo";
|
|
3
3
|
import { Size10 as f } 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 L from "clsx";
|
|
5
|
+
import * as P from "react";
|
|
6
|
+
import { useIntl as S } from "react-intl";
|
|
7
|
+
import { Answer as ee } from "../answer/answer.js";
|
|
8
|
+
import { MediaContainer as te } from "../common/media-container.js";
|
|
9
|
+
import { Question as oe } from "../question/question.js";
|
|
10
|
+
import { SuggestedQuestions as ae } 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 se } from "../welcome-message/welcome-message.js";
|
|
14
14
|
import { jsx as e, jsxs as _ } 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 ne = "_chat_77vqr_1", ce = "_clearChatText_77vqr_1", le = "_landingPage_77vqr_7", me = "_askQuestionText_77vqr_15", pe = "_iconAvatar_77vqr_23", de = "_sidebar_77vqr_39", a = {
|
|
16
|
+
chat: ne,
|
|
17
|
+
clearChatText: ce,
|
|
18
|
+
landingPage: le,
|
|
19
|
+
askQuestionText: me,
|
|
20
|
+
iconAvatar: pe,
|
|
21
|
+
sidebar: de
|
|
22
|
+
}, Ae = ({
|
|
23
23
|
askSuggestedQuestion: h,
|
|
24
24
|
contentType: n,
|
|
25
25
|
hasCustomSuggestedQuestions: T,
|
|
@@ -32,119 +32,121 @@ import '../../../../styles/chat.css';const se = "_chat_77vqr_1", ne = "_clearCha
|
|
|
32
32
|
isSessionLoading: u = !1,
|
|
33
33
|
onCitationClick: q,
|
|
34
34
|
onAnswerCopy: F,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
embedTheAnswerButtonConfig: A,
|
|
36
|
+
onFeedbackFormSubmit: I,
|
|
37
|
+
onDropdownOpenChange: N,
|
|
38
|
+
onSuggestedQuestionInteraction: O,
|
|
39
|
+
questions: Q,
|
|
39
40
|
recordAction: c,
|
|
40
|
-
setAnswerFeedback:
|
|
41
|
+
setAnswerFeedback: j,
|
|
41
42
|
setAskSuggestedQuestion: l,
|
|
42
43
|
suggestedQuestions: m,
|
|
43
|
-
suggestedQuestionsRequestState:
|
|
44
|
-
shouldFeedbackFormIncludeFeedbackText:
|
|
45
|
-
shouldFeedbackIncludePromptData:
|
|
44
|
+
suggestedQuestionsRequestState: y,
|
|
45
|
+
shouldFeedbackFormIncludeFeedbackText: B,
|
|
46
|
+
shouldFeedbackIncludePromptData: M,
|
|
46
47
|
shouldShowLandingPage: o,
|
|
47
|
-
useAnimation:
|
|
48
|
+
useAnimation: z,
|
|
48
49
|
variant: t = "modal",
|
|
49
|
-
hostAppName:
|
|
50
|
-
isReactMarkdownEnabled:
|
|
51
|
-
welcomeMessageClearText:
|
|
50
|
+
hostAppName: R = "",
|
|
51
|
+
isReactMarkdownEnabled: W,
|
|
52
|
+
welcomeMessageClearText: D,
|
|
52
53
|
...p
|
|
53
54
|
}) => {
|
|
54
55
|
const {
|
|
55
|
-
formatMessage:
|
|
56
|
-
} =
|
|
57
|
-
|
|
56
|
+
formatMessage: E
|
|
57
|
+
} = S(), [G, H] = P.useState(null), J = (i, r) => {
|
|
58
|
+
H(i ? r : null);
|
|
58
59
|
};
|
|
59
60
|
return /* @__PURE__ */ e("div", {
|
|
60
61
|
className: a.chat,
|
|
61
62
|
"data-testid": "content-answers-chat",
|
|
62
63
|
children: /* @__PURE__ */ _("div", {
|
|
63
|
-
className:
|
|
64
|
+
className: L({
|
|
64
65
|
[a.landingPage]: o,
|
|
65
66
|
[a.sidebar]: t === "sidebar"
|
|
66
67
|
}),
|
|
67
|
-
children: [o && /* @__PURE__ */ e(
|
|
68
|
+
children: [o && /* @__PURE__ */ e(te.Figure, {
|
|
68
69
|
variant: t,
|
|
69
70
|
children: /* @__PURE__ */ e("div", {
|
|
70
71
|
className: a.iconAvatar,
|
|
71
|
-
children: /* @__PURE__ */ e(
|
|
72
|
+
children: /* @__PURE__ */ e(w, {
|
|
72
73
|
height: f,
|
|
73
74
|
role: "presentation",
|
|
74
75
|
width: f
|
|
75
76
|
})
|
|
76
77
|
})
|
|
77
|
-
}), /* @__PURE__ */ e(
|
|
78
|
+
}), /* @__PURE__ */ e(se, {
|
|
78
79
|
contentType: "",
|
|
79
80
|
shouldShowLandingPage: o,
|
|
80
81
|
...p,
|
|
81
82
|
variant: t
|
|
82
|
-
}), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(
|
|
83
|
+
}), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(ae, {
|
|
83
84
|
askSuggestedQuestion: h,
|
|
84
85
|
hasCustomSuggestedQuestions: T,
|
|
85
86
|
isLoading: x,
|
|
86
|
-
onSuggestedQuestionInteraction:
|
|
87
|
+
onSuggestedQuestionInteraction: O,
|
|
87
88
|
recordAction: c,
|
|
88
89
|
setAskSuggestedQuestion: l,
|
|
89
90
|
suggestedQuestions: m,
|
|
90
|
-
suggestedQuestionsRequestState:
|
|
91
|
+
suggestedQuestionsRequestState: y,
|
|
91
92
|
variant: t
|
|
92
|
-
}), /* @__PURE__ */ e(
|
|
93
|
+
}), /* @__PURE__ */ e($, {
|
|
93
94
|
as: "p",
|
|
94
95
|
className: a.clearChatText,
|
|
95
|
-
children:
|
|
96
|
+
children: D || E(re.welcomeClearChatText, {
|
|
96
97
|
type: n
|
|
97
98
|
})
|
|
98
99
|
}), !o && /* @__PURE__ */ e("ul", {
|
|
99
|
-
children:
|
|
100
|
+
children: Q.map(({
|
|
100
101
|
answer: i,
|
|
101
102
|
thinkingAnswer: r,
|
|
102
|
-
citations:
|
|
103
|
+
citations: K,
|
|
103
104
|
id: s,
|
|
104
|
-
isCompleted:
|
|
105
|
-
isLoading:
|
|
106
|
-
error:
|
|
105
|
+
isCompleted: U,
|
|
106
|
+
isLoading: V,
|
|
107
|
+
error: X,
|
|
107
108
|
prompt: d,
|
|
108
|
-
promptType:
|
|
109
|
-
feedbackValue:
|
|
109
|
+
promptType: Y,
|
|
110
|
+
feedbackValue: Z
|
|
110
111
|
}) => /* @__PURE__ */ _("li", {
|
|
111
|
-
children: [/* @__PURE__ */ e(
|
|
112
|
+
children: [/* @__PURE__ */ e(oe, {
|
|
112
113
|
prompt: d,
|
|
113
114
|
variant: t
|
|
114
|
-
}), r && /* @__PURE__ */ e(
|
|
115
|
+
}), r && /* @__PURE__ */ e(ie, {
|
|
115
116
|
content: r,
|
|
116
117
|
isThinkingComplete: !!i,
|
|
117
|
-
onDropdownOpenChange:
|
|
118
|
+
onDropdownOpenChange: N,
|
|
118
119
|
variant: t
|
|
119
|
-
}), /* @__PURE__ */ e(
|
|
120
|
+
}), /* @__PURE__ */ e(ee, {
|
|
120
121
|
answer: i,
|
|
121
|
-
citations:
|
|
122
|
+
citations: K,
|
|
122
123
|
contentType: n,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
embedTheAnswerButtonConfig: A,
|
|
125
|
+
error: X,
|
|
126
|
+
feedbackValue: Z,
|
|
127
|
+
hostAppName: R,
|
|
126
128
|
isCitationsEnabled: b,
|
|
127
|
-
isCompleted:
|
|
129
|
+
isCompleted: U,
|
|
128
130
|
isFeedbackEnabled: C,
|
|
129
131
|
isFeedbackFormEnabled: v,
|
|
130
|
-
isFeedbackTooltipOpen:
|
|
132
|
+
isFeedbackTooltipOpen: G === s,
|
|
131
133
|
isInlineCitationsEnabled: g,
|
|
132
|
-
isLoading:
|
|
134
|
+
isLoading: V || u,
|
|
133
135
|
isMarkdownEnabled: k,
|
|
134
|
-
isReactMarkdownEnabled:
|
|
136
|
+
isReactMarkdownEnabled: W,
|
|
135
137
|
items: p.items,
|
|
136
138
|
onAnswerCopy: F,
|
|
137
139
|
onCitationClick: q,
|
|
138
|
-
onFeedbackFormSubmit:
|
|
139
|
-
onFeedbackTooltipOpenChange:
|
|
140
|
+
onFeedbackFormSubmit: I,
|
|
141
|
+
onFeedbackTooltipOpenChange: J,
|
|
140
142
|
prompt: d,
|
|
141
|
-
promptType:
|
|
143
|
+
promptType: Y,
|
|
142
144
|
questionId: s,
|
|
143
145
|
recordAction: c,
|
|
144
|
-
setAnswerFeedback:
|
|
145
|
-
shouldFeedbackFormIncludeFeedbackText:
|
|
146
|
-
shouldFeedbackIncludePromptData:
|
|
147
|
-
useAnimation:
|
|
146
|
+
setAnswerFeedback: j,
|
|
147
|
+
shouldFeedbackFormIncludeFeedbackText: B,
|
|
148
|
+
shouldFeedbackIncludePromptData: M,
|
|
149
|
+
useAnimation: z,
|
|
148
150
|
variant: t
|
|
149
151
|
})]
|
|
150
152
|
}, s))
|
|
@@ -153,6 +155,6 @@ import '../../../../styles/chat.css';const se = "_chat_77vqr_1", ne = "_clearCha
|
|
|
153
155
|
});
|
|
154
156
|
};
|
|
155
157
|
export {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
Ae as Chat,
|
|
159
|
+
Ae as default
|
|
158
160
|
};
|