@box/box-ai-content-answers 0.131.1 → 0.132.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/README.md +6 -1
- package/dist/esm/lib/components/api-wrapper/content-answers-component.js +71 -73
- package/dist/esm/lib/components/modal/modal.js +79 -80
- package/dist/esm/lib/components/sidebar/content.js +109 -111
- package/dist/types/lib/components/modal/modal.d.ts +0 -2
- package/dist/types/lib/components/sidebar/sidebar.d.ts +0 -1
- package/dist/types/lib/components/sidebar/stories/shared.d.ts +0 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
12
12
|
|
|
13
|
+
## Notice: Upcoming Deprecation
|
|
14
|
+
|
|
15
|
+
This package will soon be deprecated as we transition to the new AX (Agentic) interface. A separate version intended for third-party developers will be released in the foresable future. We recommend using this package with caution, as it may no longer receive updates or support.
|
|
16
|
+
|
|
17
|
+
|
|
13
18
|
# box-ai-content-answers
|
|
14
19
|
|
|
15
20
|
This library was generated with [@box/automation](../../automation//README.md). General overview on how to perform tasks on the generated library can be found in [run-tasks](https://nx.dev/core-features/run-tasks) Nx documentation.
|
|
@@ -47,7 +52,7 @@ All commands used with Nx can be found in `project.json` file within your packag
|
|
|
47
52
|
|
|
48
53
|
## Ownership
|
|
49
54
|
|
|
50
|
-
Code of the feature belongs to
|
|
55
|
+
Code of the feature belongs to #ai-experiences. Responsibilities of owning team include control over code quality, providing guidelines for changes, and alignment with other teams regarding changes. It would be a good practice to consult which team, owning or requesting, will be responsible for implementing changes to code.
|
|
51
56
|
|
|
52
57
|
## Translations
|
|
53
58
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useReducer as
|
|
1
|
+
import { useReducer as ne, useEffect as oe } from "react";
|
|
2
2
|
import { R as m } from "../../../../chunks/types.js";
|
|
3
|
-
import { useContentAnswers as
|
|
4
|
-
import { ContentAnswersRecord as
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
7
|
-
const
|
|
3
|
+
import { useContentAnswers as ie } from "./hooks/useContentAnswers.js";
|
|
4
|
+
import { ContentAnswersRecord as re, ContentAnswersItemRecord as de } from "./records.js";
|
|
5
|
+
import ae from "./reducer.js";
|
|
6
|
+
import { jsx as ue } from "react/jsx-runtime";
|
|
7
|
+
const Ce = (t) => {
|
|
8
8
|
const {
|
|
9
9
|
WrappedComponent: f,
|
|
10
10
|
cachedSuggestedQuestions: r = [],
|
|
@@ -22,44 +22,43 @@ const pe = (t) => {
|
|
|
22
22
|
isDebugModeEnabled: q,
|
|
23
23
|
isMarkdownEnabled: T,
|
|
24
24
|
isOpen: n,
|
|
25
|
-
|
|
26
|
-
isStopResponseEnabled: L,
|
|
25
|
+
isStopResponseEnabled: I,
|
|
27
26
|
isStreamingEnabled: a,
|
|
28
27
|
itemID: o,
|
|
29
28
|
items: u,
|
|
30
|
-
onCitationClick:
|
|
31
|
-
onCloseModal:
|
|
32
|
-
onItemClick:
|
|
33
|
-
onSuggestedQuestionsFetched:
|
|
34
|
-
parentItem:
|
|
35
|
-
restoredQuestions:
|
|
36
|
-
restoredSession:
|
|
37
|
-
restoredShouldShowLandingPage:
|
|
38
|
-
sendErrorLog:
|
|
39
|
-
shouldRenderProviders:
|
|
40
|
-
suggestedQuestions:
|
|
41
|
-
warningNotice:
|
|
42
|
-
warningNoticeAriaLabel:
|
|
43
|
-
} = t, [g,
|
|
44
|
-
item: new
|
|
29
|
+
onCitationClick: L,
|
|
30
|
+
onCloseModal: P,
|
|
31
|
+
onItemClick: k,
|
|
32
|
+
onSuggestedQuestionsFetched: D,
|
|
33
|
+
parentItem: N,
|
|
34
|
+
restoredQuestions: O = [],
|
|
35
|
+
restoredSession: j = null,
|
|
36
|
+
restoredShouldShowLandingPage: v = !0,
|
|
37
|
+
sendErrorLog: M,
|
|
38
|
+
shouldRenderProviders: U = !0,
|
|
39
|
+
suggestedQuestions: _,
|
|
40
|
+
warningNotice: x,
|
|
41
|
+
warningNoticeAriaLabel: F
|
|
42
|
+
} = t, [g, y] = ne(ae, new re({
|
|
43
|
+
item: new de({
|
|
45
44
|
id: o
|
|
46
45
|
}),
|
|
47
|
-
questions:
|
|
48
|
-
encodedSession:
|
|
49
|
-
shouldShowLandingPage:
|
|
46
|
+
questions: O,
|
|
47
|
+
encodedSession: j,
|
|
48
|
+
shouldShowLandingPage: v
|
|
50
49
|
})), {
|
|
51
|
-
clearConversation:
|
|
52
|
-
createSession:
|
|
50
|
+
clearConversation: W,
|
|
51
|
+
createSession: z,
|
|
53
52
|
fetchAgentConfig: c,
|
|
54
53
|
fetchSuggestedQuestions: S,
|
|
55
|
-
retryQuestion:
|
|
56
|
-
sendQuestion:
|
|
57
|
-
setAnswerFeedback:
|
|
58
|
-
stopQuestion:
|
|
59
|
-
} =
|
|
54
|
+
retryQuestion: B,
|
|
55
|
+
sendQuestion: G,
|
|
56
|
+
setAnswerFeedback: H,
|
|
57
|
+
stopQuestion: J
|
|
58
|
+
} = ie({
|
|
60
59
|
contentAnswers: g,
|
|
61
60
|
createSessionRequest: A,
|
|
62
|
-
dispatchStateUpdate:
|
|
61
|
+
dispatchStateUpdate: y,
|
|
63
62
|
fetchTimeout: h,
|
|
64
63
|
formatCitations: C,
|
|
65
64
|
getAgentConfig: w,
|
|
@@ -67,71 +66,70 @@ const pe = (t) => {
|
|
|
67
66
|
getAnswer: Q,
|
|
68
67
|
getSuggestedQuestions: s,
|
|
69
68
|
isCitationsEnabled: d,
|
|
70
|
-
isStopResponseEnabled:
|
|
69
|
+
isStopResponseEnabled: I,
|
|
71
70
|
isStreamingEnabled: a,
|
|
72
71
|
itemID: o,
|
|
73
72
|
items: u,
|
|
74
|
-
onSuggestedQuestionsFetched:
|
|
75
|
-
sendErrorLog:
|
|
73
|
+
onSuggestedQuestionsFetched: D,
|
|
74
|
+
sendErrorLog: M,
|
|
76
75
|
...t
|
|
77
76
|
}), {
|
|
78
|
-
encodedSession:
|
|
79
|
-
error:
|
|
80
|
-
isLoading:
|
|
81
|
-
hasRequestInProgress:
|
|
82
|
-
questions:
|
|
83
|
-
shouldShowLandingPage:
|
|
77
|
+
encodedSession: K,
|
|
78
|
+
error: V,
|
|
79
|
+
isLoading: X,
|
|
80
|
+
hasRequestInProgress: Y = !1,
|
|
81
|
+
questions: Z,
|
|
82
|
+
shouldShowLandingPage: $,
|
|
84
83
|
suggestedQuestions: e
|
|
85
84
|
} = g;
|
|
86
|
-
|
|
85
|
+
oe(() => {
|
|
87
86
|
n && e.requestState === m.NOT_STARTED && S();
|
|
88
87
|
}, [n, S, e.requestState]);
|
|
89
|
-
const
|
|
90
|
-
let i =
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
createSession:
|
|
94
|
-
encodedSession:
|
|
95
|
-
error:
|
|
88
|
+
const ee = r.length > 0;
|
|
89
|
+
let i = _, l = m.SUCCESS;
|
|
90
|
+
ee ? i = r : s && (i = e.suggestions, l = e.requestState);
|
|
91
|
+
const te = Object.fromEntries(Object.entries({
|
|
92
|
+
createSession: z,
|
|
93
|
+
encodedSession: K,
|
|
94
|
+
error: V,
|
|
96
95
|
getAIStudioAgents: p,
|
|
97
96
|
hostAppName: R,
|
|
98
97
|
hasCustomSuggestedQuestions: !!s,
|
|
99
|
-
hasRequestInProgress:
|
|
98
|
+
hasRequestInProgress: Y,
|
|
100
99
|
isAIStudioAgentSelectorEnabled: b,
|
|
101
100
|
isCitationsEnabled: d,
|
|
102
101
|
isDebugModeEnabled: q,
|
|
103
102
|
isMarkdownEnabled: T,
|
|
104
|
-
isLoading:
|
|
103
|
+
isLoading: X,
|
|
105
104
|
isOpen: n,
|
|
106
|
-
isResetChatEnabled: I,
|
|
107
105
|
isStreamingEnabled: a,
|
|
108
106
|
itemID: o,
|
|
109
107
|
items: u,
|
|
110
|
-
onClearAction:
|
|
111
|
-
onCloseModal:
|
|
112
|
-
onCitationClick:
|
|
113
|
-
onItemClick:
|
|
108
|
+
onClearAction: W,
|
|
109
|
+
onCloseModal: P,
|
|
110
|
+
onCitationClick: L,
|
|
111
|
+
onItemClick: k,
|
|
114
112
|
onSelectAgent: c,
|
|
115
113
|
onAgentEditorToggle: c,
|
|
116
|
-
parentItem:
|
|
117
|
-
questions:
|
|
118
|
-
retryQuestion:
|
|
119
|
-
sendQuestion:
|
|
120
|
-
setAnswerFeedback:
|
|
121
|
-
shouldRenderProviders:
|
|
122
|
-
shouldShowLandingPage:
|
|
123
|
-
stopQuestion:
|
|
114
|
+
parentItem: N,
|
|
115
|
+
questions: Z,
|
|
116
|
+
retryQuestion: B,
|
|
117
|
+
sendQuestion: G,
|
|
118
|
+
setAnswerFeedback: H,
|
|
119
|
+
shouldRenderProviders: U,
|
|
120
|
+
shouldShowLandingPage: $,
|
|
121
|
+
stopQuestion: J,
|
|
124
122
|
suggestedQuestionsRequestState: l,
|
|
125
123
|
suggestedQuestions: i,
|
|
126
|
-
warningNotice:
|
|
127
|
-
warningNoticeAriaLabel:
|
|
128
|
-
}).filter(([
|
|
129
|
-
return /* @__PURE__ */
|
|
124
|
+
warningNotice: x,
|
|
125
|
+
warningNoticeAriaLabel: F
|
|
126
|
+
}).filter(([ce, se]) => se !== void 0));
|
|
127
|
+
return /* @__PURE__ */ ue(f, {
|
|
130
128
|
...t,
|
|
131
|
-
...
|
|
129
|
+
...te
|
|
132
130
|
});
|
|
133
131
|
};
|
|
134
132
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
Ce as ContentAnswersComponent,
|
|
134
|
+
Ce as default
|
|
137
135
|
};
|
|
@@ -1,76 +1,75 @@
|
|
|
1
|
-
import { useBreakpoint as
|
|
2
|
-
import { ArrowsCollapse as
|
|
3
|
-
import { BoxAiLogo as
|
|
1
|
+
import { useBreakpoint as V, Breakpoint as X, Modal as c, TooltipProvider as Y, Tooltip as Z } from "@box/blueprint-web";
|
|
2
|
+
import { ArrowsCollapse as $ } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { BoxAiLogo as ee } 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
|
|
11
|
-
import { s, C as
|
|
12
|
-
import
|
|
13
|
-
import { Title as
|
|
5
|
+
import { BoxAiAgentSelectorWithApi as oe, AgentsProvider as te } from "@box/box-ai-agent-selector";
|
|
6
|
+
import { useState as se, useMemo as ae, useCallback as S, useEffect as C } from "react";
|
|
7
|
+
import { useIntl as le } from "react-intl";
|
|
8
|
+
import { BoxAiContentAnswers as re } from "../../box-ai-content-answers.js";
|
|
9
|
+
import { A as ne, R as ie } from "../../../../chunks/types.js";
|
|
10
|
+
import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as de } from "../common/constants.js";
|
|
11
|
+
import { s, C as ce } from "../../../../chunks/clear-conversation-button.js";
|
|
12
|
+
import me from "./hooks/useStopPropagationOnEsc.js";
|
|
13
|
+
import { Title as fe } from "./title.js";
|
|
14
14
|
import x from "./messages.js";
|
|
15
|
-
import { jsxs as
|
|
16
|
-
const
|
|
15
|
+
import { jsxs as M, jsx as e } from "react/jsx-runtime";
|
|
16
|
+
const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", ue = (o) => o ? x.collapseModalAriaLabel : x.closeModalAriaLabel, Ce = (o) => o ? $ : void 0, pe = (o) => {
|
|
17
17
|
const a = o === "collapsible";
|
|
18
18
|
return {
|
|
19
|
-
closeModalLabel:
|
|
20
|
-
closeModalTargetId:
|
|
21
|
-
closeModalIcon:
|
|
19
|
+
closeModalLabel: ue(a),
|
|
20
|
+
closeModalTargetId: ge(a),
|
|
21
|
+
closeModalIcon: Ce(a)
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, _e = ({
|
|
24
24
|
children: o,
|
|
25
25
|
getAIStudioAgents: a,
|
|
26
26
|
hasCustomSuggestedQuestions: B,
|
|
27
27
|
hostAppName: m,
|
|
28
28
|
isAIStudioAgentSelectorEnabled: f = !1,
|
|
29
29
|
isDebugModeEnabled: I,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
onSelectedAgentCallback: P,
|
|
30
|
+
isStopResponseEnabled: _ = !1,
|
|
31
|
+
itemSize: h,
|
|
32
|
+
extension: T,
|
|
33
|
+
onClearAction: g,
|
|
34
|
+
onSelectAgent: k,
|
|
35
|
+
onSelectedAgentCallback: G,
|
|
37
36
|
recordAction: l,
|
|
38
|
-
shouldRenderProviders:
|
|
39
|
-
shouldShowLandingPage:
|
|
40
|
-
stopPropagationOnEsc:
|
|
37
|
+
shouldRenderProviders: P = !0,
|
|
38
|
+
shouldShowLandingPage: q = !1,
|
|
39
|
+
stopPropagationOnEsc: H,
|
|
41
40
|
variant: b = "closable",
|
|
42
41
|
items: i,
|
|
43
42
|
parentItem: d,
|
|
44
|
-
...
|
|
43
|
+
...z
|
|
45
44
|
}) => {
|
|
46
45
|
var E, v;
|
|
47
46
|
const {
|
|
48
|
-
open:
|
|
49
|
-
defaultOpen:
|
|
50
|
-
onOpenChange:
|
|
51
|
-
modal:
|
|
47
|
+
open: L,
|
|
48
|
+
defaultOpen: F,
|
|
49
|
+
onOpenChange: j,
|
|
50
|
+
modal: D,
|
|
52
51
|
...r
|
|
53
|
-
} =
|
|
54
|
-
|
|
55
|
-
const
|
|
52
|
+
} = z, O = le(), Q = V() <= X.Medium;
|
|
53
|
+
me(H, L);
|
|
54
|
+
const u = (v = (E = r == null ? void 0 : r.questions) == null ? void 0 : E[r.questions.length - 1]) == null ? void 0 : v.error, [U, A] = se(!1), {
|
|
56
55
|
closeModalLabel: N,
|
|
57
|
-
closeModalTargetId:
|
|
58
|
-
closeModalIcon:
|
|
59
|
-
} =
|
|
56
|
+
closeModalTargetId: W,
|
|
57
|
+
closeModalIcon: y
|
|
58
|
+
} = ae(() => pe(b), [b]), n = S((t) => {
|
|
60
59
|
l && (t.data ?? (t.data = {}), t.data.hostAppName = m, l(t));
|
|
61
60
|
}, [m, l]);
|
|
62
|
-
|
|
61
|
+
C(() => {
|
|
63
62
|
i || n({
|
|
64
|
-
...
|
|
63
|
+
...p,
|
|
65
64
|
target: "loaded",
|
|
66
65
|
data: {
|
|
67
|
-
fileSize:
|
|
68
|
-
fileType:
|
|
66
|
+
fileSize: h,
|
|
67
|
+
fileType: T
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
|
-
}, [n,
|
|
70
|
+
}, [n, T, h, i, l]), C(() => {
|
|
72
71
|
i && n({
|
|
73
|
-
...
|
|
72
|
+
...p,
|
|
74
73
|
target: "loaded",
|
|
75
74
|
data: {
|
|
76
75
|
parentItemType: d == null ? void 0 : d.type,
|
|
@@ -80,84 +79,84 @@ const ue = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
80
79
|
}))
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
|
-
}, [n, d, l]),
|
|
84
|
-
|
|
85
|
-
}, [
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
...
|
|
89
|
-
action:
|
|
82
|
+
}, [n, d, l]), C(() => {
|
|
83
|
+
u && u === ne.AGENT_NOT_FOUND && A(!0);
|
|
84
|
+
}, [u]);
|
|
85
|
+
const K = () => {
|
|
86
|
+
g && (g(), n({
|
|
87
|
+
...p,
|
|
88
|
+
action: de,
|
|
90
89
|
target: "clearChat"
|
|
91
90
|
}));
|
|
92
|
-
},
|
|
93
|
-
defaultOpen:
|
|
94
|
-
modal:
|
|
95
|
-
onOpenChange:
|
|
96
|
-
open:
|
|
91
|
+
}, J = S(async () => (A(!1), a()), [a]), R = /* @__PURE__ */ M(c, {
|
|
92
|
+
defaultOpen: F,
|
|
93
|
+
modal: D,
|
|
94
|
+
onOpenChange: j,
|
|
95
|
+
open: L,
|
|
97
96
|
children: [/* @__PURE__ */ e(c.Trigger, {
|
|
98
97
|
children: o
|
|
99
|
-
}), /* @__PURE__ */
|
|
98
|
+
}), /* @__PURE__ */ M(c.Content, {
|
|
100
99
|
className: s.contentAnswersModal,
|
|
101
100
|
"data-testid": "content-answers-modal",
|
|
102
101
|
size: "xlarge",
|
|
103
102
|
children: [/* @__PURE__ */ e(c.Header, {
|
|
104
103
|
className: s.modalHeaderContainer,
|
|
105
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ M("div", {
|
|
106
105
|
className: s.modalHeader,
|
|
107
|
-
children: [!
|
|
106
|
+
children: [!Q && /* @__PURE__ */ e(ee, {
|
|
108
107
|
className: s.BoxAIIconColor,
|
|
109
108
|
"data-testid": "content-answers-icon-color",
|
|
110
109
|
height: w,
|
|
111
110
|
width: w
|
|
112
|
-
}), /* @__PURE__ */ e(
|
|
111
|
+
}), /* @__PURE__ */ e(fe, {
|
|
113
112
|
isAIStudioAgentSelectorEnabled: f
|
|
114
|
-
}), f && /* @__PURE__ */ e(
|
|
113
|
+
}), f && /* @__PURE__ */ e(oe, {
|
|
115
114
|
contentClassName: s.agentSelectorContent,
|
|
116
115
|
disabled: r.hasRequestInProgress,
|
|
117
|
-
fetcher:
|
|
116
|
+
fetcher: J,
|
|
118
117
|
hostAppName: m,
|
|
119
|
-
onSelectAgent:
|
|
120
|
-
onSelectedAgentCallback:
|
|
118
|
+
onSelectAgent: k,
|
|
119
|
+
onSelectedAgentCallback: G,
|
|
121
120
|
recordAction: l,
|
|
122
|
-
requestState:
|
|
121
|
+
requestState: U ? ie.ERROR : void 0,
|
|
123
122
|
shouldHideAgentSelectorOnLoad: !0,
|
|
124
123
|
triggerChipClassName: s.agentSelectorTrigger
|
|
125
124
|
})]
|
|
126
125
|
})
|
|
127
|
-
}), /* @__PURE__ */ e(
|
|
126
|
+
}), /* @__PURE__ */ e(re, {
|
|
128
127
|
className: s.boxAiContentAnswers,
|
|
129
128
|
hasCustomSuggestedQuestions: B,
|
|
130
129
|
hostAppName: m,
|
|
131
130
|
isAIStudioAgentSelectorEnabled: f,
|
|
132
131
|
isDebugModeEnabled: I,
|
|
133
|
-
isStopResponseEnabled:
|
|
132
|
+
isStopResponseEnabled: _,
|
|
134
133
|
items: i,
|
|
135
134
|
parentItem: d,
|
|
136
135
|
recordAction: n,
|
|
137
|
-
shouldShowLandingPage:
|
|
136
|
+
shouldShowLandingPage: q,
|
|
138
137
|
...r
|
|
139
|
-
}),
|
|
140
|
-
onClick:
|
|
141
|
-
}), /* @__PURE__ */ e(
|
|
142
|
-
children: /* @__PURE__ */ e(
|
|
143
|
-
content:
|
|
138
|
+
}), g && /* @__PURE__ */ e(ce, {
|
|
139
|
+
onClick: K
|
|
140
|
+
}), /* @__PURE__ */ e(Y, {
|
|
141
|
+
children: /* @__PURE__ */ e(Z, {
|
|
142
|
+
content: O.formatMessage(N),
|
|
144
143
|
"data-testid": "content-answers-close-modal-tooltip",
|
|
145
144
|
children: /* @__PURE__ */ e(c.Close, {
|
|
146
|
-
"aria-label":
|
|
145
|
+
"aria-label": O.formatMessage(N),
|
|
147
146
|
className: s["modal-close-button"],
|
|
148
|
-
"data-target-id":
|
|
149
|
-
icon:
|
|
147
|
+
"data-target-id": W,
|
|
148
|
+
icon: y,
|
|
150
149
|
size: "small"
|
|
151
150
|
})
|
|
152
151
|
})
|
|
153
152
|
})]
|
|
154
153
|
})]
|
|
155
154
|
});
|
|
156
|
-
return
|
|
155
|
+
return P ? /* @__PURE__ */ e(te, {
|
|
157
156
|
children: R
|
|
158
157
|
}) : R;
|
|
159
158
|
};
|
|
160
159
|
export {
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
_e as IntelligenceModal,
|
|
161
|
+
_e as default
|
|
163
162
|
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { ArrowsExpand as
|
|
3
|
-
import { useAgents as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { Text as K, Tooltip as X, IconButton as Z } from "@box/blueprint-web";
|
|
2
|
+
import { ArrowsExpand as ee } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { useAgents as te, BoxAiAgentSelectorWithApi as ne } from "@box/box-ai-agent-selector";
|
|
4
|
+
import y from "clsx";
|
|
5
|
+
import F from "lodash/isEqual";
|
|
6
6
|
import * as u from "react";
|
|
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 p, Fragment 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:
|
|
7
|
+
import { useIntl as oe } from "react-intl";
|
|
8
|
+
import { BoxAiContentAnswers as se } from "../../box-ai-content-answers.js";
|
|
9
|
+
import { withApiWrapper as ae } from "../api-wrapper/api-wrapper.js";
|
|
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";
|
|
15
|
+
import C from "./messages.js";
|
|
16
|
+
import Se from "./title.js";
|
|
17
|
+
import { jsxs as p, Fragment as $, 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
28
|
bcsBoxAISidebarChatActions: xe,
|
|
29
|
-
bcsBoxAISidebarContent:
|
|
30
|
-
bcsBoxAISidebarExpand:
|
|
31
|
-
bcsBoxAISidebarTitlePart:
|
|
32
|
-
sidebarChip:
|
|
33
|
-
bcsContentSubheader:
|
|
34
|
-
bcsScrollContentWrapper:
|
|
35
|
-
withSubheader:
|
|
36
|
-
expanded:
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
const
|
|
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 = ({
|
|
40
40
|
actions: B,
|
|
41
41
|
children: i,
|
|
42
42
|
className: n,
|
|
@@ -49,14 +49,14 @@ const Oe = ({
|
|
|
49
49
|
const b = `${d}${d === "" ? "" : "_"}${A}`, g = `${b}-content`;
|
|
50
50
|
return /* @__PURE__ */ p("div", {
|
|
51
51
|
"aria-labelledby": b,
|
|
52
|
-
className:
|
|
52
|
+
className: y(t.bcsContent, n),
|
|
53
53
|
"data-testid": "bcs-content",
|
|
54
54
|
id: g,
|
|
55
55
|
role: "tabpanel",
|
|
56
56
|
...c,
|
|
57
57
|
children: [/* @__PURE__ */ p("div", {
|
|
58
58
|
className: t.bcsContentHeader,
|
|
59
|
-
children: [l && /* @__PURE__ */ e(
|
|
59
|
+
children: [l && /* @__PURE__ */ e(K, {
|
|
60
60
|
as: "h3",
|
|
61
61
|
className: t.bcsTitle,
|
|
62
62
|
children: l
|
|
@@ -73,7 +73,7 @@ const Oe = ({
|
|
|
73
73
|
})]
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
-
function
|
|
76
|
+
function Oe(B) {
|
|
77
77
|
const {
|
|
78
78
|
createSession: i,
|
|
79
79
|
encodedSession: n,
|
|
@@ -83,49 +83,48 @@ function Re(B) {
|
|
|
83
83
|
hostAppName: r,
|
|
84
84
|
isAIStudioAgentSelectorEnabled: c,
|
|
85
85
|
isLoading: b,
|
|
86
|
-
|
|
87
|
-
onSelectAgent: N,
|
|
86
|
+
onSelectAgent: g,
|
|
88
87
|
questions: h,
|
|
89
|
-
shouldShowLandingPage:
|
|
88
|
+
shouldShowLandingPage: N = !0,
|
|
90
89
|
sendQuestion: m,
|
|
91
90
|
stopQuestion: v,
|
|
92
|
-
...
|
|
91
|
+
...P
|
|
93
92
|
} = B, {
|
|
94
93
|
formatMessage: f
|
|
95
|
-
} =
|
|
94
|
+
} = oe(), M = u.useRef(!1), [w, L] = u.useState(!1), {
|
|
96
95
|
cache: s,
|
|
97
|
-
contentName:
|
|
98
|
-
elementId:
|
|
99
|
-
fileExtension:
|
|
100
|
-
isFeedbackEnabled:
|
|
101
|
-
isFeedbackFormEnabled:
|
|
102
|
-
isStopResponseEnabled:
|
|
96
|
+
contentName: O,
|
|
97
|
+
elementId: H,
|
|
98
|
+
fileExtension: V,
|
|
99
|
+
isFeedbackEnabled: R,
|
|
100
|
+
isFeedbackFormEnabled: k,
|
|
101
|
+
isStopResponseEnabled: q,
|
|
103
102
|
items: T,
|
|
104
|
-
itemSize:
|
|
105
|
-
onFeedbackFormSubmit:
|
|
106
|
-
onUserInteraction:
|
|
107
|
-
onSelectedAgentCallback:
|
|
103
|
+
itemSize: Q,
|
|
104
|
+
onFeedbackFormSubmit: U,
|
|
105
|
+
onUserInteraction: W,
|
|
106
|
+
onSelectedAgentCallback: D,
|
|
108
107
|
recordAction: S,
|
|
109
108
|
setCacheValue: _,
|
|
110
109
|
shouldPreinitSession: I
|
|
111
|
-
} = u.useContext(
|
|
112
|
-
agents:
|
|
113
|
-
requestState:
|
|
110
|
+
} = u.useContext(be), {
|
|
111
|
+
agents: j,
|
|
112
|
+
requestState: z,
|
|
114
113
|
selectedAgent: E
|
|
115
|
-
} =
|
|
114
|
+
} = te(), {
|
|
116
115
|
questions: a
|
|
117
116
|
} = s;
|
|
118
|
-
s.shouldShowLandingPage !==
|
|
119
|
-
agents:
|
|
120
|
-
requestState:
|
|
117
|
+
s.shouldShowLandingPage !== N && _("shouldShowLandingPage", N), s.encodedSession !== n && _("encodedSession", n), F(s.questions, h) || _("questions", h), F(s.agents.selectedAgent, E) || _("agents", {
|
|
118
|
+
agents: j,
|
|
119
|
+
requestState: z,
|
|
121
120
|
selectedAgent: E
|
|
122
121
|
});
|
|
123
|
-
const
|
|
124
|
-
!I && !n && !b && i && i(!0, !1), o &&
|
|
122
|
+
const x = (o = !1) => {
|
|
123
|
+
!I && !n && !b && i && i(!0, !1), o && W && W();
|
|
124
|
+
}, J = () => {
|
|
125
|
+
L(!1);
|
|
125
126
|
}, Y = () => {
|
|
126
|
-
|
|
127
|
-
}, G = () => {
|
|
128
|
-
C(), O(!0);
|
|
127
|
+
x(), L(!0);
|
|
129
128
|
};
|
|
130
129
|
u.useEffect(() => (I && !n && i && i(!0, !0), n && a.length > 0 && a[a.length - 1].isCompleted === !1 && m({
|
|
131
130
|
prompt: a[a.length - 1].prompt
|
|
@@ -144,65 +143,65 @@ function Re(B) {
|
|
|
144
143
|
v();
|
|
145
144
|
}), []), u.useEffect(() => {
|
|
146
145
|
const o = a[a.length - 1];
|
|
147
|
-
!I && !
|
|
146
|
+
!I && !M.current && n && (o != null && o.isLoading) && (m(o, E, !1), M.current = !0);
|
|
148
147
|
}, [n]);
|
|
149
|
-
const
|
|
148
|
+
const G = () => /* @__PURE__ */ p("div", {
|
|
150
149
|
className: t.bcsBoxAISidebarTitlePart,
|
|
151
|
-
children: [/* @__PURE__ */ e(
|
|
150
|
+
children: [/* @__PURE__ */ e(Se, {
|
|
152
151
|
isAIStudioAgentSelectorEnabled: c
|
|
153
152
|
}), c && /* @__PURE__ */ e("div", {
|
|
154
153
|
className: t.bcsBoxAISidebarAgentSelector,
|
|
155
|
-
children: /* @__PURE__ */ e(
|
|
154
|
+
children: /* @__PURE__ */ e(ne, {
|
|
156
155
|
disabled: l,
|
|
157
156
|
fetcher: A,
|
|
158
157
|
hostAppName: r,
|
|
159
|
-
onAgentsListOpen:
|
|
160
|
-
onSelectAgent:
|
|
161
|
-
onSelectedAgentCallback:
|
|
158
|
+
onAgentsListOpen: x,
|
|
159
|
+
onSelectAgent: g,
|
|
160
|
+
onSelectedAgentCallback: D,
|
|
162
161
|
recordAction: S,
|
|
163
162
|
shouldHideAgentSelectorOnLoad: !0,
|
|
164
163
|
variant: "sidebar"
|
|
165
164
|
})
|
|
166
165
|
})]
|
|
167
166
|
});
|
|
168
|
-
return /* @__PURE__ */ p(
|
|
169
|
-
children: [/* @__PURE__ */ e(
|
|
170
|
-
actions: /* @__PURE__ */ p(
|
|
171
|
-
children: [
|
|
167
|
+
return /* @__PURE__ */ p($, {
|
|
168
|
+
children: [/* @__PURE__ */ e(Le, {
|
|
169
|
+
actions: /* @__PURE__ */ p($, {
|
|
170
|
+
children: [G(), /* @__PURE__ */ e(de, {
|
|
172
171
|
onClick: d
|
|
173
|
-
}), /* @__PURE__ */ e(
|
|
174
|
-
content: f(
|
|
172
|
+
}), /* @__PURE__ */ e(X, {
|
|
173
|
+
content: f(C.sidebarBoxAISwitchToModalView),
|
|
175
174
|
"data-testid": "content-answers-open-modal-tooltip",
|
|
176
175
|
variant: "standard",
|
|
177
|
-
children: /* @__PURE__ */ e(
|
|
178
|
-
"aria-label": f(
|
|
176
|
+
children: /* @__PURE__ */ e(Z, {
|
|
177
|
+
"aria-label": f(C.sidebarBoxAISwitchToModalView),
|
|
179
178
|
className: t.bcsBoxAISidebarExpand,
|
|
180
179
|
"data-target-id": "IconButton-expandBoxAISidebar",
|
|
181
|
-
icon:
|
|
182
|
-
onClick:
|
|
180
|
+
icon: ee,
|
|
181
|
+
onClick: Y,
|
|
183
182
|
size: "small"
|
|
184
183
|
})
|
|
185
184
|
})]
|
|
186
185
|
}),
|
|
187
|
-
className:
|
|
186
|
+
className: y(t.bcsBoxAISidebar, {
|
|
188
187
|
[t.withModalOpen]: w
|
|
189
188
|
}),
|
|
190
|
-
elementId:
|
|
189
|
+
elementId: H,
|
|
191
190
|
sidebarView: "box-ai",
|
|
192
191
|
children: /* @__PURE__ */ e("div", {
|
|
193
192
|
className: t.bcsBoxAISidebarContent,
|
|
194
|
-
children: /* @__PURE__ */ e(
|
|
193
|
+
children: /* @__PURE__ */ e(se, {
|
|
195
194
|
className: t.bcsBoxAISidebarContentAnswers,
|
|
196
|
-
contentName:
|
|
197
|
-
contentType: f(
|
|
195
|
+
contentName: O,
|
|
196
|
+
contentType: f(C.sidebarBoxAIContent),
|
|
198
197
|
hostAppName: r,
|
|
199
198
|
isAIStudioAgentSelectorEnabled: c,
|
|
200
|
-
isFeedbackEnabled:
|
|
201
|
-
isFeedbackFormEnabled:
|
|
202
|
-
isStopResponseEnabled:
|
|
199
|
+
isFeedbackEnabled: R,
|
|
200
|
+
isFeedbackFormEnabled: k,
|
|
201
|
+
isStopResponseEnabled: q,
|
|
203
202
|
items: T,
|
|
204
|
-
onFeedbackFormSubmit:
|
|
205
|
-
onUserIntentToUseAI:
|
|
203
|
+
onFeedbackFormSubmit: U,
|
|
204
|
+
onUserIntentToUseAI: x,
|
|
206
205
|
questions: h,
|
|
207
206
|
recordAction: S,
|
|
208
207
|
shouldShowLandingPage: s.shouldShowLandingPage,
|
|
@@ -210,28 +209,27 @@ function Re(B) {
|
|
|
210
209
|
stopQuestion: v,
|
|
211
210
|
submitQuestion: m,
|
|
212
211
|
variant: "sidebar",
|
|
213
|
-
...
|
|
212
|
+
...P
|
|
214
213
|
})
|
|
215
214
|
})
|
|
216
|
-
}), /* @__PURE__ */ e(
|
|
217
|
-
contentName:
|
|
218
|
-
contentType: f(
|
|
219
|
-
extension:
|
|
215
|
+
}), /* @__PURE__ */ e(le, {
|
|
216
|
+
contentName: O,
|
|
217
|
+
contentType: f(C.sidebarBoxAIContent),
|
|
218
|
+
extension: V,
|
|
220
219
|
getAIStudioAgents: A,
|
|
221
220
|
hasRequestInProgress: l,
|
|
222
221
|
hostAppName: r,
|
|
223
222
|
isAIStudioAgentSelectorEnabled: c,
|
|
224
|
-
isFeedbackEnabled:
|
|
225
|
-
isFeedbackFormEnabled:
|
|
226
|
-
|
|
227
|
-
isStopResponseEnabled: U,
|
|
223
|
+
isFeedbackEnabled: R,
|
|
224
|
+
isFeedbackFormEnabled: k,
|
|
225
|
+
isStopResponseEnabled: q,
|
|
228
226
|
items: T,
|
|
229
|
-
itemSize:
|
|
227
|
+
itemSize: Q,
|
|
230
228
|
onClearAction: d,
|
|
231
|
-
onFeedbackFormSubmit:
|
|
232
|
-
onOpenChange:
|
|
233
|
-
onSelectAgent:
|
|
234
|
-
onUserIntentToUseAI:
|
|
229
|
+
onFeedbackFormSubmit: U,
|
|
230
|
+
onOpenChange: J,
|
|
231
|
+
onSelectAgent: g,
|
|
232
|
+
onUserIntentToUseAI: x,
|
|
235
233
|
open: w,
|
|
236
234
|
questions: h,
|
|
237
235
|
recordAction: w ? S : void 0,
|
|
@@ -241,12 +239,12 @@ function Re(B) {
|
|
|
241
239
|
stopQuestion: v,
|
|
242
240
|
submitQuestion: m,
|
|
243
241
|
variant: "collapsible",
|
|
244
|
-
...
|
|
242
|
+
...P,
|
|
245
243
|
shouldRenderProviders: !1
|
|
246
244
|
})]
|
|
247
245
|
});
|
|
248
246
|
}
|
|
249
|
-
const
|
|
247
|
+
const Ke = ae(Oe);
|
|
250
248
|
export {
|
|
251
|
-
|
|
249
|
+
Ke as default
|
|
252
250
|
};
|
|
@@ -16,8 +16,6 @@ export type IntelligenceModalProps = ModalProps & Omit<BoxAiContentAnswersProps,
|
|
|
16
16
|
isAIStudioAgentSelectorEnabled?: boolean;
|
|
17
17
|
/** Flag to enable or disable the debug mode via CTRL+SHIFT+X */
|
|
18
18
|
isDebugModeEnabled?: boolean;
|
|
19
|
-
/** Flag to enable or disable the reset chat button */
|
|
20
|
-
isResetChatEnabled?: boolean;
|
|
21
19
|
isStopResponseEnabled?: boolean;
|
|
22
20
|
/** Extension of the item used for QA. This is used for log purposes */
|
|
23
21
|
extension?: string;
|
|
@@ -25,7 +25,6 @@ export interface IntelligenceSidebarProps {
|
|
|
25
25
|
isFeedbackFormEnabled: boolean;
|
|
26
26
|
isIntelligentQueryMode: boolean;
|
|
27
27
|
isMarkdownEnabled: boolean;
|
|
28
|
-
isResetChatEnabled: boolean;
|
|
29
28
|
isStopResponseEnabled?: boolean;
|
|
30
29
|
isStreamingEnabled: boolean;
|
|
31
30
|
items: Array<ItemType>;
|
|
@@ -49,7 +49,6 @@ export declare const defaultIntelligenceSidebarProps: {
|
|
|
49
49
|
};
|
|
50
50
|
isCitationsEnabled: boolean;
|
|
51
51
|
isAIStudioAgentSelectorEnabled: boolean;
|
|
52
|
-
isResetChatEnabled: boolean;
|
|
53
52
|
isFeedbackEnabled: boolean;
|
|
54
53
|
};
|
|
55
54
|
export declare const DefaultIntelligenceSidebar: (props: IntelligenceSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.132.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.35.0",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.17.
|
|
21
|
-
"@box/blueprint-web-assets": "^4.
|
|
22
|
-
"@box/box-ai-agent-selector": "^0.44.
|
|
23
|
-
"@box/item-icon": "^0.9.
|
|
24
|
-
"@box/storybook-utils": "^0.13.
|
|
20
|
+
"@box/blueprint-web": "^12.17.1",
|
|
21
|
+
"@box/blueprint-web-assets": "^4.55.0",
|
|
22
|
+
"@box/box-ai-agent-selector": "^0.44.2",
|
|
23
|
+
"@box/item-icon": "^0.9.169",
|
|
24
|
+
"@box/storybook-utils": "^0.13.8",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|
|
27
27
|
"react-dom": "^18.3.0",
|