@box/box-ai-content-answers 0.125.4 → 0.125.6
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.
|
@@ -12,7 +12,7 @@ import { IntelligenceSidebarContext as re } from "./context.js";
|
|
|
12
12
|
import f from "./messages.js";
|
|
13
13
|
import ce from "./title.js";
|
|
14
14
|
import { jsxs as h, Fragment as R, jsx as e } from "react/jsx-runtime";
|
|
15
|
-
import '../../../../styles/content.css';const de = "_bcsSidebarBase_2qjt9_2", le = "_bcsContent_2qjt9_2", be = "_bcsBoxAISidebar_2qjt9_2", Se = "_bcsContentHeader_2qjt9_6", pe = "_bcsTitle_2qjt9_15", he = "_bcsScrollContent_2qjt9_22", Ae = "_withModalOpen_2qjt9_32",
|
|
15
|
+
import '../../../../styles/content.css';const de = "_bcsSidebarBase_2qjt9_2", le = "_bcsContent_2qjt9_2", be = "_bcsBoxAISidebar_2qjt9_2", Se = "_bcsContentHeader_2qjt9_6", pe = "_bcsTitle_2qjt9_15", he = "_bcsScrollContent_2qjt9_22", Ae = "_withModalOpen_2qjt9_32", ue = "_bcsBoxAISidebarAgentSelector_2qjt9_35", me = "_bcsBoxAISidebarAgentSelectorContainer_2qjt9_39", ge = "_bcsBoxAISidebarChatActions_2qjt9_43", Ie = "_bcsBoxAISidebarContent_2qjt9_47", _e = "_bcsBoxAISidebarExpand_2qjt9_50", xe = "_bcsBoxAISidebarTitlePart_2qjt9_53", Ce = "_sidebarChip_2qjt9_77", fe = "_bcsContentSubheader_2qjt9_90", Be = "_bcsScrollContentWrapper_2qjt9_99", we = "_withSubheader_2qjt9_104", qe = "_expanded_2qjt9_107", t = {
|
|
16
16
|
bcsSidebarBase: de,
|
|
17
17
|
bcsContent: le,
|
|
18
18
|
bcsBoxAISidebar: be,
|
|
@@ -20,8 +20,8 @@ import '../../../../styles/content.css';const de = "_bcsSidebarBase_2qjt9_2", le
|
|
|
20
20
|
bcsTitle: pe,
|
|
21
21
|
bcsScrollContent: he,
|
|
22
22
|
withModalOpen: Ae,
|
|
23
|
-
bcsBoxAISidebarAgentSelector:
|
|
24
|
-
bcsBoxAISidebarAgentSelectorContainer:
|
|
23
|
+
bcsBoxAISidebarAgentSelector: ue,
|
|
24
|
+
bcsBoxAISidebarAgentSelectorContainer: me,
|
|
25
25
|
bcsBoxAISidebarChatActions: ge,
|
|
26
26
|
bcsBoxAISidebarContent: Ie,
|
|
27
27
|
bcsBoxAISidebarExpand: _e,
|
|
@@ -41,12 +41,12 @@ import '../../../../styles/content.css';const de = "_bcsSidebarBase_2qjt9_2", le
|
|
|
41
41
|
subheader: r,
|
|
42
42
|
...c
|
|
43
43
|
}) => {
|
|
44
|
-
const b = `${d}${d === "" ? "" : "_"}${A}`,
|
|
44
|
+
const b = `${d}${d === "" ? "" : "_"}${A}`, u = `${b}-content`;
|
|
45
45
|
return /* @__PURE__ */ h("div", {
|
|
46
46
|
"aria-labelledby": b,
|
|
47
47
|
className: y(t.bcsContent, n),
|
|
48
48
|
"data-testid": "bcs-content",
|
|
49
|
-
id:
|
|
49
|
+
id: u,
|
|
50
50
|
role: "tabpanel",
|
|
51
51
|
...c,
|
|
52
52
|
children: [/* @__PURE__ */ h("div", {
|
|
@@ -78,10 +78,10 @@ function je(B) {
|
|
|
78
78
|
hostAppName: r,
|
|
79
79
|
isAIStudioAgentSelectorEnabled: c,
|
|
80
80
|
isLoading: b,
|
|
81
|
-
isResetChatEnabled:
|
|
81
|
+
isResetChatEnabled: u,
|
|
82
82
|
onSelectAgent: v,
|
|
83
|
-
questions:
|
|
84
|
-
shouldShowLandingPage: P,
|
|
83
|
+
questions: m,
|
|
84
|
+
shouldShowLandingPage: P = !0,
|
|
85
85
|
sendQuestion: g,
|
|
86
86
|
stopQuestion: w,
|
|
87
87
|
...E
|
|
@@ -109,7 +109,7 @@ function je(B) {
|
|
|
109
109
|
} = ee(), {
|
|
110
110
|
questions: a
|
|
111
111
|
} = s;
|
|
112
|
-
s.shouldShowLandingPage !== P && _("shouldShowLandingPage", P), s.encodedSession !== n && _("encodedSession", n), s.questions !==
|
|
112
|
+
s.shouldShowLandingPage !== P && _("shouldShowLandingPage", P), s.encodedSession !== n && _("encodedSession", n), s.questions !== m && _("questions", m), s.agents.selectedAgent !== j && _("agents", {
|
|
113
113
|
agents: $,
|
|
114
114
|
requestState: z,
|
|
115
115
|
selectedAgent: j
|
|
@@ -161,7 +161,7 @@ function je(B) {
|
|
|
161
161
|
return /* @__PURE__ */ h(R, {
|
|
162
162
|
children: [/* @__PURE__ */ e(Te, {
|
|
163
163
|
actions: /* @__PURE__ */ h(R, {
|
|
164
|
-
children: [J(),
|
|
164
|
+
children: [J(), u && /* @__PURE__ */ e(ae, {
|
|
165
165
|
onClick: d
|
|
166
166
|
}), /* @__PURE__ */ e(X, {
|
|
167
167
|
content: I(f.sidebarBoxAISwitchToModalView),
|
|
@@ -196,7 +196,7 @@ function je(B) {
|
|
|
196
196
|
items: T,
|
|
197
197
|
onFeedbackFormSubmit: k,
|
|
198
198
|
onUserIntentToUseAI: C,
|
|
199
|
-
questions:
|
|
199
|
+
questions: m,
|
|
200
200
|
recordAction: S,
|
|
201
201
|
shouldShowLandingPage: s.shouldShowLandingPage,
|
|
202
202
|
showLoadingIndicator: b && x,
|
|
@@ -216,7 +216,7 @@ function je(B) {
|
|
|
216
216
|
isAIStudioAgentSelectorEnabled: c,
|
|
217
217
|
isFeedbackEnabled: O,
|
|
218
218
|
isFeedbackFormEnabled: U,
|
|
219
|
-
isResetChatEnabled:
|
|
219
|
+
isResetChatEnabled: u,
|
|
220
220
|
isStopResponseEnabled: W,
|
|
221
221
|
items: T,
|
|
222
222
|
itemSize: V,
|
|
@@ -226,7 +226,7 @@ function je(B) {
|
|
|
226
226
|
onSelectAgent: v,
|
|
227
227
|
onUserIntentToUseAI: C,
|
|
228
228
|
open: q,
|
|
229
|
-
questions:
|
|
229
|
+
questions: m,
|
|
230
230
|
recordAction: q ? S : void 0,
|
|
231
231
|
shouldShowLandingPage: s.shouldShowLandingPage,
|
|
232
232
|
showLoadingIndicator: !1,
|
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
import { AgentsProvider as D } from "@box/box-ai-agent-selector";
|
|
2
|
-
import * as
|
|
2
|
+
import * as w from "react";
|
|
3
3
|
import { useIntl as H } from "react-intl";
|
|
4
|
-
import { SPREADSHEET_FILE_EXTENSIONS as O, INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS as
|
|
5
|
-
import
|
|
6
|
-
import { IntelligenceSidebarContext as
|
|
7
|
-
import
|
|
4
|
+
import { SPREADSHEET_FILE_EXTENSIONS as O, INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS as q } from "../common/constants.js";
|
|
5
|
+
import z from "./content.js";
|
|
6
|
+
import { IntelligenceSidebarContext as U } from "./context.js";
|
|
7
|
+
import u from "./messages.js";
|
|
8
8
|
import { jsx as g } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
9
|
+
const J = (F) => {
|
|
10
|
+
var P;
|
|
10
11
|
const {
|
|
11
12
|
cache: e,
|
|
12
13
|
contentName: m,
|
|
13
14
|
elementId: S,
|
|
14
15
|
fileExtension: t,
|
|
15
|
-
fileID:
|
|
16
|
-
getSuggestedQuestions:
|
|
17
|
-
isIntelligentQueryMode:
|
|
18
|
-
isFeedbackEnabled:
|
|
19
|
-
isFeedbackFormEnabled:
|
|
16
|
+
fileID: L,
|
|
17
|
+
getSuggestedQuestions: f,
|
|
18
|
+
isIntelligentQueryMode: A,
|
|
19
|
+
isFeedbackEnabled: h,
|
|
20
|
+
isFeedbackFormEnabled: E,
|
|
20
21
|
isStopResponseEnabled: o = !1,
|
|
21
22
|
items: n,
|
|
22
23
|
itemSize: p,
|
|
23
|
-
localizedQuestions:
|
|
24
|
+
localizedQuestions: M,
|
|
24
25
|
onFeedbackFormSubmit: I,
|
|
25
26
|
onUserInteraction: Q,
|
|
26
27
|
recordAction: b,
|
|
27
28
|
setCacheValue: i,
|
|
28
29
|
shouldPreinitSession: r = !0,
|
|
29
30
|
setHasQuestions: l,
|
|
30
|
-
...
|
|
31
|
-
} =
|
|
31
|
+
...T
|
|
32
|
+
} = F, {
|
|
32
33
|
questions: s
|
|
33
34
|
} = e, {
|
|
34
35
|
formatMessage: a
|
|
35
|
-
} = H(),
|
|
36
|
+
} = H(), C = w.useMemo(() => ({
|
|
36
37
|
cache: e,
|
|
37
38
|
contentName: m,
|
|
38
39
|
elementId: S,
|
|
39
40
|
fileExtension: t,
|
|
40
|
-
isFeedbackEnabled:
|
|
41
|
-
isFeedbackFormEnabled:
|
|
41
|
+
isFeedbackEnabled: h,
|
|
42
|
+
isFeedbackFormEnabled: E,
|
|
42
43
|
isStopResponseEnabled: o,
|
|
43
44
|
items: n,
|
|
44
45
|
itemSize: p,
|
|
@@ -47,47 +48,47 @@ const W = (w) => {
|
|
|
47
48
|
recordAction: b,
|
|
48
49
|
setCacheValue: i,
|
|
49
50
|
shouldPreinitSession: r
|
|
50
|
-
}), [e, m, S, t,
|
|
51
|
-
|
|
51
|
+
}), [e, m, S, t, h, E, o, n, p, I, Q, b, i, r]), N = s.length > 0;
|
|
52
|
+
w.useEffect(() => {
|
|
52
53
|
l && l(N);
|
|
53
54
|
}, [N, l]);
|
|
54
|
-
let
|
|
55
|
-
s.length > 0 && !s[s.length - 1].isCompleted && (
|
|
56
|
-
const
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
i("suggestedQuestions",
|
|
61
|
-
},
|
|
55
|
+
let c = s;
|
|
56
|
+
s.length > 0 && !s[s.length - 1].isCompleted && (c = c.slice(0, -1));
|
|
57
|
+
const _ = O.includes(t), x = q.includes(t);
|
|
58
|
+
let d = "";
|
|
59
|
+
A && x ? d = a(u.welcomeMessageIntelligentQueryNotice) : _ && (d = a(u.welcomeMessageSpreadsheetNotice));
|
|
60
|
+
const R = (y) => {
|
|
61
|
+
i("suggestedQuestions", y);
|
|
62
|
+
}, k = typeof f == "function" ? [] : M, v = ((P = e.suggestedQuestions) == null ? void 0 : P.length) > 0 ? e.suggestedQuestions : k;
|
|
62
63
|
return (
|
|
63
64
|
// IntelligenceSidebarContent is using withApiWrapper that is not passing all provided props,
|
|
64
65
|
// that's why we need to use provider to pass other props
|
|
65
66
|
/* @__PURE__ */ g(D, {
|
|
66
67
|
value: e.agents,
|
|
67
|
-
children: /* @__PURE__ */ g(
|
|
68
|
-
value:
|
|
69
|
-
children: /* @__PURE__ */ g(
|
|
68
|
+
children: /* @__PURE__ */ g(U.Provider, {
|
|
69
|
+
value: C,
|
|
70
|
+
children: /* @__PURE__ */ g(z, {
|
|
70
71
|
cachedSuggestedQuestions: e.suggestedQuestions,
|
|
71
|
-
getSuggestedQuestions:
|
|
72
|
+
getSuggestedQuestions: f,
|
|
72
73
|
isOpen: !0,
|
|
73
74
|
isStopResponseEnabled: o,
|
|
74
|
-
itemID:
|
|
75
|
+
itemID: L,
|
|
75
76
|
items: n,
|
|
76
|
-
onSuggestedQuestionsFetched:
|
|
77
|
-
restoredQuestions:
|
|
77
|
+
onSuggestedQuestionsFetched: R,
|
|
78
|
+
restoredQuestions: c,
|
|
78
79
|
restoredSession: e.encodedSession,
|
|
79
80
|
restoredShouldShowLandingPage: e.shouldShowLandingPage,
|
|
80
81
|
shouldPreinitSession: r,
|
|
81
|
-
suggestedQuestions:
|
|
82
|
-
warningNotice:
|
|
83
|
-
warningNoticeAriaLabel: a(
|
|
84
|
-
...
|
|
82
|
+
suggestedQuestions: v,
|
|
83
|
+
warningNotice: d,
|
|
84
|
+
warningNoticeAriaLabel: a(u.welcomeMessageSpreadsheetNoticeAriaLabel),
|
|
85
|
+
...T
|
|
85
86
|
})
|
|
86
87
|
})
|
|
87
88
|
})
|
|
88
89
|
);
|
|
89
90
|
};
|
|
90
91
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
J as IntelligenceSidebar,
|
|
93
|
+
J as default
|
|
93
94
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './lib/components/api-wrapper/types';
|
|
|
5
5
|
export * from './lib/components/modal/clear-conversation-button';
|
|
6
6
|
export * from './lib/components/modal/modal';
|
|
7
7
|
export * from './lib/components/sidebar/sidebar';
|
|
8
|
+
export * from './lib/components/sidebar/types';
|
|
8
9
|
export * from './lib/constants';
|
|
9
10
|
export * from './lib/hooks/usePromptFocus';
|
|
10
11
|
export * from './lib/types';
|
|
@@ -4,7 +4,7 @@ export type IntelligenceSidebarCache = {
|
|
|
4
4
|
agents: AgentState;
|
|
5
5
|
encodedSession: string | undefined;
|
|
6
6
|
questions: QuestionType[];
|
|
7
|
-
shouldShowLandingPage
|
|
8
|
-
suggestedQuestions
|
|
7
|
+
shouldShowLandingPage?: boolean;
|
|
8
|
+
suggestedQuestions?: SuggestedQuestionType[];
|
|
9
9
|
};
|
|
10
10
|
export type IntelligenceSidebarCacheSetter = (key: 'agents' | 'encodedSession' | 'questions' | 'shouldShowLandingPage' | 'suggestedQuestions', value: AgentState | QuestionType[] | SuggestedQuestionType[] | string | boolean | null) => void;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.125.
|
|
3
|
+
"version": "0.125.6",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.35.0",
|
|
7
|
-
"@box/box-ai-agent-selector": "^0.
|
|
7
|
+
"@box/box-ai-agent-selector": "^0.41.3",
|
|
8
8
|
"@box/item-icon": "^0.9.44",
|
|
9
9
|
"formik": "^2.0.3",
|
|
10
10
|
"highlight.js": "^11.9.0",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.1.
|
|
20
|
+
"@box/blueprint-web": "^12.1.3",
|
|
21
21
|
"@box/blueprint-web-assets": "^4.46.0",
|
|
22
|
-
"@box/box-ai-agent-selector": "^0.41.
|
|
23
|
-
"@box/item-icon": "^0.9.
|
|
22
|
+
"@box/box-ai-agent-selector": "^0.41.5",
|
|
23
|
+
"@box/item-icon": "^0.9.142",
|
|
24
24
|
"@box/storybook-utils": "^0.12.5",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|