@box/box-ai-content-answers 0.73.1 → 0.73.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.
- package/esm/lib/components/footer/footer.js +49 -49
- package/package.json +4 -4
- package/styles/footer.css +1 -1
|
@@ -8,79 +8,79 @@ import { ArrowUp as tt } from "@box/blueprint-web-assets/icons/Line";
|
|
|
8
8
|
import { useAgents as at } from "@box/box-ai-agent-selector";
|
|
9
9
|
import { useAgents as rt } from "../../contexts/AgentsContext.js";
|
|
10
10
|
import { FooterActions as et } from "./footer-actions.js";
|
|
11
|
-
import
|
|
12
|
-
import { getAIAgentConfig as
|
|
13
|
-
import { isDebugModeTrigger as
|
|
11
|
+
import it from "../../messages.js";
|
|
12
|
+
import { getAIAgentConfig as w } from "../common/agentUtils.js";
|
|
13
|
+
import { isDebugModeTrigger as st, isEnterTrigger as ot } from "../common/keyInputUtils.js";
|
|
14
14
|
import { TEXT_AREA as o } from "./constants.js";
|
|
15
15
|
import c from "./messages.js";
|
|
16
|
-
import { LOGGER_BASE_CONFIG as
|
|
17
|
-
import { jsxs as
|
|
18
|
-
const ct = "
|
|
16
|
+
import { LOGGER_BASE_CONFIG as X, LOGGER_ACTION_CLICK as nt, LOGGER_ACTION_KEYPRESS as mt } from "../common/constants.js";
|
|
17
|
+
import { jsxs as R, jsx as p } from "react/jsx-runtime";
|
|
18
|
+
const ct = "_questionInput_1x8yp_1", ut = "_avatar_1x8yp_11", lt = "_submitButton_1x8yp_14", pt = "_textArea_1x8yp_17", ft = "_sidebar_1x8yp_25", _t = "_submitButtonTooltip_1x8yp_41", f = {
|
|
19
19
|
questionInput: ct,
|
|
20
20
|
avatar: ut,
|
|
21
21
|
submitButton: lt,
|
|
22
|
-
textArea:
|
|
23
|
-
sidebar:
|
|
22
|
+
textArea: pt,
|
|
23
|
+
sidebar: ft,
|
|
24
24
|
submitButtonTooltip: _t
|
|
25
|
-
},
|
|
25
|
+
}, wt = ({
|
|
26
26
|
askSuggestedQuestion: A,
|
|
27
27
|
contentType: k,
|
|
28
28
|
enableDebugMode: L = !1,
|
|
29
29
|
hasRequestInProgress: e,
|
|
30
30
|
isAgentSelectorEnabled: _,
|
|
31
|
-
isAIStudioAgentSelectorEnabled:
|
|
31
|
+
isAIStudioAgentSelectorEnabled: x,
|
|
32
32
|
isDebugModeShown: M,
|
|
33
|
-
isStopResponseEnabled:
|
|
33
|
+
isStopResponseEnabled: H,
|
|
34
34
|
isStreamingEnabled: I,
|
|
35
35
|
lastQuestion: T,
|
|
36
36
|
onRetryQuestion: E,
|
|
37
37
|
onStopQuestion: F,
|
|
38
|
-
recordAction:
|
|
38
|
+
recordAction: i,
|
|
39
39
|
sendQuestion: B,
|
|
40
40
|
setAskSuggestedQuestion: G,
|
|
41
41
|
toggleDebugMode: n,
|
|
42
42
|
user: N,
|
|
43
43
|
variant: K = "modal"
|
|
44
44
|
}) => {
|
|
45
|
-
const C = K === "sidebar",
|
|
45
|
+
const C = K === "sidebar", s = Y(), U = g(), a = /* @__PURE__ */ r.createRef(), d = U <= q.Medium || C, [u, y] = r.useState(!0), [$, O] = r.useState(!1), {
|
|
46
46
|
selectedAgent: b
|
|
47
47
|
} = rt(), {
|
|
48
48
|
selectedAgent: v
|
|
49
|
-
} = at(),
|
|
49
|
+
} = at(), h = r.useCallback(() => {
|
|
50
50
|
a.current && a.current.focus();
|
|
51
51
|
}, [a]), j = r.useCallback(() => {
|
|
52
52
|
var m;
|
|
53
53
|
let t = ((m = a.current) == null ? void 0 : m.value) ?? "";
|
|
54
|
-
a.current && t.length > o.MAX_LENGTH && (a.current.value = t.slice(0, o.MAX_LENGTH), t = a.current.value),
|
|
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
55
|
}, [a]), l = r.useCallback(() => {
|
|
56
|
-
if (
|
|
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 m =
|
|
62
|
-
B(t, m), a.current.value = "",
|
|
61
|
+
const m = w(_, b, x, v);
|
|
62
|
+
B(t, m), a.current.value = "", y(!0), O(!1);
|
|
63
63
|
}
|
|
64
64
|
M && n && n();
|
|
65
65
|
}
|
|
66
|
-
}, [v,
|
|
67
|
-
t.preventDefault(), !e && !u &&
|
|
68
|
-
...
|
|
66
|
+
}, [v, h, e, a, x, _, M, b, B, n]), S = r.useCallback((t) => {
|
|
67
|
+
t.preventDefault(), !e && !u && i && i({
|
|
68
|
+
...X,
|
|
69
69
|
action: nt,
|
|
70
70
|
target: "ask"
|
|
71
71
|
}), l();
|
|
72
|
-
}, [e, u,
|
|
73
|
-
L && n &&
|
|
74
|
-
...
|
|
72
|
+
}, [e, u, i, l]), W = r.useCallback((t) => {
|
|
73
|
+
L && n && st(t) && n(), ot(t) && (t.preventDefault(), !e && !u && i && i({
|
|
74
|
+
...X,
|
|
75
75
|
action: mt,
|
|
76
76
|
target: "ask"
|
|
77
77
|
}), l());
|
|
78
|
-
}, [L, e, u,
|
|
79
|
-
const m =
|
|
78
|
+
}, [L, e, u, i, l, n]), z = r.useCallback((t) => {
|
|
79
|
+
const m = w(_, b, x, v);
|
|
80
80
|
E(t, m);
|
|
81
|
-
}, [v,
|
|
81
|
+
}, [v, x, _, E, b]);
|
|
82
82
|
r.useEffect(() => {
|
|
83
|
-
queueMicrotask(
|
|
83
|
+
queueMicrotask(h);
|
|
84
84
|
}, []), r.useEffect(() => {
|
|
85
85
|
A && a.current && !e && G && (a.current.value = A, l(), G(null));
|
|
86
86
|
}, [A]);
|
|
@@ -90,58 +90,58 @@ const ct = "_questionInput_1hh1s_1", ut = "_avatar_1hh1s_11", lt = "_submitButto
|
|
|
90
90
|
if (d)
|
|
91
91
|
return tt;
|
|
92
92
|
}
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
children: [T && /* @__PURE__ */
|
|
95
|
-
isStopResponseEnabled:
|
|
93
|
+
return /* @__PURE__ */ R("div", {
|
|
94
|
+
children: [T && /* @__PURE__ */ p(et, {
|
|
95
|
+
isStopResponseEnabled: H,
|
|
96
96
|
isStreamingEnabled: I,
|
|
97
97
|
lastQuestion: T,
|
|
98
98
|
onRetryQuestion: z,
|
|
99
99
|
onStopQuestion: F,
|
|
100
|
-
recordAction:
|
|
101
|
-
}), /* @__PURE__ */
|
|
102
|
-
className: V(
|
|
103
|
-
children: [!d && /* @__PURE__ */
|
|
104
|
-
className:
|
|
100
|
+
recordAction: i
|
|
101
|
+
}), /* @__PURE__ */ R("div", {
|
|
102
|
+
className: V(f.questionInput, C && f.sidebar),
|
|
103
|
+
children: [!d && /* @__PURE__ */ p("div", {
|
|
104
|
+
className: f.avatar,
|
|
105
105
|
"data-testid": "content-answers-question-input-avatar",
|
|
106
|
-
children: /* @__PURE__ */
|
|
107
|
-
alt:
|
|
106
|
+
children: /* @__PURE__ */ p(J, {
|
|
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__ */ p(Q, {
|
|
113
113
|
ref: a,
|
|
114
|
-
className:
|
|
114
|
+
className: f.textArea,
|
|
115
115
|
"data-testid": "content-answers-question-input",
|
|
116
|
-
error: $ &&
|
|
116
|
+
error: $ && s.formatMessage(c.maxCharactersReachedError, {
|
|
117
117
|
characterLimit: o.MAX_LENGTH
|
|
118
118
|
}),
|
|
119
119
|
hideLabel: !0,
|
|
120
|
-
label:
|
|
120
|
+
label: s.formatMessage(c.askQuestionPlaceholder, {
|
|
121
121
|
type: k
|
|
122
122
|
}),
|
|
123
123
|
maxLength: o.MAX_LENGTH,
|
|
124
124
|
maxRows: d ? o.MAX_ROWS_MOBILE : o.MAX_ROWS,
|
|
125
125
|
onChange: j,
|
|
126
126
|
onKeyDown: W,
|
|
127
|
-
placeholder:
|
|
127
|
+
placeholder: s.formatMessage(c.askQuestionPlaceholder, {
|
|
128
128
|
type: k
|
|
129
129
|
})
|
|
130
|
-
}), /* @__PURE__ */
|
|
131
|
-
"aria-label":
|
|
132
|
-
className:
|
|
130
|
+
}), /* @__PURE__ */ p(Z, {
|
|
131
|
+
"aria-label": s.formatMessage(c.ask),
|
|
132
|
+
className: f.submitButton,
|
|
133
133
|
"data-testid": "content-answers-submit-button",
|
|
134
134
|
disabled: u || e,
|
|
135
135
|
icon: D(),
|
|
136
136
|
loading: e,
|
|
137
|
-
loadingAriaLabel:
|
|
137
|
+
loadingAriaLabel: s.formatMessage(c.askDisabledTooltip),
|
|
138
138
|
onClick: S,
|
|
139
139
|
size: "large",
|
|
140
|
-
children: d ? void 0 :
|
|
140
|
+
children: d ? void 0 : s.formatMessage(c.ask)
|
|
141
141
|
})]
|
|
142
142
|
})]
|
|
143
143
|
});
|
|
144
144
|
};
|
|
145
145
|
export {
|
|
146
|
-
|
|
146
|
+
wt as Footer
|
|
147
147
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.73.
|
|
3
|
+
"version": "0.73.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"remarkable": "^2.0.1"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@box/blueprint-web": "^9.
|
|
17
|
+
"@box/blueprint-web": "^9.4.0",
|
|
18
18
|
"@box/blueprint-web-assets": "^4.30.1",
|
|
19
|
-
"@box/box-ai-agent-selector": "^0.17.
|
|
19
|
+
"@box/box-ai-agent-selector": "^0.17.15",
|
|
20
20
|
"@box/storybook-utils": "^0.8.0",
|
|
21
21
|
"@testing-library/react": "^15.0.6",
|
|
22
22
|
"react": "^18.3.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"**/*.css"
|
|
55
55
|
],
|
|
56
56
|
"license": "SEE LICENSE IN LICENSE",
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "54b7ea2666cfeaedb3792148822d4b50578a565b"
|
|
58
58
|
}
|
package/styles/footer.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._questionInput_1x8yp_1{position:relative;z-index:1;display:flex;flex:1 1 auto;align-items:end;padding:1rem 1.25rem;background:#fff;box-shadow:0 0 8px #0000000d,0 -1px #e8e8e8}._questionInput_1x8yp_1 ._avatar_1x8yp_11{margin-bottom:.25rem}._questionInput_1x8yp_1 ._submitButton_1x8yp_14{margin:0}._questionInput_1x8yp_1 ._textArea_1x8yp_17{gap:0;width:100%;margin:0 1rem}._questionInput_1x8yp_1 ._textArea_1x8yp_17 textarea{border:none}._questionInput_1x8yp_1._sidebar_1x8yp_25{padding:1rem}._questionInput_1x8yp_1._sidebar_1x8yp_25 ._textArea_1x8yp_17{margin:0 .75rem 0 0}._questionInput_1x8yp_1._sidebar_1x8yp_25 ._textArea_1x8yp_17 div{height:100%;align-items:center}._questionInput_1x8yp_1._sidebar_1x8yp_25 ._textArea_1x8yp_17 textarea{width:100%;padding-top:.625rem;padding-bottom:.625rem}._submitButtonTooltip_1x8yp_41{text-align:center}@media (max-width: 767px){._questionInput_1x8yp_1{padding:1rem}._questionInput_1x8yp_1 ._textArea_1x8yp_17{margin:0 .75rem 0 0}}
|