@box/box-ai-content-answers 1.6.1 → 1.7.1
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/box-ai-content-answers.js +46 -42
- package/dist/esm/lib/components/footer/footer.js +124 -120
- package/dist/esm/lib/components/modal/modal.js +57 -53
- package/dist/esm/lib/components/sidebar/content.js +124 -120
- package/dist/types/lib/box-ai-content-answers.d.ts +4 -0
- package/dist/types/lib/components/footer/footer.d.ts +5 -1
- package/dist/types/lib/components/modal/modal.d.ts +7 -0
- package/package.json +4 -4
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import p from "clsx";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { C as
|
|
4
|
-
import { jsx as u, jsxs as
|
|
5
|
-
import { Content as
|
|
6
|
-
import { Footer as
|
|
7
|
-
import '../../styles/box-ai-content-answers.css';const
|
|
8
|
-
container:
|
|
9
|
-
contentAnswers:
|
|
10
|
-
sidebar:
|
|
11
|
-
},
|
|
3
|
+
import { C as W } from "../../chunks/types.js";
|
|
4
|
+
import { jsx as u, jsxs as X } from "react/jsx-runtime";
|
|
5
|
+
import { Content as Y } from "./components/content/content.js";
|
|
6
|
+
import { Footer as Z } from "./components/footer/footer.js";
|
|
7
|
+
import '../../styles/box-ai-content-answers.css';const $ = "_container_1p5tb_1", v = "_contentAnswers_1p5tb_8", P = "_sidebar_1p5tb_19", a = {
|
|
8
|
+
container: $,
|
|
9
|
+
contentAnswers: v,
|
|
10
|
+
sidebar: P
|
|
11
|
+
}, oe = ({
|
|
12
12
|
className: _,
|
|
13
13
|
contentType: h,
|
|
14
14
|
contentName: Q,
|
|
@@ -19,61 +19,63 @@ import '../../styles/box-ai-content-answers.css';const Y = "_container_1p5tb_1",
|
|
|
19
19
|
isDebugModeEnabled: E,
|
|
20
20
|
isStopResponseEnabled: M,
|
|
21
21
|
isStreamingEnabled: n,
|
|
22
|
+
promptValue: R,
|
|
22
23
|
questions: i,
|
|
23
24
|
recordAction: l,
|
|
24
|
-
retryQuestion:
|
|
25
|
+
retryQuestion: x,
|
|
26
|
+
setPromptValue: C,
|
|
25
27
|
showLoadingIndicator: g,
|
|
26
|
-
stopQuestion:
|
|
27
|
-
submitQuestion:
|
|
28
|
-
suggestedQuestions:
|
|
29
|
-
useAnimation:
|
|
30
|
-
onAgentEditorToggle:
|
|
28
|
+
stopQuestion: F,
|
|
29
|
+
submitQuestion: D,
|
|
30
|
+
suggestedQuestions: N,
|
|
31
|
+
useAnimation: k,
|
|
32
|
+
onAgentEditorToggle: T,
|
|
31
33
|
onUserIntentToUseAI: e,
|
|
32
|
-
promptButtonClickHandler:
|
|
34
|
+
promptButtonClickHandler: j,
|
|
33
35
|
variant: o = "modal",
|
|
34
|
-
hostAppName:
|
|
35
|
-
isReactMarkdownEnabled:
|
|
36
|
-
...
|
|
36
|
+
hostAppName: y,
|
|
37
|
+
isReactMarkdownEnabled: O,
|
|
38
|
+
...z
|
|
37
39
|
}) => {
|
|
38
|
-
const [f, m] = s.useState(null), [S,
|
|
40
|
+
const [f, m] = s.useState(null), [S, B] = s.useState(t != null), [c, G] = s.useState(!1), L = t === W.LARGE_FILE, H = (!S || L) && !g, b = (r) => {
|
|
39
41
|
l && l({
|
|
40
42
|
...r,
|
|
41
43
|
component: o
|
|
42
44
|
});
|
|
43
|
-
},
|
|
45
|
+
}, J = () => {
|
|
44
46
|
e && e(!1);
|
|
45
|
-
},
|
|
47
|
+
}, K = (r) => {
|
|
46
48
|
m(r), e && e(!0);
|
|
47
|
-
},
|
|
49
|
+
}, V = () => {
|
|
48
50
|
e && e(!0);
|
|
49
51
|
};
|
|
50
52
|
return s.useEffect(() => {
|
|
51
|
-
|
|
53
|
+
B(t != null);
|
|
52
54
|
}, [t]), /* @__PURE__ */ u("div", {
|
|
53
55
|
className: p(_, a.container),
|
|
54
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ X("div", {
|
|
55
57
|
className: p(a.contentAnswers, o === "sidebar" && a.sidebar),
|
|
56
|
-
children: [!c && /* @__PURE__ */ u(
|
|
57
|
-
...
|
|
58
|
+
children: [!c && /* @__PURE__ */ u(Y, {
|
|
59
|
+
...z,
|
|
58
60
|
askSuggestedQuestion: f,
|
|
59
61
|
contentName: Q,
|
|
60
62
|
contentType: h,
|
|
61
63
|
error: t,
|
|
62
64
|
hasCustomSuggestedQuestions: w,
|
|
63
65
|
hasRequestInProgress: d,
|
|
64
|
-
hostAppName:
|
|
66
|
+
hostAppName: y,
|
|
65
67
|
isErrorMessageShown: S,
|
|
66
|
-
isReactMarkdownEnabled:
|
|
68
|
+
isReactMarkdownEnabled: O,
|
|
67
69
|
isStreamingEnabled: n,
|
|
68
|
-
onSuggestedQuestionInteraction:
|
|
70
|
+
onSuggestedQuestionInteraction: J,
|
|
69
71
|
questions: i,
|
|
70
72
|
recordAction: b,
|
|
71
|
-
setAskSuggestedQuestion:
|
|
73
|
+
setAskSuggestedQuestion: K,
|
|
72
74
|
showLoadingIndicator: g,
|
|
73
|
-
suggestedQuestions:
|
|
74
|
-
useAnimation: n &&
|
|
75
|
+
suggestedQuestions: N,
|
|
76
|
+
useAnimation: n && k,
|
|
75
77
|
variant: o
|
|
76
|
-
}),
|
|
78
|
+
}), H && /* @__PURE__ */ u(Z, {
|
|
77
79
|
askSuggestedQuestion: f,
|
|
78
80
|
enableDebugMode: E,
|
|
79
81
|
hasRequestInProgress: d,
|
|
@@ -82,15 +84,17 @@ import '../../styles/box-ai-content-answers.css';const Y = "_container_1p5tb_1",
|
|
|
82
84
|
isStopResponseEnabled: M,
|
|
83
85
|
isStreamingEnabled: n,
|
|
84
86
|
lastQuestion: i[i.length - 1],
|
|
85
|
-
onRetryQuestion:
|
|
86
|
-
onStopQuestion:
|
|
87
|
-
onUserInteraction:
|
|
88
|
-
promptButtonClickHandler:
|
|
87
|
+
onRetryQuestion: x,
|
|
88
|
+
onStopQuestion: F,
|
|
89
|
+
onUserInteraction: V,
|
|
90
|
+
promptButtonClickHandler: j,
|
|
91
|
+
promptValue: R,
|
|
89
92
|
recordAction: b,
|
|
90
|
-
sendQuestion:
|
|
93
|
+
sendQuestion: D,
|
|
91
94
|
setAskSuggestedQuestion: m,
|
|
95
|
+
setPromptValue: C,
|
|
92
96
|
toggleDebugMode: () => {
|
|
93
|
-
|
|
97
|
+
G(!c);
|
|
94
98
|
},
|
|
95
99
|
variant: o
|
|
96
100
|
})]
|
|
@@ -98,6 +102,6 @@ import '../../styles/box-ai-content-answers.css';const Y = "_container_1p5tb_1",
|
|
|
98
102
|
});
|
|
99
103
|
};
|
|
100
104
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
oe as BoxAiContentAnswers,
|
|
106
|
+
oe as default
|
|
103
107
|
};
|
|
@@ -1,162 +1,166 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import tt from "clsx";
|
|
2
|
+
import at from "lodash/noop";
|
|
3
3
|
import * as r from "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useBreakpoint as
|
|
6
|
-
import { ArrowUp as
|
|
7
|
-
import { BubbleStar as
|
|
8
|
-
import { useAgents as
|
|
9
|
-
import { getAIAgentConfig as
|
|
10
|
-
import { isDebugModeTrigger as
|
|
11
|
-
import { TEXT_AREA as
|
|
12
|
-
import { FooterActions as
|
|
13
|
-
import { s as
|
|
14
|
-
import { U as
|
|
15
|
-
import
|
|
16
|
-
import { LOGGER_BASE_CONFIG as
|
|
17
|
-
import { jsxs as
|
|
18
|
-
const
|
|
19
|
-
askSuggestedQuestion:
|
|
20
|
-
enableDebugMode:
|
|
21
|
-
hasRequestInProgress:
|
|
22
|
-
isAIStudioAgentSelectorEnabled:
|
|
23
|
-
isDebugModeShown:
|
|
24
|
-
isStopResponseEnabled:
|
|
25
|
-
isStreamingEnabled:
|
|
26
|
-
lastQuestion:
|
|
27
|
-
onRetryQuestion:
|
|
28
|
-
onStopQuestion:
|
|
29
|
-
onUserInteraction:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
4
|
+
import { useIntl as rt } from "react-intl";
|
|
5
|
+
import { useBreakpoint as nt, Breakpoint as et, TextArea as it, FilterChip as L, Tooltip as ot, Button as st } from "@box/blueprint-web";
|
|
6
|
+
import { ArrowUp as lt } from "@box/blueprint-web-assets/icons/Fill";
|
|
7
|
+
import { BubbleStar as ct } from "@box/blueprint-web-assets/icons/Medium";
|
|
8
|
+
import { useAgents as mt } from "@box/box-ai-agent-selector";
|
|
9
|
+
import { getAIAgentConfig as H } from "../common/agentUtils.js";
|
|
10
|
+
import { isDebugModeTrigger as ft, isEnterTrigger as pt } from "../common/keyInputUtils.js";
|
|
11
|
+
import { TEXT_AREA as l, INPUT_TARGET_ID as ut } from "./constants.js";
|
|
12
|
+
import { FooterActions as dt } from "./footer-actions.js";
|
|
13
|
+
import { s as f, S as bt } from "../../../../chunks/stopResponseButton.js";
|
|
14
|
+
import { U as ht } from "../../../../chunks/types.js";
|
|
15
|
+
import c from "./messages.js";
|
|
16
|
+
import { LOGGER_BASE_CONFIG as S, LOGGER_ACTION_CLICK as Ct, LOGGER_ACTION_KEYPRESS as Et } from "../common/constants.js";
|
|
17
|
+
import { jsxs as M, jsx as m } from "react/jsx-runtime";
|
|
18
|
+
const Ht = ({
|
|
19
|
+
askSuggestedQuestion: d,
|
|
20
|
+
enableDebugMode: x = !1,
|
|
21
|
+
hasRequestInProgress: e,
|
|
22
|
+
isAIStudioAgentSelectorEnabled: E,
|
|
23
|
+
isDebugModeShown: y,
|
|
24
|
+
isStopResponseEnabled: F,
|
|
25
|
+
isStreamingEnabled: K,
|
|
26
|
+
lastQuestion: T,
|
|
27
|
+
onRetryQuestion: A,
|
|
28
|
+
onStopQuestion: U,
|
|
29
|
+
onUserInteraction: k = at,
|
|
30
|
+
promptValue: p,
|
|
31
|
+
recordAction: i,
|
|
32
|
+
sendQuestion: O,
|
|
33
|
+
setAskSuggestedQuestion: R,
|
|
34
|
+
setPromptValue: o,
|
|
35
|
+
toggleDebugMode: u,
|
|
36
|
+
promptButtonClickHandler: X,
|
|
37
|
+
variant: W = "modal"
|
|
36
38
|
}) => {
|
|
37
|
-
const
|
|
38
|
-
selectedAgent:
|
|
39
|
-
} =
|
|
40
|
-
answer:
|
|
41
|
-
isCompleted:
|
|
42
|
-
} =
|
|
39
|
+
const w = W === "sidebar", s = rt(), j = nt(), a = r.useRef(null), D = j <= et.Medium && !w ? l.MAX_ROWS_MOBILE : l.MAX_ROWS, [b, v] = r.useState(!0), [Y, B] = r.useState(!1), {
|
|
40
|
+
selectedAgent: _
|
|
41
|
+
} = mt(), {
|
|
42
|
+
answer: J,
|
|
43
|
+
isCompleted: P
|
|
44
|
+
} = T ?? {}, Z = K && P === !1 && (F || J), h = r.useCallback(() => {
|
|
43
45
|
a.current && a.current.focus();
|
|
44
|
-
}, [a]),
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
let t = ((
|
|
48
|
-
a.current && t.length >
|
|
49
|
-
}, [
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
46
|
+
}, [a]), N = r.useCallback(() => {
|
|
47
|
+
var n;
|
|
48
|
+
k();
|
|
49
|
+
let t = ((n = a.current) == null ? void 0 : n.value) ?? "";
|
|
50
|
+
a.current && t.length > l.MAX_LENGTH && (a.current.value = t.slice(0, l.MAX_LENGTH), t = a.current.value), o && o(t), B(t.length >= l.MAX_LENGTH), v(t.trim().length === 0);
|
|
51
|
+
}, [k, o]), C = r.useCallback((t = ht) => {
|
|
52
|
+
if (h(), !e && a.current) {
|
|
53
|
+
const n = {
|
|
52
54
|
prompt: a.current.value,
|
|
53
55
|
promptType: t
|
|
54
56
|
};
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
|
|
57
|
+
if (n.prompt && n.prompt.trim()) {
|
|
58
|
+
const V = H(E, _);
|
|
59
|
+
O(n, V), a.current.value = "", o && o(""), v(!0), B(!1);
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
y && u && u();
|
|
60
62
|
}
|
|
61
|
-
}, [
|
|
62
|
-
t.preventDefault(), !
|
|
63
|
-
...
|
|
64
|
-
action:
|
|
63
|
+
}, [_, h, e, E, y, O, o, u]), $ = r.useCallback((t) => {
|
|
64
|
+
t.preventDefault(), !e && !b && i && i({
|
|
65
|
+
...S,
|
|
66
|
+
action: Ct,
|
|
65
67
|
target: "ask"
|
|
66
|
-
}),
|
|
67
|
-
}, [
|
|
68
|
-
|
|
69
|
-
...
|
|
70
|
-
action:
|
|
68
|
+
}), C();
|
|
69
|
+
}, [e, b, i, C]), z = r.useCallback((t) => {
|
|
70
|
+
x && u && ft(t) && u(), pt(t) && (t.preventDefault(), !e && !b && i && i({
|
|
71
|
+
...S,
|
|
72
|
+
action: Et,
|
|
71
73
|
target: "ask"
|
|
72
|
-
}),
|
|
73
|
-
}, [
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
}, [
|
|
74
|
+
}), C());
|
|
75
|
+
}, [x, e, b, i, C, u]), q = r.useCallback((t) => {
|
|
76
|
+
const n = H(E, _);
|
|
77
|
+
A(t, n);
|
|
78
|
+
}, [_, E, A]);
|
|
77
79
|
r.useEffect(() => {
|
|
78
|
-
queueMicrotask(
|
|
80
|
+
queueMicrotask(h);
|
|
79
81
|
}, []), r.useEffect(() => {
|
|
80
|
-
|
|
82
|
+
a.current && p !== void 0 && a.current.value !== p && (a.current.value = p, v(p.trim().length === 0), B(p.length >= l.MAX_LENGTH));
|
|
83
|
+
}, [p]), r.useEffect(() => {
|
|
84
|
+
if (d && a.current && !e && R) {
|
|
81
85
|
const {
|
|
82
86
|
prompt: t,
|
|
83
|
-
type:
|
|
84
|
-
} =
|
|
85
|
-
a.current.value = t,
|
|
87
|
+
type: n
|
|
88
|
+
} = d;
|
|
89
|
+
a.current.value = t, o && o(t), C(n), R(null);
|
|
86
90
|
}
|
|
87
|
-
}, [
|
|
88
|
-
const
|
|
89
|
-
a.current && (a.current.value = t,
|
|
90
|
-
}, [
|
|
91
|
+
}, [d == null ? void 0 : d.id]);
|
|
92
|
+
const g = r.useCallback((t) => {
|
|
93
|
+
a.current && (a.current.value = t, N(), h());
|
|
94
|
+
}, [N, h]), G = !!X, Q = () => /* @__PURE__ */ m(L.Group, {
|
|
91
95
|
name: "prompt-library",
|
|
92
96
|
type: "single",
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
-
"aria-label":
|
|
95
|
-
className:
|
|
97
|
+
children: /* @__PURE__ */ M(L.ChipButton, {
|
|
98
|
+
"aria-label": s.formatMessage(c.openPromptLibraryBtn),
|
|
99
|
+
className: f.promptButton,
|
|
96
100
|
"data-target-id": "open-prompt-library-button",
|
|
97
101
|
"data-testid": "open-prompt-library-button",
|
|
98
102
|
onClick: () => {
|
|
99
|
-
|
|
103
|
+
X(g);
|
|
100
104
|
},
|
|
101
105
|
value: "add-prompt",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
103
|
-
icon:
|
|
104
|
-
}), /* @__PURE__ */
|
|
105
|
-
children:
|
|
106
|
+
children: [/* @__PURE__ */ m(L.Icon, {
|
|
107
|
+
icon: ct
|
|
108
|
+
}), /* @__PURE__ */ m(L.Label, {
|
|
109
|
+
children: s.formatMessage(c.promptsBtn)
|
|
106
110
|
})]
|
|
107
111
|
})
|
|
108
|
-
}),
|
|
109
|
-
lastQuestion:
|
|
110
|
-
onStopQuestion:
|
|
111
|
-
recordAction:
|
|
112
|
+
}), I = (t) => Z ? /* @__PURE__ */ m(bt, {
|
|
113
|
+
lastQuestion: T,
|
|
114
|
+
onStopQuestion: U,
|
|
115
|
+
recordAction: i,
|
|
112
116
|
size: t
|
|
113
|
-
}) : /* @__PURE__ */
|
|
114
|
-
content:
|
|
117
|
+
}) : /* @__PURE__ */ m(ot, {
|
|
118
|
+
content: s.formatMessage(c.ask),
|
|
115
119
|
"data-testid": "ask-tooltip",
|
|
116
120
|
variant: "standard",
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
-
"aria-label":
|
|
119
|
-
className:
|
|
121
|
+
children: /* @__PURE__ */ m(st, {
|
|
122
|
+
"aria-label": s.formatMessage(c.ask),
|
|
123
|
+
className: f.inputAreaButton,
|
|
120
124
|
"data-testid": "content-answers-submit-button",
|
|
121
|
-
disabled:
|
|
122
|
-
icon:
|
|
125
|
+
disabled: b || e,
|
|
126
|
+
icon: lt,
|
|
123
127
|
loading: !1,
|
|
124
|
-
loadingAriaLabel:
|
|
125
|
-
onClick:
|
|
128
|
+
loadingAriaLabel: s.formatMessage(c.askDisabledTooltip),
|
|
129
|
+
onClick: $,
|
|
126
130
|
size: t,
|
|
127
131
|
"data-target-id": "Button-ask"
|
|
128
132
|
})
|
|
129
133
|
});
|
|
130
|
-
return /* @__PURE__ */
|
|
131
|
-
children: [
|
|
132
|
-
lastQuestion:
|
|
133
|
-
onRetryButtonInteraction:
|
|
134
|
-
onRetryQuestion:
|
|
135
|
-
recordAction:
|
|
136
|
-
}), /* @__PURE__ */
|
|
137
|
-
className:
|
|
138
|
-
children: [/* @__PURE__ */
|
|
134
|
+
return /* @__PURE__ */ M("div", {
|
|
135
|
+
children: [T && /* @__PURE__ */ m(dt, {
|
|
136
|
+
lastQuestion: T,
|
|
137
|
+
onRetryButtonInteraction: k,
|
|
138
|
+
onRetryQuestion: q,
|
|
139
|
+
recordAction: i
|
|
140
|
+
}), /* @__PURE__ */ M("div", {
|
|
141
|
+
className: tt(f.questionInput, w && f.sidebar, !G && f.questionInputWithOutPromptLibrary),
|
|
142
|
+
children: [/* @__PURE__ */ m(it, {
|
|
139
143
|
ref: a,
|
|
140
|
-
className:
|
|
141
|
-
"data-target-id":
|
|
144
|
+
className: f.textArea,
|
|
145
|
+
"data-target-id": ut,
|
|
142
146
|
"data-testid": "content-answers-question-input",
|
|
143
|
-
error:
|
|
144
|
-
characterLimit:
|
|
147
|
+
error: Y && s.formatMessage(c.maxCharactersReachedError, {
|
|
148
|
+
characterLimit: l.MAX_LENGTH
|
|
145
149
|
}),
|
|
146
150
|
hideLabel: !0,
|
|
147
|
-
label:
|
|
148
|
-
maxLength:
|
|
149
|
-
maxRows:
|
|
150
|
-
onChange:
|
|
151
|
-
onKeyDown:
|
|
152
|
-
placeholder:
|
|
153
|
-
}),
|
|
154
|
-
className:
|
|
155
|
-
children: [
|
|
156
|
-
}), !
|
|
151
|
+
label: s.formatMessage(c.askQuestionPlaceholder),
|
|
152
|
+
maxLength: l.MAX_LENGTH,
|
|
153
|
+
maxRows: D,
|
|
154
|
+
onChange: N,
|
|
155
|
+
onKeyDown: z,
|
|
156
|
+
placeholder: s.formatMessage(c.askQuestionPlaceholder)
|
|
157
|
+
}), G && /* @__PURE__ */ M("div", {
|
|
158
|
+
className: f.actionContainer,
|
|
159
|
+
children: [Q(), I("small")]
|
|
160
|
+
}), !G && I("large")]
|
|
157
161
|
})]
|
|
158
162
|
});
|
|
159
163
|
};
|
|
160
164
|
export {
|
|
161
|
-
|
|
165
|
+
Ht as Footer
|
|
162
166
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useBreakpoint as
|
|
2
|
-
import { ArrowsCollapse as
|
|
3
|
-
import { BoxAiLogo as
|
|
1
|
+
import { useBreakpoint as Y, Breakpoint as Z, Modal as c, TooltipProvider as $, Tooltip as ee } from "@box/blueprint-web";
|
|
2
|
+
import { ArrowsCollapse as oe } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { BoxAiLogo as te } from "@box/blueprint-web-assets/icons/Logo";
|
|
4
4
|
import { Size8 as w } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import { BoxAiAgentSelectorWithApi as
|
|
6
|
-
import { useState as
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import { BoxAiContentAnswers as
|
|
9
|
-
import { A as
|
|
10
|
-
import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as
|
|
11
|
-
import { s, C as
|
|
12
|
-
import
|
|
13
|
-
import { Title as
|
|
5
|
+
import { BoxAiAgentSelectorWithApi as se, AgentsProvider as ae } from "@box/box-ai-agent-selector";
|
|
6
|
+
import { useState as le, useMemo as re, useCallback as I, useEffect as C } from "react";
|
|
7
|
+
import { useIntl as ne } from "react-intl";
|
|
8
|
+
import { BoxAiContentAnswers as ie } from "../../box-ai-content-answers.js";
|
|
9
|
+
import { A as de, R as ce } from "../../../../chunks/types.js";
|
|
10
|
+
import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as me } from "../common/constants.js";
|
|
11
|
+
import { s, C as ge } from "../../../../chunks/clear-conversation-button.js";
|
|
12
|
+
import fe from "./hooks/useStopPropagationOnEsc.js";
|
|
13
|
+
import { Title as ue } from "./title.js";
|
|
14
14
|
import S from "./messages.js";
|
|
15
15
|
import { jsxs as M, jsx as e } from "react/jsx-runtime";
|
|
16
|
-
const
|
|
16
|
+
const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", pe = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel, Me = (o) => o ? oe : void 0, he = (o) => {
|
|
17
17
|
const l = o === "collapsible";
|
|
18
18
|
return {
|
|
19
|
-
closeModalLabel:
|
|
20
|
-
closeModalTargetId:
|
|
21
|
-
closeModalIcon:
|
|
19
|
+
closeModalLabel: pe(l),
|
|
20
|
+
closeModalTargetId: Ce(l),
|
|
21
|
+
closeModalIcon: Me(l)
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, Pe = ({
|
|
24
24
|
children: o,
|
|
25
25
|
getAIStudioAgents: l,
|
|
26
26
|
hasCustomSuggestedQuestions: x,
|
|
@@ -33,29 +33,31 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
33
33
|
onClearAction: f,
|
|
34
34
|
onSelectAgent: k,
|
|
35
35
|
onSelectedAgentCallback: P,
|
|
36
|
+
promptValue: q,
|
|
36
37
|
recordAction: r,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
setPromptValue: G,
|
|
39
|
+
shouldRenderProviders: H = !0,
|
|
40
|
+
shouldShowLandingPage: z = !1,
|
|
41
|
+
stopPropagationOnEsc: F,
|
|
40
42
|
variant: L = "closable",
|
|
41
43
|
items: i,
|
|
42
44
|
parentItem: d,
|
|
43
|
-
...
|
|
45
|
+
...j
|
|
44
46
|
}) => {
|
|
45
47
|
var E, v;
|
|
46
48
|
const {
|
|
47
49
|
open: R,
|
|
48
|
-
defaultOpen:
|
|
49
|
-
onOpenChange:
|
|
50
|
-
modal:
|
|
50
|
+
defaultOpen: D,
|
|
51
|
+
onOpenChange: Q,
|
|
52
|
+
modal: U,
|
|
51
53
|
...a
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
const u = (v = (E = a == null ? void 0 : a.questions) == null ? void 0 : E[a.questions.length - 1]) == null ? void 0 : v.error, [
|
|
54
|
+
} = j, b = ne(), W = Y() <= Z.Medium;
|
|
55
|
+
fe(F, R);
|
|
56
|
+
const u = (v = (E = a == null ? void 0 : a.questions) == null ? void 0 : E[a.questions.length - 1]) == null ? void 0 : v.error, [y, A] = le(!1), {
|
|
55
57
|
closeModalLabel: O,
|
|
56
|
-
closeModalTargetId:
|
|
57
|
-
closeModalIcon:
|
|
58
|
-
} =
|
|
58
|
+
closeModalTargetId: K,
|
|
59
|
+
closeModalIcon: J
|
|
60
|
+
} = re(() => he(L), [L]), n = I((t) => {
|
|
59
61
|
r && (t.data ?? (t.data = {}), t.data.hostAppName = m, r(t));
|
|
60
62
|
}, [m, r]);
|
|
61
63
|
C(() => {
|
|
@@ -80,18 +82,18 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
80
82
|
}
|
|
81
83
|
});
|
|
82
84
|
}, [n, d, r]), C(() => {
|
|
83
|
-
u && u ===
|
|
85
|
+
u && u === de.AGENT_NOT_FOUND && A(!0);
|
|
84
86
|
}, [u]);
|
|
85
|
-
const
|
|
87
|
+
const V = () => {
|
|
86
88
|
f && (f(), n({
|
|
87
89
|
...p,
|
|
88
|
-
action:
|
|
90
|
+
action: me,
|
|
89
91
|
target: "clearChat"
|
|
90
92
|
}));
|
|
91
|
-
},
|
|
92
|
-
defaultOpen:
|
|
93
|
-
modal:
|
|
94
|
-
onOpenChange:
|
|
93
|
+
}, X = I(async () => (A(!1), l()), [l]), N = /* @__PURE__ */ M(c, {
|
|
94
|
+
defaultOpen: D,
|
|
95
|
+
modal: U,
|
|
96
|
+
onOpenChange: Q,
|
|
95
97
|
open: R,
|
|
96
98
|
children: [/* @__PURE__ */ e(c.Trigger, {
|
|
97
99
|
children: o
|
|
@@ -103,28 +105,28 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
103
105
|
className: s.modalHeaderContainer,
|
|
104
106
|
children: /* @__PURE__ */ M("div", {
|
|
105
107
|
className: s.modalHeader,
|
|
106
|
-
children: [!
|
|
108
|
+
children: [!W && /* @__PURE__ */ e(te, {
|
|
107
109
|
className: s.BoxAIIconColor,
|
|
108
110
|
"data-testid": "content-answers-icon-color",
|
|
109
111
|
height: w,
|
|
110
112
|
width: w
|
|
111
|
-
}), /* @__PURE__ */ e(
|
|
113
|
+
}), /* @__PURE__ */ e(ue, {
|
|
112
114
|
isAIStudioAgentSelectorEnabled: g
|
|
113
|
-
}), g && /* @__PURE__ */ e(
|
|
115
|
+
}), g && /* @__PURE__ */ e(se, {
|
|
114
116
|
contentClassName: s.agentSelectorContent,
|
|
115
117
|
disabled: a.hasRequestInProgress,
|
|
116
|
-
fetcher:
|
|
118
|
+
fetcher: X,
|
|
117
119
|
hostAppName: m,
|
|
118
120
|
onSelectAgent: k,
|
|
119
121
|
onSelectedAgentCallback: P,
|
|
120
122
|
recordAction: r,
|
|
121
|
-
requestState:
|
|
123
|
+
requestState: y ? ce.ERROR : void 0,
|
|
122
124
|
shouldHideAgentSelectorOnLoad: !0,
|
|
123
125
|
triggerChipClassName: s.agentSelectorTrigger,
|
|
124
126
|
useAgentLocalStorage: !0
|
|
125
127
|
})]
|
|
126
128
|
})
|
|
127
|
-
}), /* @__PURE__ */ e(
|
|
129
|
+
}), /* @__PURE__ */ e(ie, {
|
|
128
130
|
className: s.boxAiContentAnswers,
|
|
129
131
|
hasCustomSuggestedQuestions: x,
|
|
130
132
|
hostAppName: m,
|
|
@@ -133,32 +135,34 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
133
135
|
isStopResponseEnabled: _,
|
|
134
136
|
items: i,
|
|
135
137
|
parentItem: d,
|
|
138
|
+
promptValue: q,
|
|
136
139
|
recordAction: n,
|
|
137
|
-
|
|
140
|
+
setPromptValue: G,
|
|
141
|
+
shouldShowLandingPage: z,
|
|
138
142
|
...a
|
|
139
|
-
}), f && /* @__PURE__ */ e(
|
|
143
|
+
}), f && /* @__PURE__ */ e(ge, {
|
|
140
144
|
hasRequestInProgress: a.hasRequestInProgress,
|
|
141
|
-
onClick:
|
|
142
|
-
}), /* @__PURE__ */ e(
|
|
143
|
-
children: /* @__PURE__ */ e(
|
|
145
|
+
onClick: V
|
|
146
|
+
}), /* @__PURE__ */ e($, {
|
|
147
|
+
children: /* @__PURE__ */ e(ee, {
|
|
144
148
|
content: b.formatMessage(O),
|
|
145
149
|
"data-testid": "content-answers-close-modal-tooltip",
|
|
146
150
|
children: /* @__PURE__ */ e(c.Close, {
|
|
147
151
|
"aria-label": b.formatMessage(O),
|
|
148
152
|
className: s["modal-close-button"],
|
|
149
|
-
"data-target-id":
|
|
150
|
-
icon:
|
|
153
|
+
"data-target-id": K,
|
|
154
|
+
icon: J,
|
|
151
155
|
size: "small"
|
|
152
156
|
})
|
|
153
157
|
})
|
|
154
158
|
})]
|
|
155
159
|
})]
|
|
156
160
|
});
|
|
157
|
-
return
|
|
161
|
+
return H ? /* @__PURE__ */ e(ae, {
|
|
158
162
|
children: N
|
|
159
163
|
}) : N;
|
|
160
164
|
};
|
|
161
165
|
export {
|
|
162
|
-
|
|
163
|
-
|
|
166
|
+
Pe as IntelligenceModal,
|
|
167
|
+
Pe as default
|
|
164
168
|
};
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { ArrowsExpand as
|
|
3
|
-
import { useAgents as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import { BoxAiContentAnswers as
|
|
9
|
-
import { withApiWrapper as
|
|
10
|
-
import { ORIGIN_BOXAI_SIDEBAR as
|
|
11
|
-
import { mark as
|
|
12
|
-
import { C as
|
|
13
|
-
import { IntelligenceModal as
|
|
14
|
-
import { IntelligenceSidebarContext as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { jsxs as
|
|
18
|
-
import '../../../../styles/content.css';const
|
|
19
|
-
bcsSidebarBase:
|
|
20
|
-
bcsContent:
|
|
21
|
-
bcsBoxAISidebar:
|
|
22
|
-
bcsContentHeader:
|
|
23
|
-
bcsTitle:
|
|
24
|
-
bcsScrollContent:
|
|
25
|
-
withModalOpen:
|
|
26
|
-
bcsBoxAISidebarAgentSelector:
|
|
27
|
-
bcsBoxAISidebarAgentSelectorContainer:
|
|
28
|
-
bcsBoxAISidebarChatActions:
|
|
29
|
-
bcsBoxAISidebarContent:
|
|
30
|
-
bcsBoxAISidebarExpand:
|
|
31
|
-
bcsBoxAISidebarClear:
|
|
32
|
-
bcsBoxAISidebarTitlePart:
|
|
33
|
-
bcsBoxAISidebarClose:
|
|
34
|
-
sidebarChip:
|
|
35
|
-
bcsContentSubheader:
|
|
36
|
-
bcsScrollContentWrapper:
|
|
37
|
-
withSubheader:
|
|
38
|
-
expanded:
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
const
|
|
1
|
+
import { Text as ne, Tooltip as y, IconButton as H } from "@box/blueprint-web";
|
|
2
|
+
import { ArrowsExpand as se, XMark as ae } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { useAgents as ie, BoxAiAgentSelectorWithApi as re } from "@box/box-ai-agent-selector";
|
|
4
|
+
import D from "clsx";
|
|
5
|
+
import Q from "lodash/isEqual";
|
|
6
|
+
import * as b from "react";
|
|
7
|
+
import { useIntl as ce } from "react-intl";
|
|
8
|
+
import { BoxAiContentAnswers as de } from "../../box-ai-content-answers.js";
|
|
9
|
+
import { withApiWrapper as le } from "../api-wrapper/api-wrapper.js";
|
|
10
|
+
import { ORIGIN_BOXAI_SIDEBAR as be, EVENT_JS_READY as pe } from "../common/constants.js";
|
|
11
|
+
import { mark as Se } from "../common/performance.js";
|
|
12
|
+
import { C as Ae } from "../../../../chunks/clear-conversation-button.js";
|
|
13
|
+
import { IntelligenceModal as me } from "../modal/modal.js";
|
|
14
|
+
import { IntelligenceSidebarContext as he } from "./context.js";
|
|
15
|
+
import p from "./messages.js";
|
|
16
|
+
import Ie from "./title.js";
|
|
17
|
+
import { jsxs as h, Fragment as z, jsx as e } from "react/jsx-runtime";
|
|
18
|
+
import '../../../../styles/content.css';const ue = "_bcsSidebarBase_1kkpe_2", _e = "_bcsContent_1kkpe_2", Ce = "_bcsBoxAISidebar_1kkpe_2", xe = "_bcsContentHeader_1kkpe_6", ge = "_bcsTitle_1kkpe_15", Be = "_bcsScrollContent_1kkpe_22", fe = "_withModalOpen_1kkpe_32", ke = "_bcsBoxAISidebarAgentSelector_1kkpe_35", we = "_bcsBoxAISidebarAgentSelectorContainer_1kkpe_39", Te = "_bcsBoxAISidebarChatActions_1kkpe_43", Ee = "_bcsBoxAISidebarContent_1kkpe_47", Ne = "_bcsBoxAISidebarExpand_1kkpe_50", ve = "_bcsBoxAISidebarClear_1kkpe_53", Pe = "_bcsBoxAISidebarTitlePart_1kkpe_56", Me = "_bcsBoxAISidebarClose_1kkpe_77", Le = "_sidebarChip_1kkpe_88", Oe = "_bcsContentSubheader_1kkpe_101", Re = "_bcsScrollContentWrapper_1kkpe_110", qe = "_withSubheader_1kkpe_115", Ue = "_expanded_1kkpe_118", t = {
|
|
19
|
+
bcsSidebarBase: ue,
|
|
20
|
+
bcsContent: _e,
|
|
21
|
+
bcsBoxAISidebar: Ce,
|
|
22
|
+
bcsContentHeader: xe,
|
|
23
|
+
bcsTitle: ge,
|
|
24
|
+
bcsScrollContent: Be,
|
|
25
|
+
withModalOpen: fe,
|
|
26
|
+
bcsBoxAISidebarAgentSelector: ke,
|
|
27
|
+
bcsBoxAISidebarAgentSelectorContainer: we,
|
|
28
|
+
bcsBoxAISidebarChatActions: Te,
|
|
29
|
+
bcsBoxAISidebarContent: Ee,
|
|
30
|
+
bcsBoxAISidebarExpand: Ne,
|
|
31
|
+
bcsBoxAISidebarClear: ve,
|
|
32
|
+
bcsBoxAISidebarTitlePart: Pe,
|
|
33
|
+
bcsBoxAISidebarClose: Me,
|
|
34
|
+
sidebarChip: Le,
|
|
35
|
+
bcsContentSubheader: Oe,
|
|
36
|
+
bcsScrollContentWrapper: Re,
|
|
37
|
+
withSubheader: qe,
|
|
38
|
+
expanded: Ue
|
|
39
|
+
}, Ve = `${be}_${pe}`;
|
|
40
|
+
Se(Ve);
|
|
41
|
+
const We = ({
|
|
42
42
|
actions: f,
|
|
43
43
|
children: i,
|
|
44
44
|
className: o,
|
|
@@ -48,17 +48,17 @@ const Ue = ({
|
|
|
48
48
|
subheader: c,
|
|
49
49
|
...d
|
|
50
50
|
}) => {
|
|
51
|
-
const
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
"aria-labelledby":
|
|
54
|
-
className:
|
|
51
|
+
const A = `${S}${S === "" ? "" : "_"}${I}`, u = `${A}-content`;
|
|
52
|
+
return /* @__PURE__ */ h("div", {
|
|
53
|
+
"aria-labelledby": A,
|
|
54
|
+
className: D(t.bcsContent, o),
|
|
55
55
|
"data-testid": "bcs-content",
|
|
56
|
-
id:
|
|
56
|
+
id: u,
|
|
57
57
|
role: "tabpanel",
|
|
58
58
|
...d,
|
|
59
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ h("div", {
|
|
60
60
|
className: t.bcsContentHeader,
|
|
61
|
-
children: [r && /* @__PURE__ */ e(
|
|
61
|
+
children: [r && /* @__PURE__ */ e(ne, {
|
|
62
62
|
as: "h3",
|
|
63
63
|
className: t.bcsTitle,
|
|
64
64
|
children: r
|
|
@@ -75,7 +75,7 @@ const Ue = ({
|
|
|
75
75
|
})]
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
-
function
|
|
78
|
+
function Fe(f) {
|
|
79
79
|
const {
|
|
80
80
|
createSession: i,
|
|
81
81
|
encodedSession: o,
|
|
@@ -84,55 +84,55 @@ function We(f) {
|
|
|
84
84
|
hasRequestInProgress: r,
|
|
85
85
|
hostAppName: c,
|
|
86
86
|
isAIStudioAgentSelectorEnabled: d,
|
|
87
|
-
isLoading:
|
|
88
|
-
onSelectAgent:
|
|
89
|
-
questions:
|
|
87
|
+
isLoading: A,
|
|
88
|
+
onSelectAgent: u,
|
|
89
|
+
questions: _,
|
|
90
90
|
shouldShowLandingPage: N = !0,
|
|
91
91
|
sendQuestion: C,
|
|
92
92
|
stopQuestion: k,
|
|
93
|
-
embedTheAnswerButtonConfig:
|
|
93
|
+
embedTheAnswerButtonConfig: j,
|
|
94
94
|
onClose: v,
|
|
95
|
-
...
|
|
95
|
+
...P
|
|
96
96
|
} = f, {
|
|
97
97
|
formatMessage: l
|
|
98
|
-
} =
|
|
98
|
+
} = ce(), M = b.useRef(!1), [w, L] = b.useState(!1), {
|
|
99
99
|
cache: s,
|
|
100
100
|
contentName: O,
|
|
101
|
-
elementId:
|
|
102
|
-
fileExtension:
|
|
101
|
+
elementId: J,
|
|
102
|
+
fileExtension: X,
|
|
103
103
|
isFeedbackEnabled: R,
|
|
104
104
|
isFeedbackFormEnabled: q,
|
|
105
105
|
isStopResponseEnabled: U,
|
|
106
106
|
items: T,
|
|
107
|
-
itemSize:
|
|
108
|
-
onFeedbackFormSubmit:
|
|
109
|
-
onUserInteraction:
|
|
110
|
-
onSelectedAgentCallback:
|
|
111
|
-
recordAction:
|
|
107
|
+
itemSize: Y,
|
|
108
|
+
onFeedbackFormSubmit: V,
|
|
109
|
+
onUserInteraction: W,
|
|
110
|
+
onSelectedAgentCallback: G,
|
|
111
|
+
recordAction: m,
|
|
112
112
|
setCacheValue: x,
|
|
113
113
|
shouldPreinitSession: g
|
|
114
|
-
} =
|
|
115
|
-
agents:
|
|
116
|
-
requestState:
|
|
114
|
+
} = b.useContext(he), {
|
|
115
|
+
agents: K,
|
|
116
|
+
requestState: Z,
|
|
117
117
|
selectedAgent: E
|
|
118
|
-
} =
|
|
118
|
+
} = ie(), {
|
|
119
119
|
questions: a
|
|
120
|
-
} = s;
|
|
121
|
-
s.shouldShowLandingPage !== N && x("shouldShowLandingPage", N), s.encodedSession !== o && x("encodedSession", o),
|
|
122
|
-
agents:
|
|
123
|
-
requestState:
|
|
120
|
+
} = s, [F, $] = b.useState("");
|
|
121
|
+
s.shouldShowLandingPage !== N && x("shouldShowLandingPage", N), s.encodedSession !== o && x("encodedSession", o), Q(s.questions, _) || x("questions", _), Q(s.agents.selectedAgent, E) || x("agents", {
|
|
122
|
+
agents: K,
|
|
123
|
+
requestState: Z,
|
|
124
124
|
selectedAgent: E
|
|
125
125
|
});
|
|
126
126
|
const B = (n = !1) => {
|
|
127
|
-
!g && !o && !
|
|
128
|
-
},
|
|
127
|
+
!g && !o && !A && i && i(!0, !1), n && W && W();
|
|
128
|
+
}, ee = () => {
|
|
129
129
|
L(!1);
|
|
130
|
-
},
|
|
130
|
+
}, te = () => {
|
|
131
131
|
B(), L(!0);
|
|
132
132
|
};
|
|
133
|
-
|
|
133
|
+
b.useEffect(() => (g && !o && i && i(!0, !0), o && a.length > 0 && a[a.length - 1].isCompleted === !1 && C({
|
|
134
134
|
prompt: a[a.length - 1].prompt
|
|
135
|
-
}),
|
|
135
|
+
}), m && m({
|
|
136
136
|
action: "programmatic",
|
|
137
137
|
component: "sidebar",
|
|
138
138
|
feature: "answers",
|
|
@@ -145,97 +145,99 @@ function We(f) {
|
|
|
145
145
|
}
|
|
146
146
|
}), () => {
|
|
147
147
|
k();
|
|
148
|
-
}), []),
|
|
148
|
+
}), []), b.useEffect(() => {
|
|
149
149
|
const n = a[a.length - 1];
|
|
150
|
-
!g && !
|
|
150
|
+
!g && !M.current && o && (n != null && n.isLoading) && (C(n, E, !1), M.current = !0);
|
|
151
151
|
}, [o]);
|
|
152
|
-
const
|
|
152
|
+
const oe = () => /* @__PURE__ */ h("div", {
|
|
153
153
|
className: t.bcsBoxAISidebarTitlePart,
|
|
154
|
-
children: [/* @__PURE__ */ e(
|
|
154
|
+
children: [/* @__PURE__ */ e(Ie, {
|
|
155
155
|
isAIStudioAgentSelectorEnabled: d
|
|
156
156
|
}), d && /* @__PURE__ */ e("div", {
|
|
157
157
|
className: t.bcsBoxAISidebarAgentSelector,
|
|
158
|
-
children: /* @__PURE__ */ e(
|
|
158
|
+
children: /* @__PURE__ */ e(re, {
|
|
159
159
|
disabled: r,
|
|
160
160
|
fetcher: I,
|
|
161
161
|
hostAppName: c,
|
|
162
162
|
onAgentsListOpen: B,
|
|
163
|
-
onSelectAgent:
|
|
164
|
-
onSelectedAgentCallback:
|
|
165
|
-
recordAction:
|
|
163
|
+
onSelectAgent: u,
|
|
164
|
+
onSelectedAgentCallback: G,
|
|
165
|
+
recordAction: m,
|
|
166
166
|
shouldHideAgentSelectorOnLoad: !0,
|
|
167
167
|
useAgentLocalStorage: !0,
|
|
168
168
|
variant: "sidebar"
|
|
169
169
|
})
|
|
170
170
|
})]
|
|
171
171
|
});
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
children: [/* @__PURE__ */ e(
|
|
174
|
-
actions: /* @__PURE__ */
|
|
175
|
-
children: [
|
|
172
|
+
return /* @__PURE__ */ h(z, {
|
|
173
|
+
children: [/* @__PURE__ */ e(We, {
|
|
174
|
+
actions: /* @__PURE__ */ h(z, {
|
|
175
|
+
children: [oe(), /* @__PURE__ */ e(Ae, {
|
|
176
176
|
className: t.bcsBoxAISidebarClear,
|
|
177
177
|
hasRequestInProgress: r,
|
|
178
178
|
onClick: S
|
|
179
|
-
}), /* @__PURE__ */ e(
|
|
180
|
-
content: l(
|
|
179
|
+
}), /* @__PURE__ */ e(y, {
|
|
180
|
+
content: l(p.sidebarBoxAISwitchToModalView),
|
|
181
181
|
"data-testid": "content-answers-open-modal-tooltip",
|
|
182
182
|
variant: "standard",
|
|
183
|
-
children: /* @__PURE__ */ e(
|
|
184
|
-
"aria-label": l(
|
|
183
|
+
children: /* @__PURE__ */ e(H, {
|
|
184
|
+
"aria-label": l(p.sidebarBoxAISwitchToModalView),
|
|
185
185
|
className: t.bcsBoxAISidebarExpand,
|
|
186
186
|
"data-target-id": "IconButton-expandBoxAISidebar",
|
|
187
|
-
icon:
|
|
188
|
-
onClick:
|
|
187
|
+
icon: se,
|
|
188
|
+
onClick: te,
|
|
189
189
|
size: "small"
|
|
190
190
|
})
|
|
191
|
-
}), v && /* @__PURE__ */ e(
|
|
192
|
-
content: l(
|
|
191
|
+
}), v && /* @__PURE__ */ e(y, {
|
|
192
|
+
content: l(p.sidebarBoxAIClose),
|
|
193
193
|
"data-testid": "content-answers-close-tooltip",
|
|
194
194
|
variant: "standard",
|
|
195
|
-
children: /* @__PURE__ */ e(
|
|
196
|
-
"aria-label": l(
|
|
195
|
+
children: /* @__PURE__ */ e(H, {
|
|
196
|
+
"aria-label": l(p.sidebarBoxAIClose),
|
|
197
197
|
className: t.bcsBoxAISidebarClose,
|
|
198
198
|
"data-target-id": "IconButton-closeBoxAISidebar",
|
|
199
|
-
icon:
|
|
199
|
+
icon: ae,
|
|
200
200
|
onClick: v,
|
|
201
201
|
size: "small"
|
|
202
202
|
})
|
|
203
203
|
})]
|
|
204
204
|
}),
|
|
205
|
-
className:
|
|
205
|
+
className: D(t.bcsBoxAISidebar, {
|
|
206
206
|
[t.withModalOpen]: w
|
|
207
207
|
}),
|
|
208
|
-
elementId:
|
|
208
|
+
elementId: J,
|
|
209
209
|
sidebarView: "box-ai",
|
|
210
210
|
children: /* @__PURE__ */ e("div", {
|
|
211
211
|
className: t.bcsBoxAISidebarContent,
|
|
212
|
-
children: /* @__PURE__ */ e(
|
|
212
|
+
children: /* @__PURE__ */ e(de, {
|
|
213
213
|
className: t.bcsBoxAISidebarContentAnswers,
|
|
214
214
|
contentName: O,
|
|
215
|
-
contentType: l(
|
|
216
|
-
embedTheAnswerButtonConfig:
|
|
215
|
+
contentType: l(p.sidebarBoxAIContent),
|
|
216
|
+
embedTheAnswerButtonConfig: j,
|
|
217
217
|
hostAppName: c,
|
|
218
218
|
isAIStudioAgentSelectorEnabled: d,
|
|
219
219
|
isFeedbackEnabled: R,
|
|
220
220
|
isFeedbackFormEnabled: q,
|
|
221
221
|
isStopResponseEnabled: U,
|
|
222
222
|
items: T,
|
|
223
|
-
onFeedbackFormSubmit:
|
|
223
|
+
onFeedbackFormSubmit: V,
|
|
224
224
|
onUserIntentToUseAI: B,
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
promptValue: F,
|
|
226
|
+
questions: _,
|
|
227
|
+
recordAction: m,
|
|
228
|
+
setPromptValue: $,
|
|
227
229
|
shouldShowLandingPage: s.shouldShowLandingPage,
|
|
228
|
-
showLoadingIndicator:
|
|
230
|
+
showLoadingIndicator: A && g,
|
|
229
231
|
stopQuestion: k,
|
|
230
232
|
submitQuestion: C,
|
|
231
233
|
variant: "sidebar",
|
|
232
|
-
...
|
|
234
|
+
...P
|
|
233
235
|
})
|
|
234
236
|
})
|
|
235
|
-
}), /* @__PURE__ */ e(
|
|
237
|
+
}), /* @__PURE__ */ e(me, {
|
|
236
238
|
contentName: O,
|
|
237
|
-
contentType: l(
|
|
238
|
-
extension:
|
|
239
|
+
contentType: l(p.sidebarBoxAIContent),
|
|
240
|
+
extension: X,
|
|
239
241
|
getAIStudioAgents: I,
|
|
240
242
|
hasRequestInProgress: r,
|
|
241
243
|
hostAppName: c,
|
|
@@ -244,27 +246,29 @@ function We(f) {
|
|
|
244
246
|
isFeedbackFormEnabled: q,
|
|
245
247
|
isStopResponseEnabled: U,
|
|
246
248
|
items: T,
|
|
247
|
-
itemSize:
|
|
249
|
+
itemSize: Y,
|
|
248
250
|
onClearAction: S,
|
|
249
|
-
onFeedbackFormSubmit:
|
|
250
|
-
onOpenChange:
|
|
251
|
-
onSelectAgent:
|
|
251
|
+
onFeedbackFormSubmit: V,
|
|
252
|
+
onOpenChange: ee,
|
|
253
|
+
onSelectAgent: u,
|
|
252
254
|
onUserIntentToUseAI: B,
|
|
253
255
|
open: w,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
promptValue: F,
|
|
257
|
+
questions: _,
|
|
258
|
+
recordAction: w ? m : void 0,
|
|
259
|
+
setPromptValue: $,
|
|
256
260
|
shouldShowLandingPage: s.shouldShowLandingPage,
|
|
257
261
|
showLoadingIndicator: !1,
|
|
258
262
|
stopPropagationOnEsc: !0,
|
|
259
263
|
stopQuestion: k,
|
|
260
264
|
submitQuestion: C,
|
|
261
265
|
variant: "collapsible",
|
|
262
|
-
...
|
|
266
|
+
...P,
|
|
263
267
|
shouldRenderProviders: !1
|
|
264
268
|
})]
|
|
265
269
|
});
|
|
266
270
|
}
|
|
267
|
-
const
|
|
271
|
+
const st = le(Fe);
|
|
268
272
|
export {
|
|
269
|
-
|
|
273
|
+
st as default
|
|
270
274
|
};
|
|
@@ -21,8 +21,12 @@ export type BoxAiContentAnswersProps = Omit<ContentProps, 'isErrorMessageShown'
|
|
|
21
21
|
onCitationClick?: ItemClickHandler;
|
|
22
22
|
/** Callback function when user takes an action suggesting intent to use AI or actual interaction */
|
|
23
23
|
onUserIntentToUseAI?: (userHasInteracted?: boolean) => void;
|
|
24
|
+
/** The current prompt value from the textarea */
|
|
25
|
+
promptValue?: string;
|
|
24
26
|
/** Callback function to handle prompt button clicks */
|
|
25
27
|
promptButtonClickHandler?: (clickHandler: (content: string) => void) => void;
|
|
28
|
+
/** Callback function to set the prompt value */
|
|
29
|
+
setPromptValue?: (value: string) => void;
|
|
26
30
|
variant?: StyleVariant;
|
|
27
31
|
};
|
|
28
32
|
export declare const BoxAiContentAnswers: React.FC<BoxAiContentAnswersProps>;
|
|
@@ -22,16 +22,20 @@ export interface FooterProps {
|
|
|
22
22
|
onStopQuestion?: StopQuestion;
|
|
23
23
|
/** Callback when the user interacts with retry button or prompt textarea */
|
|
24
24
|
onUserInteraction?: () => void;
|
|
25
|
+
/** The current prompt value from the textarea */
|
|
26
|
+
promptValue?: string;
|
|
25
27
|
/** Callback function to handle logging events */
|
|
26
28
|
recordAction?: (payload: Record<string, unknown>) => void;
|
|
27
29
|
/** Callback when the user clicks on ask question or a suggested question */
|
|
28
30
|
sendQuestion: SubmitQuestion;
|
|
29
31
|
/** Callback function to handle selection of suggested question */
|
|
30
32
|
setAskSuggestedQuestion: ((value: SuggestedQuestionType | null) => void) | undefined;
|
|
33
|
+
/** Callback function to set the prompt value */
|
|
34
|
+
setPromptValue?: (value: string) => void;
|
|
31
35
|
/** Callback function to toggle the CTRL+SHIFT+X feature */
|
|
32
36
|
toggleDebugMode?: () => void;
|
|
33
37
|
/** Callback function to handle prompt button clicks */
|
|
34
38
|
promptButtonClickHandler?: (clickHandler: (content: string) => void) => void;
|
|
35
39
|
variant?: StyleVariant;
|
|
36
40
|
}
|
|
37
|
-
export declare const Footer: ({ askSuggestedQuestion, enableDebugMode, hasRequestInProgress, isAIStudioAgentSelectorEnabled, isDebugModeShown, isStopResponseEnabled, isStreamingEnabled, lastQuestion, onRetryQuestion, onStopQuestion, onUserInteraction, recordAction, sendQuestion, setAskSuggestedQuestion, toggleDebugMode, promptButtonClickHandler, variant, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const Footer: ({ askSuggestedQuestion, enableDebugMode, hasRequestInProgress, isAIStudioAgentSelectorEnabled, isDebugModeShown, isStopResponseEnabled, isStreamingEnabled, lastQuestion, onRetryQuestion, onStopQuestion, onUserInteraction, promptValue, recordAction, sendQuestion, setAskSuggestedQuestion, setPromptValue, toggleDebugMode, promptButtonClickHandler, variant, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,8 +19,15 @@ export type IntelligenceModalProps = ModalProps & Omit<BoxAiContentAnswersProps,
|
|
|
19
19
|
isStopResponseEnabled?: boolean;
|
|
20
20
|
/** Extension of the item used for QA. This is used for log purposes */
|
|
21
21
|
extension?: string;
|
|
22
|
+
/** The current prompt value from the textarea this is an optional param.
|
|
23
|
+
* it was added to support case of sidebar ai component that need to share prompt state between modal and sidebar ai components
|
|
24
|
+
* and to avoid risk change to other components that use ref to set value of prompt textarea
|
|
25
|
+
* */
|
|
26
|
+
promptValue?: string;
|
|
22
27
|
/** Callback function to handle logging events */
|
|
23
28
|
recordAction?: (params: RecordActionType) => void;
|
|
29
|
+
/** Callback function to set the prompt value */
|
|
30
|
+
setPromptValue?: (value: string) => void;
|
|
24
31
|
/** Child elements to be rendered inside the modal */
|
|
25
32
|
children?: React.ReactElement;
|
|
26
33
|
/** Flag to not render providers if parent component provides them (usually apiWrapper) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.56.1",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.89.
|
|
20
|
+
"@box/blueprint-web": "^12.89.2",
|
|
21
21
|
"@box/blueprint-web-assets": "^4.75.0",
|
|
22
|
-
"@box/box-ai-agent-selector": "^1.3.
|
|
23
|
-
"@box/item-icon": "^1.3.
|
|
22
|
+
"@box/box-ai-agent-selector": "^1.3.6",
|
|
23
|
+
"@box/item-icon": "^1.3.6",
|
|
24
24
|
"@box/storybook-utils": "^0.14.11",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|