@box/box-ai-content-answers 0.148.4 → 0.148.5
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,32 +1,34 @@
|
|
|
1
|
-
import { Tooltip as
|
|
2
|
-
import { Trash as
|
|
3
|
-
import { useIntl as
|
|
1
|
+
import { Tooltip as r, IconButton as l } from "@box/blueprint-web";
|
|
2
|
+
import { Trash as s } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { useIntl as c } from "react-intl";
|
|
4
4
|
import t from "../esm/lib/components/modal/messages.js";
|
|
5
5
|
import { jsx as e } from "react/jsx-runtime";
|
|
6
|
-
import '../styles/clear-conversation-button.css';const
|
|
7
|
-
BoxAIIconColor:
|
|
8
|
-
modalHeader:
|
|
9
|
-
contentAnswersModal:
|
|
10
|
-
boxAiContentAnswers:
|
|
11
|
-
clearButton:
|
|
6
|
+
import '../styles/clear-conversation-button.css';const i = "_BoxAIIconColor_ild3b_1", d = "_modalHeader_ild3b_5", _ = "_contentAnswersModal_ild3b_10", m = "_boxAiContentAnswers_ild3b_18", b = "_clearButton_ild3b_26", C = "_contentAnswerModal_ild3b_1", g = "_modalHeaderContainer_ild3b_55", A = "_agentSelectorTrigger_ild3b_63", u = "_agentSelectorContent_ild3b_74", B = {
|
|
7
|
+
BoxAIIconColor: i,
|
|
8
|
+
modalHeader: d,
|
|
9
|
+
contentAnswersModal: _,
|
|
10
|
+
boxAiContentAnswers: m,
|
|
11
|
+
clearButton: b,
|
|
12
12
|
"modal-close-button": "_modal-close-button_ild3b_30",
|
|
13
|
-
contentAnswerModal:
|
|
14
|
-
modalHeaderContainer:
|
|
15
|
-
agentSelectorTrigger:
|
|
16
|
-
agentSelectorContent:
|
|
17
|
-
},
|
|
18
|
-
onClick: n
|
|
13
|
+
contentAnswerModal: C,
|
|
14
|
+
modalHeaderContainer: g,
|
|
15
|
+
agentSelectorTrigger: A,
|
|
16
|
+
agentSelectorContent: u
|
|
17
|
+
}, f = ({
|
|
18
|
+
onClick: n,
|
|
19
|
+
hasRequestInProgress: a
|
|
19
20
|
}) => {
|
|
20
|
-
const o =
|
|
21
|
-
return /* @__PURE__ */ e(
|
|
21
|
+
const o = c();
|
|
22
|
+
return /* @__PURE__ */ e(r, {
|
|
22
23
|
content: o.formatMessage(t.clearConversationLabel),
|
|
23
24
|
"data-testid": "clear-conversation-tooltip",
|
|
24
25
|
variant: "standard",
|
|
25
|
-
children: /* @__PURE__ */ e(
|
|
26
|
+
children: /* @__PURE__ */ e(l, {
|
|
26
27
|
"aria-label": o.formatMessage(t.clearConversationLabel),
|
|
27
|
-
className:
|
|
28
|
+
className: B.clearButton,
|
|
28
29
|
"data-testid": "clear-conversation-button",
|
|
29
|
-
|
|
30
|
+
disabled: a,
|
|
31
|
+
icon: s,
|
|
30
32
|
onClick: n,
|
|
31
33
|
size: "small",
|
|
32
34
|
"data-target-id": "IconButton-clearConversationLabel"
|
|
@@ -34,6 +36,6 @@ import '../styles/clear-conversation-button.css';const c = "_BoxAIIconColor_ild3
|
|
|
34
36
|
});
|
|
35
37
|
};
|
|
36
38
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
f as C,
|
|
40
|
+
B as s
|
|
39
41
|
};
|
|
@@ -3,7 +3,7 @@ import { ArrowsCollapse as $ } from "@box/blueprint-web-assets/icons/Fill";
|
|
|
3
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
5
|
import { BoxAiAgentSelectorWithApi as oe, AgentsProvider as te } from "@box/box-ai-agent-selector";
|
|
6
|
-
import { useState as se, useMemo as ae, useCallback as
|
|
6
|
+
import { useState as se, useMemo as ae, useCallback as I, useEffect as C } from "react";
|
|
7
7
|
import { useIntl as le } from "react-intl";
|
|
8
8
|
import { BoxAiContentAnswers as re } from "../../box-ai-content-answers.js";
|
|
9
9
|
import { A as ne, R as ie } from "../../../../chunks/types.js";
|
|
@@ -11,53 +11,53 @@ import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as de } from "../common/co
|
|
|
11
11
|
import { s, C as ce } from "../../../../chunks/clear-conversation-button.js";
|
|
12
12
|
import me from "./hooks/useStopPropagationOnEsc.js";
|
|
13
13
|
import { Title as fe } from "./title.js";
|
|
14
|
-
import
|
|
14
|
+
import S from "./messages.js";
|
|
15
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 ?
|
|
17
|
-
const
|
|
16
|
+
const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", ue = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel, Ce = (o) => o ? $ : void 0, pe = (o) => {
|
|
17
|
+
const l = o === "collapsible";
|
|
18
18
|
return {
|
|
19
|
-
closeModalLabel: ue(
|
|
20
|
-
closeModalTargetId: ge(
|
|
21
|
-
closeModalIcon: Ce(
|
|
19
|
+
closeModalLabel: ue(l),
|
|
20
|
+
closeModalTargetId: ge(l),
|
|
21
|
+
closeModalIcon: Ce(l)
|
|
22
22
|
};
|
|
23
23
|
}, _e = ({
|
|
24
24
|
children: o,
|
|
25
|
-
getAIStudioAgents:
|
|
26
|
-
hasCustomSuggestedQuestions:
|
|
25
|
+
getAIStudioAgents: l,
|
|
26
|
+
hasCustomSuggestedQuestions: x,
|
|
27
27
|
hostAppName: m,
|
|
28
28
|
isAIStudioAgentSelectorEnabled: f = !1,
|
|
29
|
-
isDebugModeEnabled:
|
|
29
|
+
isDebugModeEnabled: B,
|
|
30
30
|
isStopResponseEnabled: _ = !1,
|
|
31
31
|
itemSize: h,
|
|
32
32
|
extension: T,
|
|
33
33
|
onClearAction: g,
|
|
34
34
|
onSelectAgent: k,
|
|
35
|
-
onSelectedAgentCallback:
|
|
36
|
-
recordAction:
|
|
37
|
-
shouldRenderProviders:
|
|
38
|
-
shouldShowLandingPage:
|
|
35
|
+
onSelectedAgentCallback: P,
|
|
36
|
+
recordAction: r,
|
|
37
|
+
shouldRenderProviders: q = !0,
|
|
38
|
+
shouldShowLandingPage: G = !1,
|
|
39
39
|
stopPropagationOnEsc: H,
|
|
40
|
-
variant:
|
|
40
|
+
variant: R = "closable",
|
|
41
41
|
items: i,
|
|
42
42
|
parentItem: d,
|
|
43
43
|
...z
|
|
44
44
|
}) => {
|
|
45
45
|
var E, v;
|
|
46
46
|
const {
|
|
47
|
-
open:
|
|
47
|
+
open: b,
|
|
48
48
|
defaultOpen: F,
|
|
49
49
|
onOpenChange: j,
|
|
50
50
|
modal: D,
|
|
51
|
-
...
|
|
52
|
-
} = z,
|
|
53
|
-
me(H,
|
|
54
|
-
const u = (v = (E =
|
|
55
|
-
closeModalLabel:
|
|
51
|
+
...a
|
|
52
|
+
} = z, L = le(), Q = V() <= X.Medium;
|
|
53
|
+
me(H, b);
|
|
54
|
+
const u = (v = (E = a == null ? void 0 : a.questions) == null ? void 0 : E[a.questions.length - 1]) == null ? void 0 : v.error, [U, O] = se(!1), {
|
|
55
|
+
closeModalLabel: A,
|
|
56
56
|
closeModalTargetId: W,
|
|
57
57
|
closeModalIcon: y
|
|
58
|
-
} = ae(() => pe(
|
|
59
|
-
|
|
60
|
-
}, [m,
|
|
58
|
+
} = ae(() => pe(R), [R]), n = I((t) => {
|
|
59
|
+
r && (t.data ?? (t.data = {}), t.data.hostAppName = m, r(t));
|
|
60
|
+
}, [m, r]);
|
|
61
61
|
C(() => {
|
|
62
62
|
i || n({
|
|
63
63
|
...p,
|
|
@@ -67,7 +67,7 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
67
67
|
fileType: T
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
}, [n, T, h, i,
|
|
70
|
+
}, [n, T, h, i, r]), C(() => {
|
|
71
71
|
i && n({
|
|
72
72
|
...p,
|
|
73
73
|
target: "loaded",
|
|
@@ -79,8 +79,8 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
79
79
|
}))
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
}, [n, d,
|
|
83
|
-
u && u === ne.AGENT_NOT_FOUND &&
|
|
82
|
+
}, [n, d, r]), C(() => {
|
|
83
|
+
u && u === ne.AGENT_NOT_FOUND && O(!0);
|
|
84
84
|
}, [u]);
|
|
85
85
|
const K = () => {
|
|
86
86
|
g && (g(), n({
|
|
@@ -88,11 +88,11 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
88
88
|
action: de,
|
|
89
89
|
target: "clearChat"
|
|
90
90
|
}));
|
|
91
|
-
}, J =
|
|
91
|
+
}, J = I(async () => (O(!1), l()), [l]), N = /* @__PURE__ */ M(c, {
|
|
92
92
|
defaultOpen: F,
|
|
93
93
|
modal: D,
|
|
94
94
|
onOpenChange: j,
|
|
95
|
-
open:
|
|
95
|
+
open: b,
|
|
96
96
|
children: [/* @__PURE__ */ e(c.Trigger, {
|
|
97
97
|
children: o
|
|
98
98
|
}), /* @__PURE__ */ M(c.Content, {
|
|
@@ -112,12 +112,12 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
112
112
|
isAIStudioAgentSelectorEnabled: f
|
|
113
113
|
}), f && /* @__PURE__ */ e(oe, {
|
|
114
114
|
contentClassName: s.agentSelectorContent,
|
|
115
|
-
disabled:
|
|
115
|
+
disabled: a.hasRequestInProgress,
|
|
116
116
|
fetcher: J,
|
|
117
117
|
hostAppName: m,
|
|
118
118
|
onSelectAgent: k,
|
|
119
|
-
onSelectedAgentCallback:
|
|
120
|
-
recordAction:
|
|
119
|
+
onSelectedAgentCallback: P,
|
|
120
|
+
recordAction: r,
|
|
121
121
|
requestState: U ? ie.ERROR : void 0,
|
|
122
122
|
shouldHideAgentSelectorOnLoad: !0,
|
|
123
123
|
triggerChipClassName: s.agentSelectorTrigger
|
|
@@ -125,24 +125,25 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
125
125
|
})
|
|
126
126
|
}), /* @__PURE__ */ e(re, {
|
|
127
127
|
className: s.boxAiContentAnswers,
|
|
128
|
-
hasCustomSuggestedQuestions:
|
|
128
|
+
hasCustomSuggestedQuestions: x,
|
|
129
129
|
hostAppName: m,
|
|
130
130
|
isAIStudioAgentSelectorEnabled: f,
|
|
131
|
-
isDebugModeEnabled:
|
|
131
|
+
isDebugModeEnabled: B,
|
|
132
132
|
isStopResponseEnabled: _,
|
|
133
133
|
items: i,
|
|
134
134
|
parentItem: d,
|
|
135
135
|
recordAction: n,
|
|
136
|
-
shouldShowLandingPage:
|
|
137
|
-
...
|
|
136
|
+
shouldShowLandingPage: G,
|
|
137
|
+
...a
|
|
138
138
|
}), g && /* @__PURE__ */ e(ce, {
|
|
139
|
+
hasRequestInProgress: a.hasRequestInProgress,
|
|
139
140
|
onClick: K
|
|
140
141
|
}), /* @__PURE__ */ e(Y, {
|
|
141
142
|
children: /* @__PURE__ */ e(Z, {
|
|
142
|
-
content:
|
|
143
|
+
content: L.formatMessage(A),
|
|
143
144
|
"data-testid": "content-answers-close-modal-tooltip",
|
|
144
145
|
children: /* @__PURE__ */ e(c.Close, {
|
|
145
|
-
"aria-label":
|
|
146
|
+
"aria-label": L.formatMessage(A),
|
|
146
147
|
className: s["modal-close-button"],
|
|
147
148
|
"data-target-id": W,
|
|
148
149
|
icon: y,
|
|
@@ -152,9 +153,9 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
152
153
|
})]
|
|
153
154
|
})]
|
|
154
155
|
});
|
|
155
|
-
return
|
|
156
|
-
children:
|
|
157
|
-
}) :
|
|
156
|
+
return q ? /* @__PURE__ */ e(te, {
|
|
157
|
+
children: N
|
|
158
|
+
}) : N;
|
|
158
159
|
};
|
|
159
160
|
export {
|
|
160
161
|
_e as IntelligenceModal,
|
|
@@ -40,30 +40,30 @@ const Le = ({
|
|
|
40
40
|
actions: B,
|
|
41
41
|
children: i,
|
|
42
42
|
className: n,
|
|
43
|
-
elementId:
|
|
43
|
+
elementId: l = "",
|
|
44
44
|
sidebarView: A = "",
|
|
45
|
-
title:
|
|
46
|
-
subheader:
|
|
47
|
-
...
|
|
45
|
+
title: r,
|
|
46
|
+
subheader: c,
|
|
47
|
+
...d
|
|
48
48
|
}) => {
|
|
49
|
-
const b = `${
|
|
49
|
+
const b = `${l}${l === "" ? "" : "_"}${A}`, g = `${b}-content`;
|
|
50
50
|
return /* @__PURE__ */ p("div", {
|
|
51
51
|
"aria-labelledby": b,
|
|
52
52
|
className: y(t.bcsContent, n),
|
|
53
53
|
"data-testid": "bcs-content",
|
|
54
54
|
id: g,
|
|
55
55
|
role: "tabpanel",
|
|
56
|
-
...
|
|
56
|
+
...d,
|
|
57
57
|
children: [/* @__PURE__ */ p("div", {
|
|
58
58
|
className: t.bcsContentHeader,
|
|
59
|
-
children: [
|
|
59
|
+
children: [r && /* @__PURE__ */ e(K, {
|
|
60
60
|
as: "h3",
|
|
61
61
|
className: t.bcsTitle,
|
|
62
|
-
children:
|
|
62
|
+
children: r
|
|
63
63
|
}), B]
|
|
64
|
-
}),
|
|
64
|
+
}), c && /* @__PURE__ */ e("div", {
|
|
65
65
|
className: t.bcsContentSubheader,
|
|
66
|
-
children:
|
|
66
|
+
children: c
|
|
67
67
|
}), /* @__PURE__ */ e("div", {
|
|
68
68
|
className: t.bcsScrollContentWrapper,
|
|
69
69
|
children: /* @__PURE__ */ e("div", {
|
|
@@ -77,11 +77,11 @@ function Oe(B) {
|
|
|
77
77
|
const {
|
|
78
78
|
createSession: i,
|
|
79
79
|
encodedSession: n,
|
|
80
|
-
onClearAction:
|
|
80
|
+
onClearAction: l,
|
|
81
81
|
getAIStudioAgents: A,
|
|
82
|
-
hasRequestInProgress:
|
|
83
|
-
hostAppName:
|
|
84
|
-
isAIStudioAgentSelectorEnabled:
|
|
82
|
+
hasRequestInProgress: r,
|
|
83
|
+
hostAppName: c,
|
|
84
|
+
isAIStudioAgentSelectorEnabled: d,
|
|
85
85
|
isLoading: b,
|
|
86
86
|
onSelectAgent: g,
|
|
87
87
|
questions: h,
|
|
@@ -148,13 +148,13 @@ function Oe(B) {
|
|
|
148
148
|
const G = () => /* @__PURE__ */ p("div", {
|
|
149
149
|
className: t.bcsBoxAISidebarTitlePart,
|
|
150
150
|
children: [/* @__PURE__ */ e(Se, {
|
|
151
|
-
isAIStudioAgentSelectorEnabled:
|
|
152
|
-
}),
|
|
151
|
+
isAIStudioAgentSelectorEnabled: d
|
|
152
|
+
}), d && /* @__PURE__ */ e("div", {
|
|
153
153
|
className: t.bcsBoxAISidebarAgentSelector,
|
|
154
154
|
children: /* @__PURE__ */ e(ne, {
|
|
155
|
-
disabled:
|
|
155
|
+
disabled: r,
|
|
156
156
|
fetcher: A,
|
|
157
|
-
hostAppName:
|
|
157
|
+
hostAppName: c,
|
|
158
158
|
onAgentsListOpen: x,
|
|
159
159
|
onSelectAgent: g,
|
|
160
160
|
onSelectedAgentCallback: D,
|
|
@@ -168,7 +168,8 @@ function Oe(B) {
|
|
|
168
168
|
children: [/* @__PURE__ */ e(Le, {
|
|
169
169
|
actions: /* @__PURE__ */ p($, {
|
|
170
170
|
children: [G(), /* @__PURE__ */ e(de, {
|
|
171
|
-
|
|
171
|
+
hasRequestInProgress: r,
|
|
172
|
+
onClick: l
|
|
172
173
|
}), /* @__PURE__ */ e(X, {
|
|
173
174
|
content: f(C.sidebarBoxAISwitchToModalView),
|
|
174
175
|
"data-testid": "content-answers-open-modal-tooltip",
|
|
@@ -194,8 +195,8 @@ function Oe(B) {
|
|
|
194
195
|
className: t.bcsBoxAISidebarContentAnswers,
|
|
195
196
|
contentName: O,
|
|
196
197
|
contentType: f(C.sidebarBoxAIContent),
|
|
197
|
-
hostAppName:
|
|
198
|
-
isAIStudioAgentSelectorEnabled:
|
|
198
|
+
hostAppName: c,
|
|
199
|
+
isAIStudioAgentSelectorEnabled: d,
|
|
199
200
|
isFeedbackEnabled: R,
|
|
200
201
|
isFeedbackFormEnabled: k,
|
|
201
202
|
isStopResponseEnabled: q,
|
|
@@ -217,15 +218,15 @@ function Oe(B) {
|
|
|
217
218
|
contentType: f(C.sidebarBoxAIContent),
|
|
218
219
|
extension: V,
|
|
219
220
|
getAIStudioAgents: A,
|
|
220
|
-
hasRequestInProgress:
|
|
221
|
-
hostAppName:
|
|
222
|
-
isAIStudioAgentSelectorEnabled:
|
|
221
|
+
hasRequestInProgress: r,
|
|
222
|
+
hostAppName: c,
|
|
223
|
+
isAIStudioAgentSelectorEnabled: d,
|
|
223
224
|
isFeedbackEnabled: R,
|
|
224
225
|
isFeedbackFormEnabled: k,
|
|
225
226
|
isStopResponseEnabled: q,
|
|
226
227
|
items: T,
|
|
227
228
|
itemSize: Q,
|
|
228
|
-
onClearAction:
|
|
229
|
+
onClearAction: l,
|
|
229
230
|
onFeedbackFormSubmit: U,
|
|
230
231
|
onOpenChange: J,
|
|
231
232
|
onSelectAgent: g,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface ClearConversationButtonProps {
|
|
2
2
|
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
3
|
+
hasRequestInProgress: boolean;
|
|
3
4
|
}
|
|
4
|
-
export declare const ClearConversationButton: ({ onClick }: ClearConversationButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const ClearConversationButton: ({ onClick, hasRequestInProgress }: ClearConversationButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
export default ClearConversationButton;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.148.
|
|
3
|
+
"version": "0.148.5",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.56.1",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.64.
|
|
20
|
+
"@box/blueprint-web": "^12.64.4",
|
|
21
21
|
"@box/blueprint-web-assets": "^4.65.0",
|
|
22
|
-
"@box/box-ai-agent-selector": "^0.58.
|
|
23
|
-
"@box/item-icon": "^0.23.
|
|
22
|
+
"@box/box-ai-agent-selector": "^0.58.5",
|
|
23
|
+
"@box/item-icon": "^0.23.5",
|
|
24
24
|
"@box/storybook-utils": "^0.14.1",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|