@box/box-ai-content-answers 0.79.2 → 0.79.3
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.
|
@@ -1,147 +1,152 @@
|
|
|
1
1
|
import "../../../../styles/footer.css";
|
|
2
|
-
import
|
|
2
|
+
import D from "clsx";
|
|
3
3
|
import * as r from "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useBreakpoint as
|
|
6
|
-
import { ArrowUp as
|
|
7
|
-
import { ArrowUp as
|
|
8
|
-
import { useAgents as
|
|
9
|
-
import { useAgents as
|
|
10
|
-
import { FooterActions as
|
|
4
|
+
import { useIntl as V } from "react-intl";
|
|
5
|
+
import { useBreakpoint as Y, Breakpoint as q, Avatar as J, TextArea as Q, Tooltip as Z, Button as P } from "@box/blueprint-web";
|
|
6
|
+
import { ArrowUp as tt } from "@box/blueprint-web-assets/icons/Fill";
|
|
7
|
+
import { ArrowUp as at } from "@box/blueprint-web-assets/icons/Line";
|
|
8
|
+
import { useAgents as rt } from "@box/box-ai-agent-selector";
|
|
9
|
+
import { useAgents as et } from "../../contexts/AgentsContext.js";
|
|
10
|
+
import { FooterActions as st } from "./footer-actions.js";
|
|
11
11
|
import it from "../../messages.js";
|
|
12
12
|
import { getAIAgentConfig as w } from "../common/agentUtils.js";
|
|
13
|
-
import { isDebugModeTrigger as
|
|
13
|
+
import { isDebugModeTrigger as ot, isEnterTrigger as nt } from "../common/keyInputUtils.js";
|
|
14
14
|
import { TEXT_AREA as o } from "./constants.js";
|
|
15
|
-
import
|
|
16
|
-
import { LOGGER_BASE_CONFIG as X, LOGGER_ACTION_CLICK as
|
|
17
|
-
import { jsxs as R, jsx as
|
|
18
|
-
const
|
|
19
|
-
questionInput:
|
|
20
|
-
avatar:
|
|
21
|
-
submitButton:
|
|
22
|
-
textArea:
|
|
23
|
-
sidebar:
|
|
24
|
-
submitButtonTooltip:
|
|
25
|
-
},
|
|
15
|
+
import n from "./messages.js";
|
|
16
|
+
import { LOGGER_BASE_CONFIG as X, LOGGER_ACTION_CLICK as mt, LOGGER_ACTION_KEYPRESS as ct } from "../common/constants.js";
|
|
17
|
+
import { jsxs as R, jsx as u } from "react/jsx-runtime";
|
|
18
|
+
const ut = "_questionInput_1x8yp_1", lt = "_avatar_1x8yp_11", pt = "_submitButton_1x8yp_14", ft = "_textArea_1x8yp_17", _t = "_sidebar_1x8yp_25", dt = "_submitButtonTooltip_1x8yp_41", f = {
|
|
19
|
+
questionInput: ut,
|
|
20
|
+
avatar: lt,
|
|
21
|
+
submitButton: pt,
|
|
22
|
+
textArea: ft,
|
|
23
|
+
sidebar: _t,
|
|
24
|
+
submitButtonTooltip: dt
|
|
25
|
+
}, Xt = ({
|
|
26
26
|
askSuggestedQuestion: A,
|
|
27
27
|
contentType: k,
|
|
28
|
-
enableDebugMode:
|
|
28
|
+
enableDebugMode: M = !1,
|
|
29
29
|
hasRequestInProgress: e,
|
|
30
30
|
isAgentSelectorEnabled: _,
|
|
31
|
-
isAIStudioAgentSelectorEnabled:
|
|
32
|
-
isDebugModeShown:
|
|
31
|
+
isAIStudioAgentSelectorEnabled: d,
|
|
32
|
+
isDebugModeShown: T,
|
|
33
33
|
isStopResponseEnabled: H,
|
|
34
34
|
isStreamingEnabled: I,
|
|
35
|
-
lastQuestion:
|
|
35
|
+
lastQuestion: L,
|
|
36
36
|
onRetryQuestion: E,
|
|
37
37
|
onStopQuestion: F,
|
|
38
38
|
recordAction: i,
|
|
39
39
|
sendQuestion: B,
|
|
40
40
|
setAskSuggestedQuestion: G,
|
|
41
|
-
toggleDebugMode:
|
|
41
|
+
toggleDebugMode: m,
|
|
42
42
|
user: N,
|
|
43
43
|
variant: K = "modal"
|
|
44
44
|
}) => {
|
|
45
|
-
const C = K === "sidebar", s =
|
|
46
|
-
selectedAgent: b
|
|
47
|
-
} = rt(), {
|
|
45
|
+
const C = K === "sidebar", s = V(), U = Y(), a = /* @__PURE__ */ r.createRef(), x = U <= q.Medium || C, [l, y] = r.useState(!0), [$, O] = r.useState(!1), {
|
|
48
46
|
selectedAgent: v
|
|
49
|
-
} =
|
|
47
|
+
} = et(), {
|
|
48
|
+
selectedAgent: b
|
|
49
|
+
} = rt(), h = r.useCallback(() => {
|
|
50
50
|
a.current && a.current.focus();
|
|
51
51
|
}, [a]), j = r.useCallback(() => {
|
|
52
|
-
var
|
|
53
|
-
let t = ((
|
|
52
|
+
var c;
|
|
53
|
+
let t = ((c = a.current) == null ? void 0 : c.value) ?? "";
|
|
54
54
|
a.current && t.length > o.MAX_LENGTH && (a.current.value = t.slice(0, o.MAX_LENGTH), t = a.current.value), O(t.length >= o.MAX_LENGTH), y(t.trim().length === 0);
|
|
55
|
-
}, [a]),
|
|
55
|
+
}, [a]), p = r.useCallback(() => {
|
|
56
56
|
if (h(), !e && a.current) {
|
|
57
57
|
const t = {
|
|
58
58
|
prompt: a.current.value
|
|
59
59
|
};
|
|
60
60
|
if (t.prompt && t.prompt.trim()) {
|
|
61
|
-
const
|
|
62
|
-
B(t,
|
|
61
|
+
const c = w(_, v, d, b);
|
|
62
|
+
B(t, c), a.current.value = "", y(!0), O(!1);
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
T && m && m();
|
|
65
65
|
}
|
|
66
|
-
}, [
|
|
67
|
-
t.preventDefault(), !e && !
|
|
66
|
+
}, [b, h, e, a, d, _, T, v, B, m]), S = r.useCallback((t) => {
|
|
67
|
+
t.preventDefault(), !e && !l && i && i({
|
|
68
68
|
...X,
|
|
69
|
-
action:
|
|
69
|
+
action: mt,
|
|
70
70
|
target: "ask"
|
|
71
|
-
}),
|
|
72
|
-
}, [e,
|
|
73
|
-
|
|
71
|
+
}), p();
|
|
72
|
+
}, [e, l, i, p]), W = r.useCallback((t) => {
|
|
73
|
+
M && m && ot(t) && m(), nt(t) && (t.preventDefault(), !e && !l && i && i({
|
|
74
74
|
...X,
|
|
75
|
-
action:
|
|
75
|
+
action: ct,
|
|
76
76
|
target: "ask"
|
|
77
|
-
}),
|
|
78
|
-
}, [
|
|
79
|
-
const
|
|
80
|
-
E(t,
|
|
81
|
-
}, [
|
|
77
|
+
}), p());
|
|
78
|
+
}, [M, e, l, i, p, m]), g = r.useCallback((t) => {
|
|
79
|
+
const c = w(_, v, d, b);
|
|
80
|
+
E(t, c);
|
|
81
|
+
}, [b, d, _, E, v]);
|
|
82
82
|
r.useEffect(() => {
|
|
83
83
|
queueMicrotask(h);
|
|
84
84
|
}, []), r.useEffect(() => {
|
|
85
|
-
A && a.current && !e && G && (a.current.value = A,
|
|
85
|
+
A && a.current && !e && G && (a.current.value = A, p(), G(null));
|
|
86
86
|
}, [A]);
|
|
87
|
-
function
|
|
87
|
+
function z() {
|
|
88
88
|
if (C)
|
|
89
|
-
return P;
|
|
90
|
-
if (d)
|
|
91
89
|
return tt;
|
|
90
|
+
if (x)
|
|
91
|
+
return at;
|
|
92
92
|
}
|
|
93
93
|
return /* @__PURE__ */ R("div", {
|
|
94
|
-
children: [
|
|
94
|
+
children: [L && /* @__PURE__ */ u(st, {
|
|
95
95
|
isStopResponseEnabled: H,
|
|
96
96
|
isStreamingEnabled: I,
|
|
97
|
-
lastQuestion:
|
|
98
|
-
onRetryQuestion:
|
|
97
|
+
lastQuestion: L,
|
|
98
|
+
onRetryQuestion: g,
|
|
99
99
|
onStopQuestion: F,
|
|
100
100
|
recordAction: i
|
|
101
101
|
}), /* @__PURE__ */ R("div", {
|
|
102
|
-
className:
|
|
103
|
-
children: [!
|
|
102
|
+
className: D(f.questionInput, C && f.sidebar),
|
|
103
|
+
children: [!x && /* @__PURE__ */ u("div", {
|
|
104
104
|
className: f.avatar,
|
|
105
105
|
"data-testid": "content-answers-question-input-avatar",
|
|
106
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ u(J, {
|
|
107
107
|
alt: s.formatMessage(it.userAvatar),
|
|
108
108
|
colorIndex: 0,
|
|
109
109
|
src: N.avatarURL,
|
|
110
110
|
text: N.name.charAt(0)
|
|
111
111
|
})
|
|
112
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ u(Q, {
|
|
113
113
|
ref: a,
|
|
114
114
|
className: f.textArea,
|
|
115
115
|
"data-testid": "content-answers-question-input",
|
|
116
|
-
error: $ && s.formatMessage(
|
|
116
|
+
error: $ && s.formatMessage(n.maxCharactersReachedError, {
|
|
117
117
|
characterLimit: o.MAX_LENGTH
|
|
118
118
|
}),
|
|
119
119
|
hideLabel: !0,
|
|
120
|
-
label: s.formatMessage(
|
|
120
|
+
label: s.formatMessage(n.askQuestionPlaceholder, {
|
|
121
121
|
type: k
|
|
122
122
|
}),
|
|
123
123
|
maxLength: o.MAX_LENGTH,
|
|
124
|
-
maxRows:
|
|
124
|
+
maxRows: x ? o.MAX_ROWS_MOBILE : o.MAX_ROWS,
|
|
125
125
|
onChange: j,
|
|
126
126
|
onKeyDown: W,
|
|
127
|
-
placeholder: s.formatMessage(
|
|
127
|
+
placeholder: s.formatMessage(n.askQuestionPlaceholder, {
|
|
128
128
|
type: k
|
|
129
129
|
})
|
|
130
|
-
}), /* @__PURE__ */
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
}), /* @__PURE__ */ u(Z, {
|
|
131
|
+
content: s.formatMessage(n.ask),
|
|
132
|
+
"data-testid": "ask-tooltip",
|
|
133
|
+
variant: "standard",
|
|
134
|
+
children: /* @__PURE__ */ u(P, {
|
|
135
|
+
"aria-label": s.formatMessage(n.ask),
|
|
136
|
+
className: f.submitButton,
|
|
137
|
+
"data-testid": "content-answers-submit-button",
|
|
138
|
+
disabled: l || e,
|
|
139
|
+
icon: z(),
|
|
140
|
+
loading: e,
|
|
141
|
+
loadingAriaLabel: s.formatMessage(n.askDisabledTooltip),
|
|
142
|
+
onClick: S,
|
|
143
|
+
size: "large",
|
|
144
|
+
children: x ? void 0 : s.formatMessage(n.ask)
|
|
145
|
+
})
|
|
141
146
|
})]
|
|
142
147
|
})]
|
|
143
148
|
});
|
|
144
149
|
};
|
|
145
150
|
export {
|
|
146
|
-
|
|
151
|
+
Xt as Footer
|
|
147
152
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.79.
|
|
3
|
+
"version": "0.79.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"**/*.css"
|
|
57
57
|
],
|
|
58
58
|
"license": "SEE LICENSE IN LICENSE",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "c30ec139381f2cc2ab423b53e0b3140f8ee2dd94"
|
|
60
60
|
}
|