@box/box-ai-content-answers 0.127.1 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/lib/components/common/constants.js +13 -9
- package/dist/esm/lib/components/common/performance.js +6 -0
- package/dist/esm/lib/components/sidebar/content.js +109 -105
- package/dist/types/lib/components/common/constants.d.ts +4 -0
- package/dist/types/lib/components/common/performance.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
const E = "modal", s = "answers",
|
|
2
|
-
action:
|
|
1
|
+
const E = "modal", s = "answers", _ = "programmatic", o = "click", t = "keypress", c = {
|
|
2
|
+
action: _,
|
|
3
3
|
component: E,
|
|
4
4
|
feature: s
|
|
5
|
-
},
|
|
5
|
+
}, I = "data_ready", n = "component_initialized", O = "js_ready", T = ["xls", "xlsx", "csv", "tsv"], A = ["xls", "xlsx", "xlsm", "xlsb", "csv", "ods", "gsheet"], N = "boxai_sidebar";
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o as
|
|
7
|
+
I as EVENT_DATA_READY,
|
|
8
|
+
n as EVENT_INITIALIZED,
|
|
9
|
+
O as EVENT_JS_READY,
|
|
10
|
+
T as INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS,
|
|
11
|
+
o as LOGGER_ACTION_CLICK,
|
|
12
|
+
t as LOGGER_ACTION_KEYPRESS,
|
|
13
|
+
_ as LOGGER_ACTION_PROGRAMMATIC,
|
|
14
|
+
c as LOGGER_BASE_CONFIG,
|
|
12
15
|
E as LOGGER_COMPONENT,
|
|
13
16
|
s as LOGGER_FEATURE,
|
|
14
|
-
|
|
17
|
+
N as ORIGIN_BOXAI_SIDEBAR,
|
|
18
|
+
A as SPREADSHEET_FILE_EXTENSIONS
|
|
15
19
|
};
|
|
@@ -1,58 +1,62 @@
|
|
|
1
|
-
import { Text as
|
|
1
|
+
import { Text as K, Tooltip as X, IconButton as Z } from "@box/blueprint-web";
|
|
2
2
|
import { ArrowsExpand as ee } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
3
|
import { useAgents as te, BoxAiAgentSelectorWithApi as ne } from "@box/box-ai-agent-selector";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import H from "clsx";
|
|
5
|
+
import $ from "lodash/isEqual";
|
|
6
6
|
import * as u from "react";
|
|
7
7
|
import { useIntl as oe } from "react-intl";
|
|
8
8
|
import { BoxAiContentAnswers as se } from "../../box-ai-content-answers.js";
|
|
9
9
|
import { withApiWrapper as ae } from "../api-wrapper/api-wrapper.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { ORIGIN_BOXAI_SIDEBAR as ie, EVENT_JS_READY as re } from "../common/constants.js";
|
|
11
|
+
import { mark as ce } from "../common/performance.js";
|
|
12
|
+
import { C as de } from "../../../../chunks/clear-conversation-button.js";
|
|
13
|
+
import { IntelligenceModal as le } from "../modal/modal.js";
|
|
14
|
+
import { IntelligenceSidebarContext as be } from "./context.js";
|
|
13
15
|
import C from "./messages.js";
|
|
14
|
-
import
|
|
15
|
-
import { jsxs as p, Fragment as
|
|
16
|
-
import '../../../../styles/content.css';const
|
|
17
|
-
bcsSidebarBase:
|
|
18
|
-
bcsContent:
|
|
19
|
-
bcsBoxAISidebar:
|
|
20
|
-
bcsContentHeader:
|
|
21
|
-
bcsTitle:
|
|
22
|
-
bcsScrollContent:
|
|
23
|
-
withModalOpen:
|
|
24
|
-
bcsBoxAISidebarAgentSelector:
|
|
25
|
-
bcsBoxAISidebarAgentSelectorContainer:
|
|
26
|
-
bcsBoxAISidebarChatActions:
|
|
27
|
-
bcsBoxAISidebarContent:
|
|
28
|
-
bcsBoxAISidebarExpand:
|
|
29
|
-
bcsBoxAISidebarTitlePart:
|
|
30
|
-
sidebarChip:
|
|
31
|
-
bcsContentSubheader:
|
|
32
|
-
bcsScrollContentWrapper:
|
|
33
|
-
withSubheader:
|
|
34
|
-
expanded:
|
|
35
|
-
},
|
|
16
|
+
import Se from "./title.js";
|
|
17
|
+
import { jsxs as p, Fragment as y, jsx as e } from "react/jsx-runtime";
|
|
18
|
+
import '../../../../styles/content.css';const ue = "_bcsSidebarBase_gfv6u_2", pe = "_bcsContent_gfv6u_2", Ae = "_bcsBoxAISidebar_gfv6u_2", ge = "_bcsContentHeader_gfv6u_6", he = "_bcsTitle_gfv6u_15", me = "_bcsScrollContent_gfv6u_22", fe = "_withModalOpen_gfv6u_32", _e = "_bcsBoxAISidebarAgentSelector_gfv6u_35", Ie = "_bcsBoxAISidebarAgentSelectorContainer_gfv6u_39", xe = "_bcsBoxAISidebarChatActions_gfv6u_43", Ce = "_bcsBoxAISidebarContent_gfv6u_47", Be = "_bcsBoxAISidebarExpand_gfv6u_50", ve = "_bcsBoxAISidebarTitlePart_gfv6u_53", we = "_sidebarChip_gfv6u_77", Te = "_bcsContentSubheader_gfv6u_90", Ee = "_bcsScrollContentWrapper_gfv6u_99", Ne = "_withSubheader_gfv6u_104", Pe = "_expanded_gfv6u_107", t = {
|
|
19
|
+
bcsSidebarBase: ue,
|
|
20
|
+
bcsContent: pe,
|
|
21
|
+
bcsBoxAISidebar: Ae,
|
|
22
|
+
bcsContentHeader: ge,
|
|
23
|
+
bcsTitle: he,
|
|
24
|
+
bcsScrollContent: me,
|
|
25
|
+
withModalOpen: fe,
|
|
26
|
+
bcsBoxAISidebarAgentSelector: _e,
|
|
27
|
+
bcsBoxAISidebarAgentSelectorContainer: Ie,
|
|
28
|
+
bcsBoxAISidebarChatActions: xe,
|
|
29
|
+
bcsBoxAISidebarContent: Ce,
|
|
30
|
+
bcsBoxAISidebarExpand: Be,
|
|
31
|
+
bcsBoxAISidebarTitlePart: ve,
|
|
32
|
+
sidebarChip: we,
|
|
33
|
+
bcsContentSubheader: Te,
|
|
34
|
+
bcsScrollContentWrapper: Ee,
|
|
35
|
+
withSubheader: Ne,
|
|
36
|
+
expanded: Pe
|
|
37
|
+
}, Me = `${ie}_${re}`;
|
|
38
|
+
ce(Me);
|
|
39
|
+
const Le = ({
|
|
36
40
|
actions: B,
|
|
37
41
|
children: i,
|
|
38
42
|
className: n,
|
|
39
43
|
elementId: d = "",
|
|
40
|
-
sidebarView:
|
|
44
|
+
sidebarView: A = "",
|
|
41
45
|
title: l,
|
|
42
46
|
subheader: r,
|
|
43
47
|
...c
|
|
44
48
|
}) => {
|
|
45
|
-
const b = `${d}${d === "" ? "" : "_"}${
|
|
49
|
+
const b = `${d}${d === "" ? "" : "_"}${A}`, g = `${b}-content`;
|
|
46
50
|
return /* @__PURE__ */ p("div", {
|
|
47
51
|
"aria-labelledby": b,
|
|
48
|
-
className:
|
|
52
|
+
className: H(t.bcsContent, n),
|
|
49
53
|
"data-testid": "bcs-content",
|
|
50
|
-
id:
|
|
54
|
+
id: g,
|
|
51
55
|
role: "tabpanel",
|
|
52
56
|
...c,
|
|
53
57
|
children: [/* @__PURE__ */ p("div", {
|
|
54
58
|
className: t.bcsContentHeader,
|
|
55
|
-
children: [l && /* @__PURE__ */ e(
|
|
59
|
+
children: [l && /* @__PURE__ */ e(K, {
|
|
56
60
|
as: "h3",
|
|
57
61
|
className: t.bcsTitle,
|
|
58
62
|
children: l
|
|
@@ -69,60 +73,60 @@ import '../../../../styles/content.css';const le = "_bcsSidebarBase_gfv6u_2", be
|
|
|
69
73
|
})]
|
|
70
74
|
});
|
|
71
75
|
};
|
|
72
|
-
function
|
|
76
|
+
function Oe(B) {
|
|
73
77
|
const {
|
|
74
78
|
createSession: i,
|
|
75
79
|
encodedSession: n,
|
|
76
80
|
onClearAction: d,
|
|
77
|
-
getAIStudioAgents:
|
|
81
|
+
getAIStudioAgents: A,
|
|
78
82
|
hasRequestInProgress: l,
|
|
79
83
|
hostAppName: r,
|
|
80
84
|
isAIStudioAgentSelectorEnabled: c,
|
|
81
85
|
isLoading: b,
|
|
82
|
-
isResetChatEnabled:
|
|
83
|
-
onSelectAgent:
|
|
84
|
-
questions:
|
|
85
|
-
shouldShowLandingPage:
|
|
86
|
-
sendQuestion:
|
|
86
|
+
isResetChatEnabled: g,
|
|
87
|
+
onSelectAgent: N,
|
|
88
|
+
questions: h,
|
|
89
|
+
shouldShowLandingPage: P = !0,
|
|
90
|
+
sendQuestion: m,
|
|
87
91
|
stopQuestion: v,
|
|
88
|
-
...
|
|
92
|
+
...M
|
|
89
93
|
} = B, {
|
|
90
|
-
formatMessage:
|
|
91
|
-
} = oe(),
|
|
94
|
+
formatMessage: f
|
|
95
|
+
} = oe(), L = u.useRef(!1), [w, O] = u.useState(!1), {
|
|
92
96
|
cache: s,
|
|
93
|
-
contentName:
|
|
97
|
+
contentName: R,
|
|
94
98
|
elementId: V,
|
|
95
|
-
fileExtension:
|
|
96
|
-
isFeedbackEnabled:
|
|
97
|
-
isFeedbackFormEnabled:
|
|
98
|
-
isStopResponseEnabled:
|
|
99
|
+
fileExtension: Q,
|
|
100
|
+
isFeedbackEnabled: k,
|
|
101
|
+
isFeedbackFormEnabled: q,
|
|
102
|
+
isStopResponseEnabled: U,
|
|
99
103
|
items: T,
|
|
100
|
-
itemSize:
|
|
101
|
-
onFeedbackFormSubmit:
|
|
102
|
-
onUserInteraction:
|
|
104
|
+
itemSize: D,
|
|
105
|
+
onFeedbackFormSubmit: W,
|
|
106
|
+
onUserInteraction: F,
|
|
103
107
|
recordAction: S,
|
|
104
|
-
setCacheValue:
|
|
105
|
-
shouldPreinitSession:
|
|
106
|
-
} = u.useContext(
|
|
107
|
-
agents:
|
|
108
|
-
requestState:
|
|
108
|
+
setCacheValue: _,
|
|
109
|
+
shouldPreinitSession: I
|
|
110
|
+
} = u.useContext(be), {
|
|
111
|
+
agents: j,
|
|
112
|
+
requestState: z,
|
|
109
113
|
selectedAgent: E
|
|
110
114
|
} = te(), {
|
|
111
115
|
questions: a
|
|
112
116
|
} = s;
|
|
113
|
-
s.shouldShowLandingPage !==
|
|
114
|
-
agents:
|
|
115
|
-
requestState:
|
|
117
|
+
s.shouldShowLandingPage !== P && _("shouldShowLandingPage", P), s.encodedSession !== n && _("encodedSession", n), $(s.questions, h) || _("questions", h), $(s.agents.selectedAgent, E) || _("agents", {
|
|
118
|
+
agents: j,
|
|
119
|
+
requestState: z,
|
|
116
120
|
selectedAgent: E
|
|
117
121
|
});
|
|
118
122
|
const x = (o = !1) => {
|
|
119
|
-
!
|
|
120
|
-
}, G = () => {
|
|
121
|
-
O(!1);
|
|
123
|
+
!I && !n && !b && i && i(!0, !1), o && F && F();
|
|
122
124
|
}, J = () => {
|
|
125
|
+
O(!1);
|
|
126
|
+
}, Y = () => {
|
|
123
127
|
x(), O(!0);
|
|
124
128
|
};
|
|
125
|
-
u.useEffect(() => (
|
|
129
|
+
u.useEffect(() => (I && !n && i && i(!0, !0), n && a.length > 0 && a[a.length - 1].isCompleted === !1 && m({
|
|
126
130
|
prompt: a[a.length - 1].prompt
|
|
127
131
|
}), S && S({
|
|
128
132
|
action: "programmatic",
|
|
@@ -139,46 +143,46 @@ function Pe(B) {
|
|
|
139
143
|
v();
|
|
140
144
|
}), []), u.useEffect(() => {
|
|
141
145
|
const o = a[a.length - 1];
|
|
142
|
-
!
|
|
146
|
+
!I && !L.current && n && (o != null && o.isLoading) && (m(o, E, !1), L.current = !0);
|
|
143
147
|
}, [n]);
|
|
144
|
-
const
|
|
148
|
+
const G = () => /* @__PURE__ */ p("div", {
|
|
145
149
|
className: t.bcsBoxAISidebarTitlePart,
|
|
146
|
-
children: [/* @__PURE__ */ e(
|
|
150
|
+
children: [/* @__PURE__ */ e(Se, {
|
|
147
151
|
isAIStudioAgentSelectorEnabled: c
|
|
148
152
|
}), c && /* @__PURE__ */ e("div", {
|
|
149
153
|
className: t.bcsBoxAISidebarAgentSelector,
|
|
150
154
|
children: /* @__PURE__ */ e(ne, {
|
|
151
155
|
disabled: l,
|
|
152
|
-
fetcher:
|
|
156
|
+
fetcher: A,
|
|
153
157
|
hostAppName: r,
|
|
154
158
|
onAgentsListOpen: x,
|
|
155
|
-
onSelectAgent:
|
|
159
|
+
onSelectAgent: N,
|
|
156
160
|
recordAction: S,
|
|
157
161
|
shouldHideAgentSelectorOnLoad: !0,
|
|
158
162
|
variant: "sidebar"
|
|
159
163
|
})
|
|
160
164
|
})]
|
|
161
165
|
});
|
|
162
|
-
return /* @__PURE__ */ p(
|
|
163
|
-
children: [/* @__PURE__ */ e(
|
|
164
|
-
actions: /* @__PURE__ */ p(
|
|
165
|
-
children: [
|
|
166
|
+
return /* @__PURE__ */ p(y, {
|
|
167
|
+
children: [/* @__PURE__ */ e(Le, {
|
|
168
|
+
actions: /* @__PURE__ */ p(y, {
|
|
169
|
+
children: [G(), g && /* @__PURE__ */ e(de, {
|
|
166
170
|
onClick: d
|
|
167
|
-
}), /* @__PURE__ */ e(
|
|
168
|
-
content:
|
|
171
|
+
}), /* @__PURE__ */ e(X, {
|
|
172
|
+
content: f(C.sidebarBoxAISwitchToModalView),
|
|
169
173
|
"data-testid": "content-answers-open-modal-tooltip",
|
|
170
174
|
variant: "standard",
|
|
171
175
|
children: /* @__PURE__ */ e(Z, {
|
|
172
|
-
"aria-label":
|
|
176
|
+
"aria-label": f(C.sidebarBoxAISwitchToModalView),
|
|
173
177
|
className: t.bcsBoxAISidebarExpand,
|
|
174
178
|
"data-target-id": "IconButton-expandBoxAISidebar",
|
|
175
179
|
icon: ee,
|
|
176
|
-
onClick:
|
|
180
|
+
onClick: Y,
|
|
177
181
|
size: "small"
|
|
178
182
|
})
|
|
179
183
|
})]
|
|
180
184
|
}),
|
|
181
|
-
className:
|
|
185
|
+
className: H(t.bcsBoxAISidebar, {
|
|
182
186
|
[t.withModalOpen]: w
|
|
183
187
|
}),
|
|
184
188
|
elementId: V,
|
|
@@ -187,60 +191,60 @@ function Pe(B) {
|
|
|
187
191
|
className: t.bcsBoxAISidebarContent,
|
|
188
192
|
children: /* @__PURE__ */ e(se, {
|
|
189
193
|
className: t.bcsBoxAISidebarContentAnswers,
|
|
190
|
-
contentName:
|
|
191
|
-
contentType:
|
|
194
|
+
contentName: R,
|
|
195
|
+
contentType: f(C.sidebarBoxAIContent),
|
|
192
196
|
hostAppName: r,
|
|
193
197
|
isAIStudioAgentSelectorEnabled: c,
|
|
194
|
-
isFeedbackEnabled:
|
|
195
|
-
isFeedbackFormEnabled:
|
|
196
|
-
isStopResponseEnabled:
|
|
198
|
+
isFeedbackEnabled: k,
|
|
199
|
+
isFeedbackFormEnabled: q,
|
|
200
|
+
isStopResponseEnabled: U,
|
|
197
201
|
items: T,
|
|
198
|
-
onFeedbackFormSubmit:
|
|
202
|
+
onFeedbackFormSubmit: W,
|
|
199
203
|
onUserIntentToUseAI: x,
|
|
200
|
-
questions:
|
|
204
|
+
questions: h,
|
|
201
205
|
recordAction: S,
|
|
202
206
|
shouldShowLandingPage: s.shouldShowLandingPage,
|
|
203
|
-
showLoadingIndicator: b &&
|
|
207
|
+
showLoadingIndicator: b && I,
|
|
204
208
|
stopQuestion: v,
|
|
205
|
-
submitQuestion:
|
|
209
|
+
submitQuestion: m,
|
|
206
210
|
variant: "sidebar",
|
|
207
|
-
...
|
|
211
|
+
...M
|
|
208
212
|
})
|
|
209
213
|
})
|
|
210
|
-
}), /* @__PURE__ */ e(
|
|
211
|
-
contentName:
|
|
212
|
-
contentType:
|
|
213
|
-
extension:
|
|
214
|
-
getAIStudioAgents:
|
|
214
|
+
}), /* @__PURE__ */ e(le, {
|
|
215
|
+
contentName: R,
|
|
216
|
+
contentType: f(C.sidebarBoxAIContent),
|
|
217
|
+
extension: Q,
|
|
218
|
+
getAIStudioAgents: A,
|
|
215
219
|
hasRequestInProgress: l,
|
|
216
220
|
hostAppName: r,
|
|
217
221
|
isAIStudioAgentSelectorEnabled: c,
|
|
218
|
-
isFeedbackEnabled:
|
|
219
|
-
isFeedbackFormEnabled:
|
|
220
|
-
isResetChatEnabled:
|
|
221
|
-
isStopResponseEnabled:
|
|
222
|
+
isFeedbackEnabled: k,
|
|
223
|
+
isFeedbackFormEnabled: q,
|
|
224
|
+
isResetChatEnabled: g,
|
|
225
|
+
isStopResponseEnabled: U,
|
|
222
226
|
items: T,
|
|
223
|
-
itemSize:
|
|
227
|
+
itemSize: D,
|
|
224
228
|
onClearAction: d,
|
|
225
|
-
onFeedbackFormSubmit:
|
|
226
|
-
onOpenChange:
|
|
227
|
-
onSelectAgent:
|
|
229
|
+
onFeedbackFormSubmit: W,
|
|
230
|
+
onOpenChange: J,
|
|
231
|
+
onSelectAgent: N,
|
|
228
232
|
onUserIntentToUseAI: x,
|
|
229
233
|
open: w,
|
|
230
|
-
questions:
|
|
234
|
+
questions: h,
|
|
231
235
|
recordAction: w ? S : void 0,
|
|
232
236
|
shouldShowLandingPage: s.shouldShowLandingPage,
|
|
233
237
|
showLoadingIndicator: !1,
|
|
234
238
|
stopPropagationOnEsc: !0,
|
|
235
239
|
stopQuestion: v,
|
|
236
|
-
submitQuestion:
|
|
240
|
+
submitQuestion: m,
|
|
237
241
|
variant: "collapsible",
|
|
238
|
-
...
|
|
242
|
+
...M,
|
|
239
243
|
shouldRenderProviders: !1
|
|
240
244
|
})]
|
|
241
245
|
});
|
|
242
246
|
}
|
|
243
|
-
const
|
|
247
|
+
const Ke = ae(Oe);
|
|
244
248
|
export {
|
|
245
|
-
|
|
249
|
+
Ke as default
|
|
246
250
|
};
|
|
@@ -5,5 +5,9 @@ export declare const LOGGER_ACTION_PROGRAMMATIC = "programmatic";
|
|
|
5
5
|
export declare const LOGGER_ACTION_CLICK = "click";
|
|
6
6
|
export declare const LOGGER_ACTION_KEYPRESS = "keypress";
|
|
7
7
|
export declare const LOGGER_BASE_CONFIG: RecordActionType;
|
|
8
|
+
export declare const EVENT_DATA_READY = "data_ready";
|
|
9
|
+
export declare const EVENT_INITIALIZED = "component_initialized";
|
|
10
|
+
export declare const EVENT_JS_READY = "js_ready";
|
|
8
11
|
export declare const INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS: string[];
|
|
9
12
|
export declare const SPREADSHEET_FILE_EXTENSIONS: string[];
|
|
13
|
+
export declare const ORIGIN_BOXAI_SIDEBAR = "boxai_sidebar";
|