@box/box-ai-content-answers 0.93.1 → 0.94.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.
|
@@ -1,151 +1,157 @@
|
|
|
1
|
-
import { useBreakpoint as
|
|
2
|
-
import { ArrowsCollapse as
|
|
3
|
-
import { BoxAiLogo as
|
|
4
|
-
import { Size8 as
|
|
5
|
-
import { BoxAiAgentSelectorWithApi as
|
|
6
|
-
import
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import { BoxAiContentAnswers as
|
|
9
|
-
import { AgentsProvider as
|
|
10
|
-
import { A as
|
|
11
|
-
import { AgentSelector as
|
|
12
|
-
import { LOGGER_BASE_CONFIG as
|
|
13
|
-
import { s as t, C as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
1
|
+
import { useBreakpoint as V, Breakpoint as X, Modal as i, Text as Y, TooltipProvider as Z, Tooltip as ee } from "@box/blueprint-web";
|
|
2
|
+
import { ArrowsCollapse as oe } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { BoxAiLogo as te } from "@box/blueprint-web-assets/icons/Logo";
|
|
4
|
+
import { Size8 as x } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import { BoxAiAgentSelectorWithApi as se, AgentsProvider as ae } from "@box/box-ai-agent-selector";
|
|
6
|
+
import { useState as re, useCallback as B, useEffect as C } from "react";
|
|
7
|
+
import { useIntl as le } from "react-intl";
|
|
8
|
+
import { BoxAiContentAnswers as ne } from "../../box-ai-content-answers.js";
|
|
9
|
+
import { AgentsProvider as ie } from "../../contexts/AgentsContext.js";
|
|
10
|
+
import { A as ce, R as de } from "../../../../chunks/types.js";
|
|
11
|
+
import { AgentSelector as me } from "../agents/agent-selector.js";
|
|
12
|
+
import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as fe } from "../common/constants.js";
|
|
13
|
+
import { s as t, C as ge } from "../../../../chunks/clear-conversation-button.js";
|
|
14
|
+
import Ce from "./hooks/useStopPropagationOnEsc.js";
|
|
15
|
+
import u from "./messages.js";
|
|
16
16
|
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
17
|
-
const
|
|
18
|
-
children:
|
|
19
|
-
getAIStudioAgents:
|
|
20
|
-
hasCustomSuggestedQuestions:
|
|
21
|
-
hostAppName:
|
|
22
|
-
isAgentSelectorEnabled:
|
|
23
|
-
isAIStudioAgentSelectorEnabled:
|
|
17
|
+
const _e = ({
|
|
18
|
+
children: S,
|
|
19
|
+
getAIStudioAgents: M,
|
|
20
|
+
hasCustomSuggestedQuestions: _,
|
|
21
|
+
hostAppName: c,
|
|
22
|
+
isAgentSelectorEnabled: T,
|
|
23
|
+
isAIStudioAgentSelectorEnabled: d,
|
|
24
24
|
isDebugModeEnabled: k,
|
|
25
|
-
isResetChatEnabled:
|
|
26
|
-
isStopResponseEnabled:
|
|
27
|
-
itemSize:
|
|
28
|
-
extension:
|
|
29
|
-
onClearAction:
|
|
30
|
-
onSelectAgent:
|
|
25
|
+
isResetChatEnabled: P,
|
|
26
|
+
isStopResponseEnabled: G = !1,
|
|
27
|
+
itemSize: A,
|
|
28
|
+
extension: v,
|
|
29
|
+
onClearAction: O,
|
|
30
|
+
onSelectAgent: q,
|
|
31
31
|
recordAction: a,
|
|
32
|
-
shouldRenderProviders:
|
|
33
|
-
stopPropagationOnEsc:
|
|
34
|
-
variant:
|
|
35
|
-
items:
|
|
36
|
-
parentItem:
|
|
37
|
-
...
|
|
32
|
+
shouldRenderProviders: H = !0,
|
|
33
|
+
stopPropagationOnEsc: z,
|
|
34
|
+
variant: F = "closable",
|
|
35
|
+
items: l,
|
|
36
|
+
parentItem: n,
|
|
37
|
+
...I
|
|
38
38
|
}) => {
|
|
39
|
-
var
|
|
39
|
+
var b, E;
|
|
40
40
|
const {
|
|
41
|
-
open:
|
|
42
|
-
defaultOpen:
|
|
43
|
-
onOpenChange:
|
|
44
|
-
modal:
|
|
41
|
+
open: N,
|
|
42
|
+
defaultOpen: j,
|
|
43
|
+
onOpenChange: Q,
|
|
44
|
+
modal: U,
|
|
45
45
|
...r
|
|
46
|
-
} =
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
a && (o.data ?? (o.data = {}), o.data.hostAppName =
|
|
50
|
-
}, [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
...
|
|
46
|
+
} = I, m = le(), W = V() <= X.Medium;
|
|
47
|
+
Ce(z, N);
|
|
48
|
+
const f = (E = (b = r == null ? void 0 : r.questions) == null ? void 0 : b[r.questions.length - 1]) == null ? void 0 : E.error, [y, R] = re(!1), g = F === "collapsible", w = g ? u.collapseModalAriaLabel : u.closeModalAriaLabel, D = g ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", K = g ? oe : void 0, s = B((o) => {
|
|
49
|
+
a && (o.data ?? (o.data = {}), o.data.hostAppName = c, a(o));
|
|
50
|
+
}, [c, a]);
|
|
51
|
+
C(() => {
|
|
52
|
+
l || s({
|
|
53
|
+
...p,
|
|
54
54
|
target: "loaded",
|
|
55
55
|
data: {
|
|
56
|
-
fileSize:
|
|
57
|
-
fileType:
|
|
56
|
+
fileSize: A,
|
|
57
|
+
fileType: v
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
}, [s,
|
|
61
|
-
|
|
62
|
-
...
|
|
60
|
+
}, [s, v, A, l, a]), C(() => {
|
|
61
|
+
l && s({
|
|
62
|
+
...p,
|
|
63
63
|
target: "loaded",
|
|
64
64
|
data: {
|
|
65
|
-
parentItemType:
|
|
66
|
-
items:
|
|
65
|
+
parentItemType: n == null ? void 0 : n.type,
|
|
66
|
+
items: l.map((o) => ({
|
|
67
67
|
status: o.status,
|
|
68
68
|
fileType: o.fileType
|
|
69
69
|
}))
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
}, [s,
|
|
73
|
-
|
|
74
|
-
}, [
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
action:
|
|
72
|
+
}, [s, n, a]), C(() => {
|
|
73
|
+
f && f === ce.AGENT_NOT_FOUND && R(!0);
|
|
74
|
+
}, [f]);
|
|
75
|
+
const $ = () => {
|
|
76
|
+
O && (O(), s({
|
|
77
|
+
...p,
|
|
78
|
+
action: fe,
|
|
79
79
|
target: "clearChat"
|
|
80
80
|
}));
|
|
81
|
-
},
|
|
82
|
-
defaultOpen:
|
|
83
|
-
modal:
|
|
84
|
-
onOpenChange:
|
|
85
|
-
open:
|
|
86
|
-
children: [/* @__PURE__ */ e(
|
|
87
|
-
children:
|
|
88
|
-
}), /* @__PURE__ */ h(
|
|
81
|
+
}, J = B(async () => (R(!1), M()), [M]), L = /* @__PURE__ */ h(i, {
|
|
82
|
+
defaultOpen: j,
|
|
83
|
+
modal: U,
|
|
84
|
+
onOpenChange: Q,
|
|
85
|
+
open: N,
|
|
86
|
+
children: [/* @__PURE__ */ e(i.Trigger, {
|
|
87
|
+
children: S
|
|
88
|
+
}), /* @__PURE__ */ h(i.Content, {
|
|
89
89
|
className: t.contentAnswersModal,
|
|
90
90
|
"data-testid": "content-answers-modal",
|
|
91
91
|
size: "xlarge",
|
|
92
|
-
children: [/* @__PURE__ */ e(
|
|
92
|
+
children: [/* @__PURE__ */ e(i.Header, {
|
|
93
93
|
className: t.modalHeaderContainer,
|
|
94
94
|
children: /* @__PURE__ */ h("div", {
|
|
95
95
|
className: t.modalHeader,
|
|
96
|
-
children: [!
|
|
96
|
+
children: [!W && /* @__PURE__ */ e(te, {
|
|
97
97
|
className: t.BoxAIIconColor,
|
|
98
98
|
"data-testid": "content-answers-icon-color",
|
|
99
|
-
height:
|
|
100
|
-
width:
|
|
101
|
-
}), /* @__PURE__ */ e(
|
|
99
|
+
height: x,
|
|
100
|
+
width: x
|
|
101
|
+
}), /* @__PURE__ */ e(Y, {
|
|
102
102
|
as: "span",
|
|
103
103
|
variant: "titleMedium",
|
|
104
|
-
children:
|
|
105
|
-
}), !
|
|
106
|
-
onSelectAgent:
|
|
104
|
+
children: m.formatMessage(u.contentAnswersTitle)
|
|
105
|
+
}), !d && T && /* @__PURE__ */ e(me, {
|
|
106
|
+
onSelectAgent: q,
|
|
107
107
|
recordAction: s
|
|
108
|
-
}),
|
|
108
|
+
}), d && /* @__PURE__ */ e(se, {
|
|
109
109
|
contentClassName: t.agentSelectorContent,
|
|
110
110
|
disabled: r.hasRequestInProgress,
|
|
111
|
-
fetcher:
|
|
112
|
-
hostAppName:
|
|
111
|
+
fetcher: J,
|
|
112
|
+
hostAppName: c,
|
|
113
113
|
recordAction: a,
|
|
114
|
-
requestState:
|
|
114
|
+
requestState: y ? de.ERROR : void 0,
|
|
115
115
|
shouldHideAgentSelectorOnLoad: !0,
|
|
116
116
|
triggerChipClassName: t.agentSelectorTrigger
|
|
117
117
|
})]
|
|
118
118
|
})
|
|
119
|
-
}), /* @__PURE__ */ e(
|
|
119
|
+
}), /* @__PURE__ */ e(ne, {
|
|
120
120
|
className: t.boxAiContentAnswers,
|
|
121
|
-
hasCustomSuggestedQuestions:
|
|
122
|
-
hostAppName:
|
|
123
|
-
isAgentSelectorEnabled: !
|
|
124
|
-
isAIStudioAgentSelectorEnabled:
|
|
121
|
+
hasCustomSuggestedQuestions: _,
|
|
122
|
+
hostAppName: c,
|
|
123
|
+
isAgentSelectorEnabled: !d && T,
|
|
124
|
+
isAIStudioAgentSelectorEnabled: d,
|
|
125
125
|
isDebugModeEnabled: k,
|
|
126
|
-
isStopResponseEnabled:
|
|
127
|
-
items:
|
|
128
|
-
parentItem:
|
|
126
|
+
isStopResponseEnabled: G,
|
|
127
|
+
items: l,
|
|
128
|
+
parentItem: n,
|
|
129
129
|
recordAction: s,
|
|
130
130
|
...r
|
|
131
|
-
}),
|
|
132
|
-
onClick:
|
|
133
|
-
}), /* @__PURE__ */ e(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
}), P && /* @__PURE__ */ e(ge, {
|
|
132
|
+
onClick: $
|
|
133
|
+
}), /* @__PURE__ */ e(Z, {
|
|
134
|
+
children: /* @__PURE__ */ e(ee, {
|
|
135
|
+
content: m.formatMessage(w),
|
|
136
|
+
"data-testid": "content-answers-close-modal-tooltip",
|
|
137
|
+
children: /* @__PURE__ */ e(i.Close, {
|
|
138
|
+
"aria-label": m.formatMessage(w),
|
|
139
|
+
className: t["modal-close-button"],
|
|
140
|
+
"data-target-id": D,
|
|
141
|
+
icon: K,
|
|
142
|
+
size: "small"
|
|
143
|
+
})
|
|
144
|
+
})
|
|
139
145
|
})]
|
|
140
146
|
})]
|
|
141
147
|
});
|
|
142
|
-
return
|
|
143
|
-
children: /* @__PURE__ */ e(
|
|
144
|
-
children:
|
|
148
|
+
return H ? /* @__PURE__ */ e(ae, {
|
|
149
|
+
children: /* @__PURE__ */ e(ie, {
|
|
150
|
+
children: L
|
|
145
151
|
})
|
|
146
|
-
}) :
|
|
152
|
+
}) : L;
|
|
147
153
|
};
|
|
148
154
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
155
|
+
_e as IntelligenceModal,
|
|
156
|
+
_e as default
|
|
151
157
|
};
|
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
import { FilterChip as
|
|
2
|
-
import
|
|
3
|
-
import { jsx as
|
|
4
|
-
import '../../../../styles/suggestions.css';const c = "_suggestions_z97no_1", u = "_sidebar_z97no_6", m = "_suggestion_z97no_1",
|
|
1
|
+
import { FilterChip as o } from "@box/blueprint-web";
|
|
2
|
+
import p from "clsx";
|
|
3
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
4
|
+
import '../../../../styles/suggestions.css';const c = "_suggestions_z97no_1", u = "_sidebar_z97no_6", m = "_suggestion_z97no_1", t = {
|
|
5
5
|
suggestions: c,
|
|
6
6
|
sidebar: u,
|
|
7
7
|
suggestion: m
|
|
8
|
-
},
|
|
9
|
-
askSuggestedQuestion:
|
|
10
|
-
isLoading:
|
|
11
|
-
onSuggestedQuestionClick:
|
|
8
|
+
}, y = ({
|
|
9
|
+
askSuggestedQuestion: r,
|
|
10
|
+
isLoading: i,
|
|
11
|
+
onSuggestedQuestionClick: a,
|
|
12
12
|
suggestedQuestions: g,
|
|
13
13
|
variant: d = "modal"
|
|
14
|
-
}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
}) => {
|
|
15
|
+
const l = (s) => {
|
|
16
|
+
(s.key === "ArrowUp" || s.key === "ArrowDown" || s.key === "ArrowLeft" || s.key === "ArrowRight") && s.stopPropagation();
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ e(o.Group, {
|
|
19
|
+
className: p(t.suggestions, d === "sidebar" && t.sidebar),
|
|
20
|
+
"data-testid": "content-answers-suggested-questions",
|
|
21
|
+
name: "Singleselect SuggestedQuestions",
|
|
22
|
+
onKeyDown: l,
|
|
23
|
+
type: "single",
|
|
24
|
+
value: r,
|
|
25
|
+
children: g.map((s) => {
|
|
26
|
+
const n = s.label || s.prompt;
|
|
27
|
+
return /* @__PURE__ */ e(o.ChipButton, {
|
|
28
|
+
className: t.suggestion,
|
|
29
|
+
"data-testid": `content-answers-${s.id}`,
|
|
30
|
+
disabled: i,
|
|
31
|
+
onClick: () => a(s.prompt),
|
|
32
|
+
value: n,
|
|
33
|
+
children: /* @__PURE__ */ e(o.Label, {
|
|
34
|
+
children: n
|
|
35
|
+
})
|
|
36
|
+
}, s.id);
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
34
40
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
y as Suggestions,
|
|
42
|
+
y as default
|
|
37
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
19
19
|
"@box/blueprint-web": "^9.18.0",
|
|
20
20
|
"@box/blueprint-web-assets": "^4.33.1",
|
|
21
|
-
"@box/box-ai-agent-selector": "^0.26.
|
|
21
|
+
"@box/box-ai-agent-selector": "^0.26.2",
|
|
22
22
|
"@box/item-icon": "^0.9.82",
|
|
23
23
|
"@box/storybook-utils": "^0.8.3",
|
|
24
24
|
"@testing-library/react": "^15.0.6",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"**/*.css"
|
|
58
58
|
],
|
|
59
59
|
"license": "SEE LICENSE IN LICENSE",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "fae9c2ce73dd9a0d9ca6827dcd7a5264441041d4"
|
|
61
61
|
}
|