@box/box-ai-content-answers 0.57.0 → 0.57.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/esm/lib/box-ai-content-answers.js +49 -48
- package/esm/lib/components/answer/answer.js +79 -86
- package/esm/lib/components/answer/inline-error.js +22 -24
- package/esm/lib/components/answer/loading-element.js +19 -22
- package/esm/lib/components/chat/chat.js +61 -70
- package/esm/lib/components/common/media-container.js +28 -34
- package/esm/lib/components/content/content.js +82 -66
- package/esm/lib/components/question/question.js +23 -25
- package/esm/lib/components/welcome-message/welcome-message.js +16 -18
- package/package.json +3 -3
- package/styles/answer.css +1 -1
- package/styles/media-container.css +1 -1
- package/types/lib/components/answer/answer.d.ts +1 -5
- package/types/lib/components/answer/inline-error.d.ts +1 -2
- package/types/lib/components/answer/loading-element.d.ts +1 -4
- package/types/lib/components/chat/chat.d.ts +1 -1
- package/types/lib/components/common/media-container.d.ts +0 -1
- package/types/lib/components/content/content.d.ts +1 -1
- package/types/lib/components/question/question.d.ts +1 -3
- package/types/lib/components/welcome-message/welcome-message.d.ts +1 -1
- package/types/lib/types.d.ts +0 -2
|
@@ -5,71 +5,72 @@ import { AgentEditor as k } from "./components/agents/agent-editor.js";
|
|
|
5
5
|
import { Content as C } from "./components/content/content.js";
|
|
6
6
|
import { Footer as F } from "./components/footer/footer.js";
|
|
7
7
|
import { jsx as n, jsxs as N } from "react/jsx-runtime";
|
|
8
|
-
const y = "_container_hi5vt_1", B = "_contentAnswers_hi5vt_5",
|
|
8
|
+
const y = "_container_hi5vt_1", B = "_contentAnswers_hi5vt_5", w = {
|
|
9
9
|
container: y,
|
|
10
10
|
contentAnswers: B
|
|
11
11
|
}, O = ({
|
|
12
|
-
className:
|
|
13
|
-
contentType:
|
|
12
|
+
className: S,
|
|
13
|
+
contentType: u,
|
|
14
14
|
error: t,
|
|
15
|
-
hasRequestInProgress:
|
|
16
|
-
isAgentSelectorEnabled:
|
|
17
|
-
isDebugModeEnabled:
|
|
18
|
-
isStreamingEnabled:
|
|
15
|
+
hasRequestInProgress: c,
|
|
16
|
+
isAgentSelectorEnabled: h,
|
|
17
|
+
isDebugModeEnabled: A,
|
|
18
|
+
isStreamingEnabled: o,
|
|
19
19
|
userInfo: l,
|
|
20
|
-
questions:
|
|
21
|
-
recordAction:
|
|
22
|
-
retryQuestion:
|
|
23
|
-
showLoadingIndicator:
|
|
24
|
-
stopQuestion:
|
|
25
|
-
submitQuestion:
|
|
26
|
-
suggestedQuestions:
|
|
27
|
-
useAnimation:
|
|
28
|
-
onAgentEditorToggle:
|
|
29
|
-
...
|
|
20
|
+
questions: i,
|
|
21
|
+
recordAction: r,
|
|
22
|
+
retryQuestion: M,
|
|
23
|
+
showLoadingIndicator: a,
|
|
24
|
+
stopQuestion: Q,
|
|
25
|
+
submitQuestion: _,
|
|
26
|
+
suggestedQuestions: x,
|
|
27
|
+
useAnimation: b,
|
|
28
|
+
onAgentEditorToggle: v,
|
|
29
|
+
...D
|
|
30
30
|
}) => {
|
|
31
|
-
const [
|
|
31
|
+
const [m, g] = s.useState(null), [f, d] = s.useState(t != null), [e, p] = s.useState(!1), E = !f && !a;
|
|
32
32
|
return s.useEffect(() => {
|
|
33
33
|
d(t != null);
|
|
34
34
|
}, [t]), /* @__PURE__ */ n("div", {
|
|
35
|
-
className: j(
|
|
35
|
+
className: j(S, w.container),
|
|
36
36
|
children: /* @__PURE__ */ N("div", {
|
|
37
|
-
className:
|
|
37
|
+
className: w.contentAnswers,
|
|
38
38
|
children: [!e && /* @__PURE__ */ n(C, {
|
|
39
|
-
...
|
|
40
|
-
askSuggestedQuestion:
|
|
41
|
-
contentType:
|
|
39
|
+
...D,
|
|
40
|
+
askSuggestedQuestion: m,
|
|
41
|
+
contentType: u,
|
|
42
42
|
error: t,
|
|
43
|
-
hasRequestInProgress:
|
|
44
|
-
isErrorMessageShown:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
hasRequestInProgress: c,
|
|
44
|
+
isErrorMessageShown: f,
|
|
45
|
+
isStreamingEnabled: o,
|
|
46
|
+
questions: i,
|
|
47
|
+
recordAction: r,
|
|
48
|
+
setAskSuggestedQuestion: g,
|
|
48
49
|
setIsErrorMessageShown: d,
|
|
49
|
-
showLoadingIndicator:
|
|
50
|
-
suggestedQuestions:
|
|
51
|
-
useAnimation:
|
|
50
|
+
showLoadingIndicator: a,
|
|
51
|
+
suggestedQuestions: x,
|
|
52
|
+
useAnimation: o && b,
|
|
52
53
|
userInfo: l
|
|
53
54
|
}), e && /* @__PURE__ */ n(k, {
|
|
54
|
-
onAgentEditorToggle:
|
|
55
|
-
recordAction:
|
|
56
|
-
setIsDebugModeShown:
|
|
57
|
-
}),
|
|
58
|
-
askSuggestedQuestion:
|
|
59
|
-
contentType:
|
|
60
|
-
enableDebugMode:
|
|
61
|
-
hasRequestInProgress:
|
|
62
|
-
isAgentSelectorEnabled:
|
|
55
|
+
onAgentEditorToggle: v,
|
|
56
|
+
recordAction: r,
|
|
57
|
+
setIsDebugModeShown: p
|
|
58
|
+
}), E && /* @__PURE__ */ n(F, {
|
|
59
|
+
askSuggestedQuestion: m,
|
|
60
|
+
contentType: u,
|
|
61
|
+
enableDebugMode: A,
|
|
62
|
+
hasRequestInProgress: c,
|
|
63
|
+
isAgentSelectorEnabled: h,
|
|
63
64
|
isDebugModeShown: e,
|
|
64
|
-
isStreamingEnabled:
|
|
65
|
-
lastQuestion:
|
|
66
|
-
onRetryQuestion:
|
|
67
|
-
onStopQuestion:
|
|
68
|
-
recordAction:
|
|
69
|
-
sendQuestion:
|
|
70
|
-
setAskSuggestedQuestion:
|
|
65
|
+
isStreamingEnabled: o,
|
|
66
|
+
lastQuestion: i[i.length - 1],
|
|
67
|
+
onRetryQuestion: M,
|
|
68
|
+
onStopQuestion: Q,
|
|
69
|
+
recordAction: r,
|
|
70
|
+
sendQuestion: _,
|
|
71
|
+
setAskSuggestedQuestion: g,
|
|
71
72
|
toggleDebugMode: () => {
|
|
72
|
-
|
|
73
|
+
p(!e);
|
|
73
74
|
},
|
|
74
75
|
user: l
|
|
75
76
|
})]
|
|
@@ -1,110 +1,103 @@
|
|
|
1
1
|
import "../../../../styles/answer.css";
|
|
2
|
-
import { useBreakpoint as
|
|
3
|
-
import { BoxAi as
|
|
4
|
-
import { Size5 as
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import { A as
|
|
9
|
-
import { MediaContainer as
|
|
10
|
-
import { AnswerContent as
|
|
11
|
-
import { CopyButton as
|
|
12
|
-
import { InlineError as
|
|
13
|
-
import { LoadingElement as
|
|
14
|
-
import
|
|
15
|
-
import { References as
|
|
16
|
-
import { jsxs as
|
|
17
|
-
const
|
|
18
|
-
answer:
|
|
19
|
-
alertIcon:
|
|
20
|
-
error:
|
|
21
|
-
footer:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
iconAvatar:
|
|
25
|
-
},
|
|
26
|
-
answer:
|
|
27
|
-
citations:
|
|
28
|
-
error:
|
|
29
|
-
contentType:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
recordAction: c,
|
|
38
|
-
useAnimation: m = !0
|
|
2
|
+
import { useBreakpoint as v, Breakpoint as P, Text as T } from "@box/blueprint-web";
|
|
3
|
+
import { BoxAi as j, AlertTriangle as L } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import { Size5 as x, Size6 as D, Gray65 as F, Size4 as f } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import M from "clsx";
|
|
6
|
+
import * as m from "react";
|
|
7
|
+
import { useIntl as U } from "react-intl";
|
|
8
|
+
import { A as t } from "../../../../chunks/types.js";
|
|
9
|
+
import { MediaContainer as l } from "../common/media-container.js";
|
|
10
|
+
import { AnswerContent as k } from "./answer-content.js";
|
|
11
|
+
import { CopyButton as y } from "./copy-button.js";
|
|
12
|
+
import { InlineError as z } from "./inline-error.js";
|
|
13
|
+
import { LoadingElement as B } from "./loading-element.js";
|
|
14
|
+
import d from "./messages.js";
|
|
15
|
+
import { References as H } from "./references.js";
|
|
16
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
17
|
+
const C = "_answer_17ojr_1", G = "_alertIcon_17ojr_4", b = "_error_17ojr_7", W = "_footer_17ojr_11", q = "_shouldUseAnimation_17ojr_16", J = "_shouldAnimateHeight_17ojr_20", K = "_iconAvatar_17ojr_24", r = {
|
|
18
|
+
answer: C,
|
|
19
|
+
alertIcon: G,
|
|
20
|
+
error: b,
|
|
21
|
+
footer: W,
|
|
22
|
+
shouldUseAnimation: q,
|
|
23
|
+
shouldAnimateHeight: J,
|
|
24
|
+
iconAvatar: K
|
|
25
|
+
}, Q = /* @__PURE__ */ new Set([t.RATE_LIMITING, t.NO_CONTENT, t.PRECONDITION_FAILED, t.GENERAL]), po = /* @__PURE__ */ m.memo(({
|
|
26
|
+
answer: a,
|
|
27
|
+
citations: h,
|
|
28
|
+
error: o,
|
|
29
|
+
contentType: S,
|
|
30
|
+
isCitationsEnabled: u = !1,
|
|
31
|
+
isCompleted: s = !1,
|
|
32
|
+
isLoading: A = !1,
|
|
33
|
+
isMarkdownEnabled: I = !1,
|
|
34
|
+
onCitationClick: N,
|
|
35
|
+
recordAction: i,
|
|
36
|
+
useAnimation: R = !0
|
|
39
37
|
}) => {
|
|
40
|
-
const E =
|
|
41
|
-
formatMessage:
|
|
42
|
-
} =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
n && a && a(i ? "instant" : "smooth", i);
|
|
49
|
-
}, [n, a, i]);
|
|
50
|
-
const A = () => /* @__PURE__ */ s(T, {
|
|
38
|
+
const E = Q.has(o), p = A && !a && !o, [w, g] = m.useState(s), {
|
|
39
|
+
formatMessage: c
|
|
40
|
+
} = U(), _ = v() === P.Small ? x : D;
|
|
41
|
+
m.useEffect(() => {
|
|
42
|
+
setTimeout(() => g(s), 0);
|
|
43
|
+
}, [s]);
|
|
44
|
+
const O = () => /* @__PURE__ */ n(T, {
|
|
51
45
|
as: "p",
|
|
52
|
-
className:
|
|
46
|
+
className: r.error,
|
|
53
47
|
color: "textOnLightSecondary",
|
|
54
48
|
"data-testid": "content-answers-error",
|
|
55
49
|
variant: "caption",
|
|
56
|
-
children: [
|
|
57
|
-
className:
|
|
58
|
-
color:
|
|
50
|
+
children: [o === t.RESPONSE_INTERRUPTED && c(d.responseInterruptedError), o === t.RESPONSE_FAILED && c(d.responseFailedError), o === t.RESPONSE_STOPPED && c(d.responseStoppedError), o !== t.RESPONSE_STOPPED && /* @__PURE__ */ e(L, {
|
|
51
|
+
className: r.alertIcon,
|
|
52
|
+
color: F,
|
|
59
53
|
"data-testid": "content-answers-error-alert-icon",
|
|
60
|
-
height:
|
|
54
|
+
height: f,
|
|
61
55
|
role: "presentation",
|
|
62
|
-
width:
|
|
56
|
+
width: f
|
|
63
57
|
})]
|
|
64
58
|
});
|
|
65
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ n("div", {
|
|
66
60
|
"aria-live": "polite",
|
|
67
|
-
className:
|
|
61
|
+
className: r.answer,
|
|
68
62
|
"data-testid": "content-answers-answer",
|
|
69
|
-
children: [!
|
|
70
|
-
children: [/* @__PURE__ */
|
|
71
|
-
children: /* @__PURE__ */
|
|
72
|
-
className:
|
|
73
|
-
children: /* @__PURE__ */
|
|
74
|
-
height:
|
|
63
|
+
children: [!E && !p && /* @__PURE__ */ n(l, {
|
|
64
|
+
children: [/* @__PURE__ */ e(l.Figure, {
|
|
65
|
+
children: /* @__PURE__ */ e("div", {
|
|
66
|
+
className: r.iconAvatar,
|
|
67
|
+
children: /* @__PURE__ */ e(j, {
|
|
68
|
+
height: _,
|
|
75
69
|
role: "presentation",
|
|
76
|
-
width:
|
|
70
|
+
width: _
|
|
77
71
|
})
|
|
78
72
|
})
|
|
79
|
-
}), /* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
[
|
|
73
|
+
}), /* @__PURE__ */ n(l.Content, {
|
|
74
|
+
children: [/* @__PURE__ */ e(k, {
|
|
75
|
+
answer: a,
|
|
76
|
+
isMarkdownEnabled: I
|
|
77
|
+
}), s && /* @__PURE__ */ n("div", {
|
|
78
|
+
className: M(r.footer, {
|
|
79
|
+
[r.shouldUseAnimation]: R,
|
|
80
|
+
[r.shouldAnimateHeight]: w
|
|
87
81
|
}),
|
|
88
82
|
"data-testid": "content-answers-answer-footer",
|
|
89
|
-
children: [
|
|
90
|
-
citations:
|
|
91
|
-
onCitationClick:
|
|
92
|
-
recordAction:
|
|
93
|
-
}), /* @__PURE__ */
|
|
94
|
-
answer:
|
|
95
|
-
recordAction:
|
|
83
|
+
children: [o && O(), u && !o && /* @__PURE__ */ e(H, {
|
|
84
|
+
citations: h,
|
|
85
|
+
onCitationClick: N,
|
|
86
|
+
recordAction: i
|
|
87
|
+
}), /* @__PURE__ */ e(y, {
|
|
88
|
+
answer: a,
|
|
89
|
+
recordAction: i
|
|
96
90
|
})]
|
|
97
91
|
})]
|
|
98
92
|
})]
|
|
99
|
-
}),
|
|
100
|
-
contentType:
|
|
101
|
-
error:
|
|
102
|
-
recordAction:
|
|
103
|
-
|
|
104
|
-
}), h && /* @__PURE__ */ t(j, {})]
|
|
93
|
+
}), E && /* @__PURE__ */ e(z, {
|
|
94
|
+
contentType: S,
|
|
95
|
+
error: o,
|
|
96
|
+
recordAction: i
|
|
97
|
+
}), p && /* @__PURE__ */ e(B, {})]
|
|
105
98
|
});
|
|
106
99
|
});
|
|
107
100
|
export {
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
po as Answer,
|
|
102
|
+
po as default
|
|
110
103
|
};
|
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import "../../../../styles/inline-error.css";
|
|
2
|
-
import { useBreakpoint as
|
|
3
|
-
import { BoxAi as
|
|
4
|
-
import { Size5 as a, Size6 as
|
|
2
|
+
import { useBreakpoint as p, Breakpoint as _, Text as h } from "@box/blueprint-web";
|
|
3
|
+
import { BoxAi as u, AlertTriangle as x } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import { Size5 as a, Size6 as N } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
5
|
import * as d from "react";
|
|
6
|
-
import { useIntl as
|
|
6
|
+
import { useIntl as v } from "react-intl";
|
|
7
7
|
import { A as s } from "../../../../chunks/types.js";
|
|
8
|
-
import { LOGGER_BASE_CONFIG as
|
|
8
|
+
import { LOGGER_BASE_CONFIG as g } from "../common/constants.js";
|
|
9
9
|
import { MediaContainer as l } from "../common/media-container.js";
|
|
10
10
|
import t from "./messages.js";
|
|
11
11
|
import { jsx as r, jsxs as f } from "react/jsx-runtime";
|
|
12
|
-
const
|
|
13
|
-
inlineError:
|
|
14
|
-
text:
|
|
15
|
-
icon:
|
|
16
|
-
iconAvatar:
|
|
17
|
-
},
|
|
12
|
+
const A = "_inlineError_ft07o_1", S = "_text_ft07o_4", T = "_icon_ft07o_14", I = "_iconAvatar_ft07o_18", i = {
|
|
13
|
+
inlineError: A,
|
|
14
|
+
text: S,
|
|
15
|
+
icon: T,
|
|
16
|
+
iconAvatar: I
|
|
17
|
+
}, z = ({
|
|
18
18
|
error: n,
|
|
19
19
|
contentType: c,
|
|
20
|
-
recordAction: o
|
|
21
|
-
useAnimation: E
|
|
20
|
+
recordAction: o
|
|
22
21
|
}) => {
|
|
23
22
|
const {
|
|
24
23
|
formatMessage: e
|
|
25
|
-
} =
|
|
24
|
+
} = v();
|
|
26
25
|
d.useEffect(() => {
|
|
27
26
|
o && o({
|
|
28
|
-
...
|
|
27
|
+
...g,
|
|
29
28
|
target: "inlineError"
|
|
30
29
|
});
|
|
31
30
|
}, [o]);
|
|
32
|
-
const
|
|
31
|
+
const E = d.useCallback(() => {
|
|
33
32
|
switch (n) {
|
|
34
33
|
case s.RATE_LIMITING:
|
|
35
34
|
return e(t.inlineRateLimitingErrorText);
|
|
@@ -42,7 +41,7 @@ const S = "_inlineError_ft07o_1", T = "_text_ft07o_4", I = "_icon_ft07o_14", R =
|
|
|
42
41
|
default:
|
|
43
42
|
return e(t.inlineErrorText);
|
|
44
43
|
}
|
|
45
|
-
}, [c, n, e]), m =
|
|
44
|
+
}, [c, n, e]), m = p() === _.Small ? a : N;
|
|
46
45
|
return /* @__PURE__ */ r("div", {
|
|
47
46
|
className: i.inlineError,
|
|
48
47
|
"data-testid": "content-answers-inline-error",
|
|
@@ -51,7 +50,7 @@ const S = "_inlineError_ft07o_1", T = "_text_ft07o_4", I = "_icon_ft07o_14", R =
|
|
|
51
50
|
variant: "center-aligned",
|
|
52
51
|
children: /* @__PURE__ */ r("div", {
|
|
53
52
|
className: i.iconAvatar,
|
|
54
|
-
children: /* @__PURE__ */ r(
|
|
53
|
+
children: /* @__PURE__ */ r(u, {
|
|
55
54
|
height: m,
|
|
56
55
|
role: "presentation",
|
|
57
56
|
width: m
|
|
@@ -59,25 +58,24 @@ const S = "_inlineError_ft07o_1", T = "_text_ft07o_4", I = "_icon_ft07o_14", R =
|
|
|
59
58
|
})
|
|
60
59
|
}), /* @__PURE__ */ f(l.Content, {
|
|
61
60
|
shouldAddCard: !1,
|
|
62
|
-
useAnimation: E,
|
|
63
61
|
variant: "error",
|
|
64
62
|
children: [/* @__PURE__ */ r("div", {
|
|
65
63
|
className: i.icon,
|
|
66
|
-
children: /* @__PURE__ */ r(
|
|
64
|
+
children: /* @__PURE__ */ r(x, {
|
|
67
65
|
height: a,
|
|
68
66
|
role: "presentation",
|
|
69
67
|
width: a
|
|
70
68
|
})
|
|
71
|
-
}), /* @__PURE__ */ r(
|
|
69
|
+
}), /* @__PURE__ */ r(h, {
|
|
72
70
|
as: "p",
|
|
73
71
|
className: i.text,
|
|
74
|
-
children: n &&
|
|
72
|
+
children: n && E()
|
|
75
73
|
})]
|
|
76
74
|
})]
|
|
77
75
|
})
|
|
78
76
|
});
|
|
79
77
|
};
|
|
80
78
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
z as InlineError,
|
|
80
|
+
z as default
|
|
83
81
|
};
|
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
import "../../../../styles/loading-element.css";
|
|
2
|
-
import { useBreakpoint as
|
|
3
|
-
import { BoxAi as
|
|
4
|
-
import { Size5 as
|
|
5
|
-
import { useIntl as
|
|
2
|
+
import { useBreakpoint as t, Breakpoint as e, LoadingIndicator as l } from "@box/blueprint-web";
|
|
3
|
+
import { BoxAi as s } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import { Size5 as d, Size6 as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import { useIntl as m } from "react-intl";
|
|
6
6
|
import { MediaContainer as o } from "../common/media-container.js";
|
|
7
|
-
import
|
|
8
|
-
import { jsx as i, jsxs as
|
|
9
|
-
const
|
|
10
|
-
loadingElement:
|
|
11
|
-
loadingIndicator:
|
|
12
|
-
iconAvatar:
|
|
13
|
-
},
|
|
14
|
-
useAnimation: r
|
|
15
|
-
}) => {
|
|
7
|
+
import p from "./messages.js";
|
|
8
|
+
import { jsx as i, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
const f = "_loadingElement_1pjir_1", v = "_loadingIndicator_1pjir_1", _ = "_iconAvatar_1pjir_5", n = {
|
|
10
|
+
loadingElement: f,
|
|
11
|
+
loadingIndicator: v,
|
|
12
|
+
iconAvatar: _
|
|
13
|
+
}, w = () => {
|
|
16
14
|
const {
|
|
17
|
-
formatMessage:
|
|
18
|
-
} =
|
|
15
|
+
formatMessage: r
|
|
16
|
+
} = m(), a = t() === e.Small ? d : c;
|
|
19
17
|
return /* @__PURE__ */ i("div", {
|
|
20
18
|
className: n.loadingElement,
|
|
21
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ g(o, {
|
|
22
20
|
children: [/* @__PURE__ */ i(o.Figure, {
|
|
23
21
|
children: /* @__PURE__ */ i("div", {
|
|
24
22
|
className: n.iconAvatar,
|
|
25
|
-
children: /* @__PURE__ */ i(
|
|
23
|
+
children: /* @__PURE__ */ i(s, {
|
|
26
24
|
height: a,
|
|
27
25
|
role: "presentation",
|
|
28
26
|
width: a
|
|
29
27
|
})
|
|
30
28
|
})
|
|
31
29
|
}), /* @__PURE__ */ i(o.Content, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"aria-label": t(g.loadingAnswer),
|
|
30
|
+
children: /* @__PURE__ */ i(l, {
|
|
31
|
+
"aria-label": r(p.loadingAnswer),
|
|
35
32
|
className: n.loadingIndicator,
|
|
36
33
|
"data-testid": "content-answers-loading-indicator"
|
|
37
34
|
})
|
|
@@ -40,6 +37,6 @@ const v = "_loadingElement_1pjir_1", _ = "_loadingIndicator_1pjir_1", h = "_icon
|
|
|
40
37
|
});
|
|
41
38
|
};
|
|
42
39
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
w as LoadingElement,
|
|
41
|
+
w as default
|
|
45
42
|
};
|
|
@@ -1,76 +1,67 @@
|
|
|
1
1
|
import "../../../../styles/chat.css";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
handleScrollToBottom: i,
|
|
14
|
-
hasRequestInProgress: l,
|
|
15
|
-
isCitationsEnabled: n,
|
|
2
|
+
import { Answer as w } from "../answer/answer.js";
|
|
3
|
+
import { Question as C } from "../question/question.js";
|
|
4
|
+
import { SuggestedQuestions as L } from "../suggested-questions/suggested-questions.js";
|
|
5
|
+
import { WelcomeMessage as N } from "../welcome-message/welcome-message.js";
|
|
6
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
7
|
+
const W = "_chat_fj1ue_1", b = {
|
|
8
|
+
chat: W
|
|
9
|
+
}, G = ({
|
|
10
|
+
askSuggestedQuestion: c,
|
|
11
|
+
hasRequestInProgress: e,
|
|
12
|
+
isCitationsEnabled: m,
|
|
16
13
|
isMarkdownEnabled: s,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
questions: d,
|
|
14
|
+
onCitationClick: h,
|
|
15
|
+
questions: p,
|
|
20
16
|
recordAction: o,
|
|
21
17
|
setAskSuggestedQuestion: r,
|
|
22
|
-
suggestedQuestions:
|
|
23
|
-
suggestedQuestionsRequestState:
|
|
24
|
-
useAnimation:
|
|
25
|
-
userInfo:
|
|
26
|
-
...
|
|
27
|
-
}) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})]
|
|
69
|
-
}, y))
|
|
70
|
-
})]
|
|
71
|
-
});
|
|
72
|
-
};
|
|
18
|
+
suggestedQuestions: a,
|
|
19
|
+
suggestedQuestionsRequestState: d,
|
|
20
|
+
useAnimation: l,
|
|
21
|
+
userInfo: f,
|
|
22
|
+
...i
|
|
23
|
+
}) => /* @__PURE__ */ n("div", {
|
|
24
|
+
className: b.chat,
|
|
25
|
+
"data-testid": "content-answers-chat",
|
|
26
|
+
children: [/* @__PURE__ */ t(N, {
|
|
27
|
+
...i
|
|
28
|
+
}), a !== void 0 && r !== void 0 && /* @__PURE__ */ t(L, {
|
|
29
|
+
askSuggestedQuestion: c,
|
|
30
|
+
isLoading: e,
|
|
31
|
+
recordAction: o,
|
|
32
|
+
setAskSuggestedQuestion: r,
|
|
33
|
+
suggestedQuestions: a,
|
|
34
|
+
suggestedQuestionsRequestState: d
|
|
35
|
+
}), /* @__PURE__ */ t("ul", {
|
|
36
|
+
children: p.map(({
|
|
37
|
+
answer: j,
|
|
38
|
+
citations: u,
|
|
39
|
+
id: v,
|
|
40
|
+
isCompleted: x,
|
|
41
|
+
isLoading: y,
|
|
42
|
+
error: _,
|
|
43
|
+
prompt: T
|
|
44
|
+
}) => /* @__PURE__ */ n("li", {
|
|
45
|
+
children: [/* @__PURE__ */ t(C, {
|
|
46
|
+
prompt: T,
|
|
47
|
+
userInfo: f
|
|
48
|
+
}), /* @__PURE__ */ t(w, {
|
|
49
|
+
answer: j,
|
|
50
|
+
citations: u,
|
|
51
|
+
contentType: i.contentType,
|
|
52
|
+
error: _,
|
|
53
|
+
isCitationsEnabled: m,
|
|
54
|
+
isCompleted: x,
|
|
55
|
+
isLoading: y,
|
|
56
|
+
isMarkdownEnabled: s,
|
|
57
|
+
onCitationClick: h,
|
|
58
|
+
recordAction: o,
|
|
59
|
+
useAnimation: l
|
|
60
|
+
})]
|
|
61
|
+
}, v))
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
73
64
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
G as Chat,
|
|
66
|
+
G as default
|
|
76
67
|
};
|
|
@@ -1,48 +1,42 @@
|
|
|
1
1
|
import "../../../../styles/media-container.css";
|
|
2
2
|
import { Card as s } from "@box/blueprint-web";
|
|
3
|
-
import
|
|
4
|
-
import { jsx as
|
|
5
|
-
const
|
|
6
|
-
mediaContainer:
|
|
7
|
-
question:
|
|
8
|
-
body:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, p = ({
|
|
16
|
-
children: a,
|
|
3
|
+
import o from "clsx";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
const d = "_mediaContainer_1x69w_1", _ = "_question_1x69w_7", c = "_body_1x69w_10", m = "_error_1x69w_17", u = "_figure_1x69w_30", r = {
|
|
6
|
+
mediaContainer: d,
|
|
7
|
+
question: _,
|
|
8
|
+
body: c,
|
|
9
|
+
error: m,
|
|
10
|
+
figure: u,
|
|
11
|
+
"center-aligned": "_center-aligned_1x69w_37",
|
|
12
|
+
"top-aligned": "_top-aligned_1x69w_41"
|
|
13
|
+
}, g = ({
|
|
14
|
+
children: e,
|
|
17
15
|
className: t
|
|
18
|
-
}) => /* @__PURE__ */
|
|
19
|
-
className:
|
|
16
|
+
}) => /* @__PURE__ */ n("div", {
|
|
17
|
+
className: o(r.mediaContainer, r[t]),
|
|
20
18
|
"data-testid": "content-answers-grid-card",
|
|
21
|
-
children:
|
|
22
|
-
}), i =
|
|
19
|
+
children: e
|
|
20
|
+
}), i = g;
|
|
23
21
|
i.Figure = ({
|
|
24
|
-
children:
|
|
22
|
+
children: e,
|
|
25
23
|
variant: t
|
|
26
|
-
}) => /* @__PURE__ */
|
|
27
|
-
className:
|
|
28
|
-
children:
|
|
24
|
+
}) => /* @__PURE__ */ n("div", {
|
|
25
|
+
className: o(r.figure, r[t]),
|
|
26
|
+
children: e
|
|
29
27
|
});
|
|
30
28
|
i.Content = ({
|
|
31
|
-
children:
|
|
29
|
+
children: e,
|
|
32
30
|
variant: t,
|
|
33
|
-
shouldAddCard:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
[e.animated]: o
|
|
40
|
-
}),
|
|
41
|
-
children: a
|
|
42
|
-
}) : a
|
|
31
|
+
shouldAddCard: a = !0
|
|
32
|
+
}) => /* @__PURE__ */ n("div", {
|
|
33
|
+
className: o(r.body, r[t]),
|
|
34
|
+
children: a ? /* @__PURE__ */ n(s, {
|
|
35
|
+
children: e
|
|
36
|
+
}) : e
|
|
43
37
|
});
|
|
44
38
|
export {
|
|
45
39
|
i as MediaContainer,
|
|
46
|
-
|
|
40
|
+
g as MediaContainerBase,
|
|
47
41
|
i as default
|
|
48
42
|
};
|
|
@@ -1,94 +1,110 @@
|
|
|
1
1
|
import "../../../../styles/content.css";
|
|
2
|
-
import { LoadingIndicator as
|
|
3
|
-
import
|
|
2
|
+
import { LoadingIndicator as M } from "@box/blueprint-web";
|
|
3
|
+
import j from "clsx";
|
|
4
4
|
import * as t from "react";
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import
|
|
7
|
-
import { Chat as
|
|
8
|
-
import { ModalError as
|
|
5
|
+
import { useIntl as k } from "react-intl";
|
|
6
|
+
import y from "../../messages.js";
|
|
7
|
+
import { Chat as H } from "../chat/chat.js";
|
|
8
|
+
import { ModalError as O } from "../modal-error/modal-error.js";
|
|
9
9
|
import { jsx as e, jsxs as T, Fragment as V } from "react/jsx-runtime";
|
|
10
|
-
const
|
|
11
|
-
loadingIndicatorWrapper:
|
|
12
|
-
content:
|
|
13
|
-
isLoading:
|
|
14
|
-
messagesEnd:
|
|
15
|
-
},
|
|
16
|
-
error:
|
|
17
|
-
hasRequestInProgress:
|
|
18
|
-
isErrorMessageShown:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const B = "_loadingIndicatorWrapper_12a8t_1", F = "_content_12a8t_5", S = "_isLoading_12a8t_12", A = "_messagesEnd_12a8t_16", a = {
|
|
11
|
+
loadingIndicatorWrapper: B,
|
|
12
|
+
content: F,
|
|
13
|
+
isLoading: S,
|
|
14
|
+
messagesEnd: A
|
|
15
|
+
}, Z = ({
|
|
16
|
+
error: p,
|
|
17
|
+
hasRequestInProgress: c = !1,
|
|
18
|
+
isErrorMessageShown: g = !1,
|
|
19
|
+
isStreamingEnabled: l = !1,
|
|
20
|
+
setIsErrorMessageShown: _,
|
|
21
|
+
onModalClose: h,
|
|
22
|
+
questions: v,
|
|
23
|
+
recordAction: u,
|
|
24
|
+
showLoadingIndicator: m = !1,
|
|
24
25
|
userInfo: E,
|
|
25
|
-
suggestedQuestions:
|
|
26
|
-
askSuggestedQuestion:
|
|
27
|
-
setAskSuggestedQuestion:
|
|
28
|
-
useAnimation:
|
|
26
|
+
suggestedQuestions: R,
|
|
27
|
+
askSuggestedQuestion: b,
|
|
28
|
+
setAskSuggestedQuestion: C,
|
|
29
|
+
useAnimation: I,
|
|
29
30
|
...L
|
|
30
31
|
}) => {
|
|
31
|
-
const
|
|
32
|
-
formatMessage:
|
|
33
|
-
} =
|
|
34
|
-
|
|
35
|
-
behavior:
|
|
32
|
+
const d = t.useRef(null), i = t.useRef(null), f = t.useRef(null), s = t.useRef(!0), {
|
|
33
|
+
formatMessage: w
|
|
34
|
+
} = k(), r = t.useCallback((n) => {
|
|
35
|
+
f.current && f.current.scrollIntoView && i.current && (!l || s.current) && f.current.scrollIntoView({
|
|
36
|
+
behavior: n,
|
|
36
37
|
block: "nearest"
|
|
37
38
|
});
|
|
38
|
-
}, []),
|
|
39
|
-
if (
|
|
39
|
+
}, [l]), x = () => {
|
|
40
|
+
if (i.current) {
|
|
40
41
|
const {
|
|
41
|
-
scrollTop:
|
|
42
|
-
clientHeight:
|
|
42
|
+
scrollTop: n,
|
|
43
|
+
clientHeight: o,
|
|
43
44
|
scrollHeight: W
|
|
44
|
-
} =
|
|
45
|
-
|
|
45
|
+
} = i.current, z = W - (n + o);
|
|
46
|
+
if (c && z > 100) {
|
|
47
|
+
s.current = !1;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
s.current = !0;
|
|
46
51
|
}
|
|
47
52
|
};
|
|
48
53
|
t.useEffect(() => {
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
|
|
52
|
-
}, [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
c && (s.current = !0, r("instant"));
|
|
55
|
+
}, [r, c]), t.useEffect(() => {
|
|
56
|
+
s.current = !0, r("instant");
|
|
57
|
+
}, [r]), t.useLayoutEffect(() => {
|
|
58
|
+
if (!d.current)
|
|
59
|
+
return;
|
|
60
|
+
const n = new ResizeObserver(() => {
|
|
61
|
+
r(l ? "instant" : "smooth");
|
|
62
|
+
}), o = d.current;
|
|
63
|
+
return o && n.observe(o), () => {
|
|
64
|
+
o && n.unobserve(o);
|
|
65
|
+
};
|
|
66
|
+
}, [r, l]);
|
|
67
|
+
const N = () => g ? /* @__PURE__ */ e(O, {
|
|
68
|
+
clearError: () => _(!1),
|
|
69
|
+
error: p,
|
|
70
|
+
onModalClose: h,
|
|
71
|
+
recordAction: u
|
|
72
|
+
}) : m ? /* @__PURE__ */ e("div", {
|
|
73
|
+
className: a.loadingIndicatorWrapper,
|
|
74
|
+
children: /* @__PURE__ */ e(M, {
|
|
75
|
+
"aria-label": w(y.loading),
|
|
76
|
+
className: a.loadingIndicator,
|
|
63
77
|
"data-testid": "content-answers-modal-loading-indicator",
|
|
64
78
|
size: "large"
|
|
65
79
|
})
|
|
66
80
|
}) : /* @__PURE__ */ T(V, {
|
|
67
|
-
children: [/* @__PURE__ */ e(
|
|
68
|
-
askSuggestedQuestion:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
useAnimation: C,
|
|
81
|
+
children: [/* @__PURE__ */ e(H, {
|
|
82
|
+
askSuggestedQuestion: b,
|
|
83
|
+
hasRequestInProgress: c,
|
|
84
|
+
questions: v,
|
|
85
|
+
recordAction: u,
|
|
86
|
+
setAskSuggestedQuestion: C,
|
|
87
|
+
suggestedQuestions: R,
|
|
88
|
+
useAnimation: I,
|
|
76
89
|
userInfo: E,
|
|
77
90
|
...L
|
|
78
91
|
}), /* @__PURE__ */ e("div", {
|
|
79
|
-
ref:
|
|
80
|
-
className:
|
|
92
|
+
ref: f,
|
|
93
|
+
className: a.messagesEnd
|
|
81
94
|
})]
|
|
82
95
|
});
|
|
83
96
|
return /* @__PURE__ */ e("div", {
|
|
84
|
-
ref:
|
|
85
|
-
className:
|
|
97
|
+
ref: i,
|
|
98
|
+
className: j(a.content, m ? a.isLoading : null),
|
|
86
99
|
"data-testid": "content-answers-content",
|
|
87
|
-
onScroll:
|
|
88
|
-
children:
|
|
100
|
+
onScroll: x,
|
|
101
|
+
children: /* @__PURE__ */ e("div", {
|
|
102
|
+
ref: d,
|
|
103
|
+
children: N()
|
|
104
|
+
})
|
|
89
105
|
});
|
|
90
106
|
};
|
|
91
107
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
Z as Content,
|
|
109
|
+
Z as default
|
|
94
110
|
};
|
|
@@ -1,41 +1,39 @@
|
|
|
1
1
|
import "../../../../styles/question.css";
|
|
2
|
-
import { useBreakpoint as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import
|
|
2
|
+
import { useBreakpoint as m, Avatar as c, Breakpoint as d, Text as u } from "@box/blueprint-web";
|
|
3
|
+
import { useIntl as p } from "react-intl";
|
|
4
|
+
import x from "../../messages.js";
|
|
5
5
|
import { MediaContainer as e } from "../common/media-container.js";
|
|
6
|
-
import { jsx as t, jsxs as
|
|
7
|
-
const
|
|
8
|
-
question:
|
|
9
|
-
text:
|
|
10
|
-
},
|
|
6
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
7
|
+
const f = "_question_1menh_1", v = "_text_1menh_5", s = {
|
|
8
|
+
question: f,
|
|
9
|
+
text: v
|
|
10
|
+
}, N = ({
|
|
11
11
|
prompt: a,
|
|
12
|
-
userInfo: o
|
|
13
|
-
useAnimation: n
|
|
12
|
+
userInfo: o
|
|
14
13
|
}) => {
|
|
15
14
|
const {
|
|
16
|
-
avatarURL:
|
|
17
|
-
name:
|
|
18
|
-
} = o,
|
|
19
|
-
formatMessage:
|
|
20
|
-
} =
|
|
15
|
+
avatarURL: n,
|
|
16
|
+
name: r
|
|
17
|
+
} = o, i = m(), {
|
|
18
|
+
formatMessage: l
|
|
19
|
+
} = p();
|
|
21
20
|
return /* @__PURE__ */ t("div", {
|
|
22
21
|
className: s.question,
|
|
23
22
|
"data-testid": "content-answers-question",
|
|
24
|
-
children: /* @__PURE__ */
|
|
23
|
+
children: /* @__PURE__ */ h(e, {
|
|
25
24
|
className: "question",
|
|
26
25
|
children: [/* @__PURE__ */ t(e.Figure, {
|
|
27
26
|
variant: "top-aligned",
|
|
28
|
-
children: /* @__PURE__ */ t(
|
|
29
|
-
alt:
|
|
27
|
+
children: /* @__PURE__ */ t(c, {
|
|
28
|
+
alt: l(x.userAvatar),
|
|
30
29
|
colorIndex: 0,
|
|
31
|
-
size:
|
|
32
|
-
src:
|
|
33
|
-
text:
|
|
30
|
+
size: i === d.Small ? "small" : "large",
|
|
31
|
+
src: n || void 0,
|
|
32
|
+
text: r.charAt(0)
|
|
34
33
|
})
|
|
35
34
|
}), /* @__PURE__ */ t(e.Content, {
|
|
36
35
|
shouldAddCard: !1,
|
|
37
|
-
|
|
38
|
-
children: /* @__PURE__ */ t(p, {
|
|
36
|
+
children: /* @__PURE__ */ t(u, {
|
|
39
37
|
as: "span",
|
|
40
38
|
className: s.text,
|
|
41
39
|
children: a
|
|
@@ -45,6 +43,6 @@ const v = "_question_1menh_1", q = "_text_1menh_5", s = {
|
|
|
45
43
|
});
|
|
46
44
|
};
|
|
47
45
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
N as Question,
|
|
47
|
+
N as default
|
|
50
48
|
};
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
import "../../../../styles/welcome-message.css";
|
|
2
|
-
import { InlineNotice as
|
|
3
|
-
import { BoxAi as
|
|
2
|
+
import { InlineNotice as p, Text as a } from "@box/blueprint-web";
|
|
3
|
+
import { BoxAi as g } from "@box/blueprint-web-assets/icons/Line";
|
|
4
4
|
import { Size6 as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import { useIntl as
|
|
5
|
+
import { useIntl as w } from "react-intl";
|
|
6
6
|
import { MediaContainer as n } from "../common/media-container.js";
|
|
7
7
|
import i from "./messages.js";
|
|
8
8
|
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
10
|
-
welcomeMessage:
|
|
11
|
-
askQuestionText:
|
|
12
|
-
clearChatText:
|
|
13
|
-
warningNotice:
|
|
14
|
-
iconAvatar:
|
|
15
|
-
},
|
|
9
|
+
const f = "_welcomeMessage_1px1f_1", _ = "_askQuestionText_1px1f_4", T = "_clearChatText_1px1f_8", u = "_warningNotice_1px1f_12", v = "_iconAvatar_1px1f_15", t = {
|
|
10
|
+
welcomeMessage: f,
|
|
11
|
+
askQuestionText: _,
|
|
12
|
+
clearChatText: T,
|
|
13
|
+
warningNotice: u,
|
|
14
|
+
iconAvatar: v
|
|
15
|
+
}, I = ({
|
|
16
16
|
contentName: l,
|
|
17
17
|
contentType: m,
|
|
18
18
|
warningNotice: r,
|
|
19
19
|
warningNoticeAriaLabel: d,
|
|
20
|
-
welcomeMessageClearText: h
|
|
21
|
-
useAnimation: x
|
|
20
|
+
welcomeMessageClearText: h
|
|
22
21
|
}) => {
|
|
23
22
|
const {
|
|
24
23
|
formatMessage: s
|
|
25
|
-
} =
|
|
24
|
+
} = w(), x = r && /* @__PURE__ */ e(p, {
|
|
26
25
|
className: t.warningNotice,
|
|
27
26
|
"data-testid": "content-answers-warning-notice",
|
|
28
27
|
variant: "warning",
|
|
@@ -40,15 +39,14 @@ const _ = "_welcomeMessage_1px1f_1", T = "_askQuestionText_1px1f_4", u = "_clear
|
|
|
40
39
|
children: [/* @__PURE__ */ e(n.Figure, {
|
|
41
40
|
children: /* @__PURE__ */ e("div", {
|
|
42
41
|
className: t.iconAvatar,
|
|
43
|
-
children: /* @__PURE__ */ e(
|
|
42
|
+
children: /* @__PURE__ */ e(g, {
|
|
44
43
|
height: c,
|
|
45
44
|
role: "presentation",
|
|
46
45
|
width: c
|
|
47
46
|
})
|
|
48
47
|
})
|
|
49
48
|
}), /* @__PURE__ */ o(n.Content, {
|
|
50
|
-
|
|
51
|
-
children: [p, /* @__PURE__ */ e(a, {
|
|
49
|
+
children: [x, /* @__PURE__ */ e(a, {
|
|
52
50
|
as: "h1",
|
|
53
51
|
className: t.title,
|
|
54
52
|
variant: "titleSmall",
|
|
@@ -73,6 +71,6 @@ const _ = "_welcomeMessage_1px1f_1", T = "_askQuestionText_1px1f_4", u = "_clear
|
|
|
73
71
|
});
|
|
74
72
|
};
|
|
75
73
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
I as WelcomeMessage,
|
|
75
|
+
I as default
|
|
78
76
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"remarkable": "^2.0.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@box/blueprint-web": "^7.
|
|
16
|
+
"@box/blueprint-web": "^7.33.0",
|
|
17
17
|
"@box/blueprint-web-assets": "^4.27.0",
|
|
18
18
|
"@box/storybook-utils": "^0.6.1",
|
|
19
19
|
"@testing-library/react": "^15.0.6",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"**/*.css"
|
|
53
53
|
],
|
|
54
54
|
"license": "SEE LICENSE IN LICENSE",
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "655a58b8accd00ab49186551834a7a0c7b9237f4"
|
|
56
56
|
}
|
package/styles/answer.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
._answer_17ojr_1{white-space:pre-wrap}._answer_17ojr_1 ._alertIcon_17ojr_4{margin-left:.5rem}._answer_17ojr_1 ._error_17ojr_7{display:flex;align-items:center}._answer_17ojr_1 ._footer_17ojr_11{display:flex;justify-content:space-between;margin-top:.75rem}._answer_17ojr_1 ._footer_17ojr_11._shouldUseAnimation_17ojr_16{max-height:0;overflow-y:hidden}._answer_17ojr_1 ._footer_17ojr_11._shouldUseAnimation_17ojr_16._shouldAnimateHeight_17ojr_20{max-height:200px;transition:max-height 1s ease-in}._answer_17ojr_1 ._iconAvatar_17ojr_24{display:flex;align-items:center;justify-content:center;width:var(--size-8);height:var(--size-8);border-radius:50%}@media (max-width: 374px){._answer_17ojr_1 ._iconAvatar_17ojr_24{width:var(--size-6);height:var(--size-6)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
._mediaContainer_1x69w_1{margin-top:1rem;margin-bottom:1.5rem;align-items:flex-start;display:flex}._mediaContainer_1x69w_1._question_1x69w_7{align-items:center}._mediaContainer_1x69w_1 ._body_1x69w_10{word-wrap:break-word;flex:1 1 100%;min-width:0;overflow-wrap:break-word;word-break:break-word}._mediaContainer_1x69w_1 ._body_1x69w_10._error_1x69w_17{display:flex;align-items:center;padding:.75rem 1rem;background-color:#fdebee;border:.125rem solid #f69bab;border-radius:.75rem}@media (max-width: 767px){._mediaContainer_1x69w_1 ._body_1x69w_10._error_1x69w_17{flex-wrap:wrap}}._mediaContainer_1x69w_1 ._figure_1x69w_30{align-self:flex-start;flex:0 0 auto;justify-self:flex-start;margin:.75rem .75rem 0 0;padding:0}._mediaContainer_1x69w_1 ._figure_1x69w_30._center-aligned_1x69w_37{align-self:center;margin:0 .75rem 0 0}._mediaContainer_1x69w_1 ._figure_1x69w_30._top-aligned_1x69w_41{align-self:top;margin:0 .75rem 0 0}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ANSWER_ERROR, type CitationResponseRecordType, type CitationType, type
|
|
2
|
+
import { ANSWER_ERROR, type CitationResponseRecordType, type CitationType, type RecordActionType } from '../../types';
|
|
3
3
|
export interface AnswerProps {
|
|
4
4
|
answer?: string;
|
|
5
5
|
/** Citations list */
|
|
@@ -8,8 +8,6 @@ export interface AnswerProps {
|
|
|
8
8
|
error?: ANSWER_ERROR;
|
|
9
9
|
/** Content name used in some of the error messages */
|
|
10
10
|
contentType: string;
|
|
11
|
-
/** Callback function to handle the scroll bottom when an answer is updated */
|
|
12
|
-
handleScrollToBottom?: HandleScrollToBottomType;
|
|
13
11
|
/** Whether if the answer supports citations or not */
|
|
14
12
|
isCitationsEnabled?: boolean;
|
|
15
13
|
/** Whether if the answer finished loading (used to show the references and the copy button) */
|
|
@@ -18,8 +16,6 @@ export interface AnswerProps {
|
|
|
18
16
|
isLoading?: boolean;
|
|
19
17
|
/** Whether the answer supports markdown */
|
|
20
18
|
isMarkdownEnabled?: boolean;
|
|
21
|
-
/** Whether if the client supports streaming or not */
|
|
22
|
-
isStreamingEnabled?: boolean;
|
|
23
19
|
/** Callback function when citation button is clicked */
|
|
24
20
|
onCitationClick?: (fileId: CitationResponseRecordType, title: CitationResponseRecordType) => void;
|
|
25
21
|
/** Callback function to handle logging events */
|
|
@@ -3,7 +3,6 @@ export type InlineErrorProps = {
|
|
|
3
3
|
error: string | null;
|
|
4
4
|
contentType: string;
|
|
5
5
|
recordAction?: (params: RecordActionType) => void;
|
|
6
|
-
useAnimation?: boolean;
|
|
7
6
|
};
|
|
8
|
-
export declare const InlineError: ({ error, contentType, recordAction
|
|
7
|
+
export declare const InlineError: ({ error, contentType, recordAction }: InlineErrorProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export default InlineError;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
useAnimation?: boolean;
|
|
3
|
-
}
|
|
4
|
-
export declare const LoadingElement: ({ useAnimation }: LoadingElementProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const LoadingElement: () => import("react/jsx-runtime").JSX.Element;
|
|
5
2
|
export default LoadingElement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ChatProps } from '../../types';
|
|
2
|
-
export declare const Chat: ({ askSuggestedQuestion,
|
|
2
|
+
export declare const Chat: ({ askSuggestedQuestion, hasRequestInProgress, isCitationsEnabled, isMarkdownEnabled, onCitationClick, questions, recordAction, setAskSuggestedQuestion, suggestedQuestions, suggestedQuestionsRequestState, useAnimation, userInfo, ...welcomeMessageProps }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Chat;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ContentProps } from '../../types';
|
|
2
|
-
export declare const Content: ({ error, hasRequestInProgress, isErrorMessageShown, setIsErrorMessageShown, onModalClose, questions, recordAction, showLoadingIndicator, userInfo, suggestedQuestions, askSuggestedQuestion, setAskSuggestedQuestion, useAnimation, ...rest }: ContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Content: ({ error, hasRequestInProgress, isErrorMessageShown, isStreamingEnabled, setIsErrorMessageShown, onModalClose, questions, recordAction, showLoadingIndicator, userInfo, suggestedQuestions, askSuggestedQuestion, setAskSuggestedQuestion, useAnimation, ...rest }: ContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export { type ContentProps };
|
|
4
4
|
export default Content;
|
|
@@ -4,8 +4,6 @@ export interface QuestionProps {
|
|
|
4
4
|
prompt?: string;
|
|
5
5
|
/** User information consisting on their name and an optional avatar */
|
|
6
6
|
userInfo: UserInfoType;
|
|
7
|
-
/** If keyframe animation should be applied to chat elements; defaults to true */
|
|
8
|
-
useAnimation?: boolean;
|
|
9
7
|
}
|
|
10
|
-
export declare const Question: ({ prompt, userInfo
|
|
8
|
+
export declare const Question: ({ prompt, userInfo }: QuestionProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
9
|
export default Question;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type WelcomeMessageProps } from '../../types';
|
|
2
|
-
export declare const WelcomeMessage: ({ contentName, contentType, warningNotice, warningNoticeAriaLabel, welcomeMessageClearText,
|
|
2
|
+
export declare const WelcomeMessage: ({ contentName, contentType, warningNotice, warningNoticeAriaLabel, welcomeMessageClearText, }: WelcomeMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default WelcomeMessage;
|
package/types/lib/types.d.ts
CHANGED
|
@@ -47,8 +47,6 @@ export type ChatProps = WelcomeMessageProps & {
|
|
|
47
47
|
isDebugModeEnabled?: boolean;
|
|
48
48
|
/** Whether if the client supports streaming or not */
|
|
49
49
|
isStreamingEnabled?: boolean;
|
|
50
|
-
/** Callback function to handle the scroll bottom when an answer is updated */
|
|
51
|
-
handleScrollToBottom: HandleScrollToBottomType;
|
|
52
50
|
/** Question list */
|
|
53
51
|
questions: QuestionType[];
|
|
54
52
|
/** Callback function to handle logging events */
|