@box/box-ai-agent-selector 0.12.3 → 0.13.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/esm/index.js +13 -9
- package/esm/lib/box-ai-agent-selector-with-api-container.js +16 -12
- package/esm/lib/box-ai-agent-selector-with-api.js +52 -40
- package/esm/lib/box-ai-agent-selector.js +96 -75
- package/esm/lib/box-ai-agent.js +35 -25
- package/package.json +3 -3
- package/styles/box-ai-agent-selector.css +1 -1
- package/types/index.d.ts +3 -1
- package/types/lib/box-ai-agent-selector-with-api-container.d.ts +2 -24
- package/types/lib/box-ai-agent-selector-with-api.d.ts +2 -24
- package/types/lib/box-ai-agent-selector.d.ts +2 -24
- package/types/lib/stories/shared.d.ts +7 -0
- package/types/lib/types.d.ts +49 -0
- package/types/lib/contexts/stories/shared.d.ts +0 -4
package/esm/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { BoxAiAgentSelector as t } from "./lib/box-ai-agent-selector.js";
|
|
2
|
+
import { BoxAiAgentSelectorWithApi as A } from "./lib/box-ai-agent-selector-with-api.js";
|
|
3
|
+
import { BoxAiAgentSelectorWithApiContainer as p } from "./lib/box-ai-agent-selector-with-api-container.js";
|
|
4
|
+
import { ACTIONS as n } from "./lib/contexts/actions.js";
|
|
5
|
+
import { AgentsProvider as f, useAgents as g, useAgentsDispatch as m } from "./lib/contexts/context.js";
|
|
6
|
+
import { R as c } from "../chunks/types.js";
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
n as ACTIONS,
|
|
9
|
+
f as AgentsProvider,
|
|
8
10
|
t as BoxAiAgentSelector,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
A as BoxAiAgentSelectorWithApi,
|
|
12
|
+
p as BoxAiAgentSelectorWithApiContainer,
|
|
13
|
+
c as REQUEST_STATE,
|
|
14
|
+
g as useAgents,
|
|
15
|
+
m as useAgentsDispatch
|
|
12
16
|
};
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import { BoxAiAgentSelectorWithApi as
|
|
2
|
-
import { AgentsProvider as
|
|
1
|
+
import { BoxAiAgentSelectorWithApi as m } from "./box-ai-agent-selector-with-api.js";
|
|
2
|
+
import { AgentsProvider as p } from "./contexts/context.js";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
-
function
|
|
4
|
+
function u({
|
|
5
5
|
fetcher: t,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
recordAction: i
|
|
6
|
+
hostAppName: e,
|
|
7
|
+
onSelectAgent: o,
|
|
8
|
+
recordAction: i,
|
|
9
|
+
requestState: n,
|
|
10
|
+
shouldHideAgentSelectorOnLoad: A = !0
|
|
9
11
|
}) {
|
|
10
|
-
return /* @__PURE__ */ r(
|
|
11
|
-
children: /* @__PURE__ */ r(
|
|
12
|
+
return /* @__PURE__ */ r(p, {
|
|
13
|
+
children: /* @__PURE__ */ r(m, {
|
|
12
14
|
fetcher: t,
|
|
13
|
-
hostAppName:
|
|
15
|
+
hostAppName: e,
|
|
16
|
+
onSelectAgent: o,
|
|
14
17
|
recordAction: i,
|
|
15
|
-
|
|
18
|
+
requestState: n,
|
|
19
|
+
shouldHideAgentSelectorOnLoad: A
|
|
16
20
|
})
|
|
17
21
|
});
|
|
18
22
|
}
|
|
19
23
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
u as BoxAiAgentSelectorWithApiContainer,
|
|
25
|
+
u as default
|
|
22
26
|
};
|
|
@@ -1,59 +1,71 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { BoxAiAgentSelector as
|
|
3
|
-
import { LOGGER_BASE_CONFIG as u, LOGGER_TARGET as
|
|
4
|
-
import { ACTIONS as
|
|
5
|
-
import { useAgentsDispatch as
|
|
6
|
-
import { R as
|
|
1
|
+
import { useState as p, useCallback as m, useEffect as f } from "react";
|
|
2
|
+
import { BoxAiAgentSelector as C } from "./box-ai-agent-selector.js";
|
|
3
|
+
import { LOGGER_BASE_CONFIG as u, LOGGER_TARGET as a } from "./constants.js";
|
|
4
|
+
import { ACTIONS as E } from "./contexts/actions.js";
|
|
5
|
+
import { useAgentsDispatch as O, useAgents as N } from "./contexts/context.js";
|
|
6
|
+
import { R as i } from "../../chunks/types.js";
|
|
7
7
|
import { jsx as h } from "react/jsx-runtime";
|
|
8
|
-
function
|
|
9
|
-
fetcher:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
recordAction:
|
|
8
|
+
function y({
|
|
9
|
+
fetcher: R,
|
|
10
|
+
hostAppName: _,
|
|
11
|
+
onSelectAgent: T,
|
|
12
|
+
recordAction: n,
|
|
13
|
+
requestState: s,
|
|
14
|
+
shouldHideAgentSelectorOnLoad: g
|
|
13
15
|
}) {
|
|
14
|
-
const e =
|
|
15
|
-
agents:
|
|
16
|
-
requestState:
|
|
17
|
-
selectedAgent:
|
|
18
|
-
} =
|
|
19
|
-
|
|
20
|
-
}, [
|
|
16
|
+
const e = O(), {
|
|
17
|
+
agents: c,
|
|
18
|
+
requestState: S,
|
|
19
|
+
selectedAgent: o
|
|
20
|
+
} = N(), [G, l] = p(!1), r = m((t) => {
|
|
21
|
+
n && (t.data ?? (t.data = {}), t.data.hostAppName = _, n(t));
|
|
22
|
+
}, [_, n]), A = m(async () => {
|
|
21
23
|
e({
|
|
22
|
-
type:
|
|
23
|
-
requestState:
|
|
24
|
+
type: E.SET_REQUEST_STATE,
|
|
25
|
+
requestState: i.IN_PROGRESS
|
|
24
26
|
});
|
|
25
27
|
try {
|
|
26
|
-
const t = await
|
|
28
|
+
const t = await R();
|
|
27
29
|
e({
|
|
28
|
-
type:
|
|
30
|
+
type: E.SET_AGENT_LIST,
|
|
29
31
|
agents: t.agents
|
|
30
|
-
}),
|
|
32
|
+
}), r({
|
|
31
33
|
...u,
|
|
32
|
-
target:
|
|
34
|
+
target: a.LOADED_AGENTS
|
|
33
35
|
});
|
|
34
36
|
} catch {
|
|
35
37
|
e({
|
|
36
|
-
type:
|
|
37
|
-
requestState:
|
|
38
|
-
}),
|
|
38
|
+
type: E.SET_REQUEST_STATE,
|
|
39
|
+
requestState: i.ERROR
|
|
40
|
+
}), r({
|
|
39
41
|
...u,
|
|
40
|
-
target:
|
|
42
|
+
target: a.ERROR_LOADING_AGENTS
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
|
-
}, [e,
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
}, [e, r, R]);
|
|
46
|
+
return f(() => {
|
|
47
|
+
A().finally(() => {
|
|
48
|
+
l(!0);
|
|
47
49
|
});
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
}, [A]), f(() => {
|
|
51
|
+
s && s !== S && (s !== i.SUCCESS && e({
|
|
52
|
+
type: E.SET_AGENT_LIST,
|
|
53
|
+
agents: []
|
|
54
|
+
}), e({
|
|
55
|
+
type: E.SET_REQUEST_STATE,
|
|
56
|
+
requestState: s
|
|
57
|
+
}));
|
|
58
|
+
}, [e, S, s]), f(() => {
|
|
59
|
+
T && T(o);
|
|
60
|
+
}, [T, o]), g && !G || S === i.SUCCESS && c.length <= 1 ? null : /* @__PURE__ */ h(C, {
|
|
61
|
+
agents: c,
|
|
62
|
+
onErrorAction: A,
|
|
63
|
+
recordAction: r,
|
|
64
|
+
requestState: S,
|
|
65
|
+
selectedAgent: o
|
|
54
66
|
});
|
|
55
67
|
}
|
|
56
68
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
y as BoxAiAgentSelectorWithApi,
|
|
70
|
+
y as default
|
|
59
71
|
};
|
|
@@ -1,107 +1,128 @@
|
|
|
1
1
|
import "../../styles/box-ai-agent-selector.css";
|
|
2
|
-
import { FilterChip as
|
|
3
|
-
import { AlertBadge as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { BoxAiAgent as
|
|
7
|
-
import { LOGGER_BASE_CONFIG as
|
|
8
|
-
import { ACTIONS as
|
|
9
|
-
import { useAgentsDispatch as
|
|
2
|
+
import { useFullTextTooltip as B, FilterChip as c, Popover as p, Tooltip as v, Status as w, LoadingIndicator as P, SmallList as A, Button as D } from "@box/blueprint-web";
|
|
3
|
+
import { AlertBadge as M } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
+
import { useState as F, useRef as j, useEffect as K, useCallback as x } from "react";
|
|
5
|
+
import { useIntl as U } from "react-intl";
|
|
6
|
+
import { BoxAiAgent as Q } from "./box-ai-agent.js";
|
|
7
|
+
import { LOGGER_BASE_CONFIG as L, LOGGER_ACTION_CLICK as f, LOGGER_TARGET as E } from "./constants.js";
|
|
8
|
+
import { ACTIONS as V } from "./contexts/actions.js";
|
|
9
|
+
import { useAgentsDispatch as W } from "./contexts/context.js";
|
|
10
10
|
import r from "./messages.js";
|
|
11
|
-
import { R as
|
|
12
|
-
import { jsx as t, jsxs as
|
|
13
|
-
const
|
|
14
|
-
agentSelector:
|
|
15
|
-
agentStatus:
|
|
16
|
-
agentLoader:
|
|
17
|
-
agentError:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
import { R as h } from "../../chunks/types.js";
|
|
12
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
13
|
+
const Y = "_agentSelector_1k90x_1", z = "_agentStatus_1k90x_4", H = "_agentLoader_1k90x_18", J = "_agentError_1k90x_21", X = "_triggerChip_1k90x_24", Z = "_agentLabel_1k90x_29", $ = "_dropdownIndicator_1k90x_35", q = "_agentListItemIcon_1k90x_44", tt = "_agentListContainer_1k90x_49", et = "_agentListRetryButton_1k90x_59", e = {
|
|
14
|
+
agentSelector: Y,
|
|
15
|
+
agentStatus: z,
|
|
16
|
+
agentLoader: H,
|
|
17
|
+
agentError: J,
|
|
18
|
+
triggerChip: X,
|
|
19
|
+
agentLabel: Z,
|
|
20
|
+
dropdownIndicator: $,
|
|
21
|
+
agentListItemIcon: q,
|
|
22
|
+
agentListContainer: tt,
|
|
23
|
+
agentListRetryButton: et
|
|
21
24
|
};
|
|
22
|
-
function
|
|
25
|
+
function dt({
|
|
23
26
|
agents: N,
|
|
24
|
-
onErrorAction:
|
|
27
|
+
onErrorAction: C,
|
|
28
|
+
recordAction: a,
|
|
25
29
|
requestState: m,
|
|
26
|
-
selectedAgent: n
|
|
27
|
-
recordAction: e
|
|
30
|
+
selectedAgent: n
|
|
28
31
|
}) {
|
|
29
32
|
const {
|
|
30
33
|
formatMessage: o
|
|
31
|
-
} =
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
} = U(), [l, _] = F(!1), S = o(r.selectAgent), G = o(r.defaultAgent), I = W(), R = m === h.SUCCESS, d = m === h.IN_PROGRESS, g = m === h.ERROR;
|
|
35
|
+
let i = "";
|
|
36
|
+
R ? i = (n == null ? void 0 : n.name) || S : g && (i = G);
|
|
37
|
+
const T = j(null), {
|
|
38
|
+
Wrapper: O,
|
|
39
|
+
wrapperProps: b
|
|
40
|
+
} = B({
|
|
41
|
+
ref: T,
|
|
42
|
+
textValue: i
|
|
43
|
+
});
|
|
44
|
+
K(() => {
|
|
45
|
+
l && a && a({
|
|
46
|
+
...L,
|
|
36
47
|
action: f,
|
|
37
|
-
target:
|
|
48
|
+
target: E.OPEN_SELECTOR
|
|
38
49
|
});
|
|
39
|
-
}, [
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
type:
|
|
43
|
-
id:
|
|
44
|
-
}),
|
|
45
|
-
...
|
|
50
|
+
}, [l, a]);
|
|
51
|
+
const k = x((s) => {
|
|
52
|
+
_(!1), I({
|
|
53
|
+
type: V.SET_SELECTED_AGENT,
|
|
54
|
+
id: s.id
|
|
55
|
+
}), a && a({
|
|
56
|
+
...L,
|
|
46
57
|
action: f,
|
|
47
|
-
target:
|
|
58
|
+
target: E.SELECT_AGENT
|
|
48
59
|
});
|
|
49
|
-
}, [
|
|
50
|
-
|
|
51
|
-
...
|
|
60
|
+
}, [I, a]), y = x(() => {
|
|
61
|
+
_(!1), C(), a && a({
|
|
62
|
+
...L,
|
|
52
63
|
action: f,
|
|
53
|
-
target:
|
|
64
|
+
target: E.RETRY_LOADING_AGENTS
|
|
54
65
|
});
|
|
55
|
-
}, [
|
|
56
|
-
return /* @__PURE__ */ t(
|
|
57
|
-
className:
|
|
58
|
-
name:
|
|
66
|
+
}, [C, a]);
|
|
67
|
+
return /* @__PURE__ */ t(c.Group, {
|
|
68
|
+
className: e.agentSelector,
|
|
69
|
+
name: S,
|
|
59
70
|
type: "multiple",
|
|
60
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ u(p.Root, {
|
|
61
72
|
modal: !1,
|
|
62
|
-
onOpenChange:
|
|
63
|
-
open:
|
|
64
|
-
children: [/* @__PURE__ */ t(
|
|
73
|
+
onOpenChange: _,
|
|
74
|
+
open: l,
|
|
75
|
+
children: [/* @__PURE__ */ t(v, {
|
|
65
76
|
content: o(r.errorTooltip),
|
|
66
|
-
hidden: !
|
|
77
|
+
hidden: !g || l,
|
|
67
78
|
side: "bottom",
|
|
68
79
|
variant: "error",
|
|
69
|
-
children: /* @__PURE__ */ t(
|
|
70
|
-
disabled:
|
|
71
|
-
children: /* @__PURE__ */
|
|
80
|
+
children: /* @__PURE__ */ t(p.Trigger, {
|
|
81
|
+
disabled: d,
|
|
82
|
+
children: /* @__PURE__ */ u(c.TriggerChip, {
|
|
83
|
+
className: e.triggerChip,
|
|
72
84
|
value: "trigger-chip",
|
|
73
|
-
children: [/* @__PURE__ */ t(
|
|
74
|
-
className:
|
|
85
|
+
children: [/* @__PURE__ */ t(w, {
|
|
86
|
+
className: e.agentStatus,
|
|
75
87
|
colorIndex: 0,
|
|
76
88
|
text: o(r.agent)
|
|
77
|
-
}),
|
|
89
|
+
}), d && /* @__PURE__ */ t(P, {
|
|
78
90
|
"aria-label": o(r.loadingMessage),
|
|
79
|
-
className:
|
|
91
|
+
className: e.agentLoader,
|
|
80
92
|
variant: "default"
|
|
81
|
-
}),
|
|
82
|
-
className:
|
|
93
|
+
}), g && /* @__PURE__ */ t(M, {
|
|
94
|
+
className: e.agentError,
|
|
83
95
|
height: "1rem",
|
|
84
96
|
role: "presentation",
|
|
85
97
|
width: "1rem"
|
|
86
|
-
}), /* @__PURE__ */ t(
|
|
87
|
-
|
|
88
|
-
|
|
98
|
+
}), /* @__PURE__ */ t(O, {
|
|
99
|
+
...b,
|
|
100
|
+
content: i,
|
|
101
|
+
children: /* @__PURE__ */ t(c.Label, {
|
|
102
|
+
ref: T,
|
|
103
|
+
className: e.agentLabel,
|
|
104
|
+
children: i
|
|
105
|
+
})
|
|
106
|
+
}), !d && /* @__PURE__ */ t("div", {
|
|
107
|
+
className: e.dropdownIndicator,
|
|
108
|
+
children: /* @__PURE__ */ t(c.DropdownIndicator, {})
|
|
109
|
+
})]
|
|
89
110
|
})
|
|
90
111
|
})
|
|
91
|
-
}), /* @__PURE__ */ t(
|
|
112
|
+
}), /* @__PURE__ */ t(p.ContentContainer, {
|
|
92
113
|
align: "start",
|
|
93
|
-
className:
|
|
94
|
-
children: /* @__PURE__ */
|
|
95
|
-
children: [
|
|
96
|
-
className:
|
|
114
|
+
className: e.agentListContainer,
|
|
115
|
+
children: /* @__PURE__ */ u(p.MainContent, {
|
|
116
|
+
children: [R && /* @__PURE__ */ t(A, {
|
|
117
|
+
className: e.agentList,
|
|
97
118
|
selectedKeys: [(n == null ? void 0 : n.id) || ""],
|
|
98
|
-
children: N.map((
|
|
99
|
-
agent:
|
|
100
|
-
onAction: () =>
|
|
101
|
-
},
|
|
102
|
-
}),
|
|
103
|
-
className:
|
|
104
|
-
onClick:
|
|
119
|
+
children: N.map((s) => /* @__PURE__ */ t(Q, {
|
|
120
|
+
agent: s,
|
|
121
|
+
onAction: () => k(s)
|
|
122
|
+
}, s.id))
|
|
123
|
+
}), g && /* @__PURE__ */ t(D, {
|
|
124
|
+
className: e.agentListRetryButton,
|
|
125
|
+
onClick: y,
|
|
105
126
|
variant: "tertiary",
|
|
106
127
|
children: o(r.errorMessage)
|
|
107
128
|
})]
|
|
@@ -111,6 +132,6 @@ function it({
|
|
|
111
132
|
});
|
|
112
133
|
}
|
|
113
134
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
135
|
+
dt as BoxAiAgentSelector,
|
|
136
|
+
dt as default
|
|
116
137
|
};
|
package/esm/lib/box-ai-agent.js
CHANGED
|
@@ -1,52 +1,62 @@
|
|
|
1
1
|
import "../../styles/box-ai-agent.css";
|
|
2
|
-
import {
|
|
3
|
-
import { BoxAiLogo as
|
|
4
|
-
import { SurfaceStatusSurfaceGray as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { useFullTextTooltip as u, SmallList as s, Text as d, Status as f } from "@box/blueprint-web";
|
|
3
|
+
import { BoxAiLogo as p } from "@box/blueprint-web-assets/icons/Logo";
|
|
4
|
+
import { SurfaceStatusSurfaceGray as g } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import { useRef as A } from "react";
|
|
6
|
+
import { useIntl as _ } from "react-intl";
|
|
7
|
+
import I from "./messages.js";
|
|
8
|
+
import { jsxs as i, jsx as t, Fragment as L } from "react/jsx-runtime";
|
|
9
|
+
const S = "_agentListItem_1s7vn_1", x = "_agentListItemIcon_1s7vn_1", N = "_defaultAgentHeader_1s7vn_5", h = "_defaultAgentName_1s7vn_9", v = "_defaultAgentStatus_1s7vn_15", a = {
|
|
10
|
+
agentListItem: S,
|
|
11
|
+
agentListItemIcon: x,
|
|
12
|
+
defaultAgentHeader: N,
|
|
13
|
+
defaultAgentName: h,
|
|
14
|
+
defaultAgentStatus: v
|
|
14
15
|
};
|
|
15
|
-
function
|
|
16
|
+
function w({
|
|
16
17
|
agent: e,
|
|
17
|
-
onAction:
|
|
18
|
+
onAction: l
|
|
18
19
|
}) {
|
|
19
20
|
const {
|
|
20
|
-
formatMessage:
|
|
21
|
-
} =
|
|
21
|
+
formatMessage: m
|
|
22
|
+
} = _(), n = e.isEnterpriseDefault, r = A(null), {
|
|
23
|
+
Wrapper: o,
|
|
24
|
+
wrapperProps: c
|
|
25
|
+
} = u({
|
|
26
|
+
ref: r,
|
|
27
|
+
textValue: e.name,
|
|
28
|
+
skipOverflowCheck: !n
|
|
29
|
+
});
|
|
22
30
|
return /* @__PURE__ */ i(s.Item, {
|
|
23
31
|
className: a.agentListItem,
|
|
24
32
|
id: e.id,
|
|
25
|
-
onAction:
|
|
33
|
+
onAction: l,
|
|
26
34
|
children: [/* @__PURE__ */ t(s.Thumbnail, {
|
|
27
35
|
className: a.agentListItemIcon,
|
|
28
36
|
children: e.imageURL ? /* @__PURE__ */ t("img", {
|
|
29
37
|
"aria-label": e.name,
|
|
30
38
|
src: e.imageURL
|
|
31
|
-
}) : /* @__PURE__ */ t(
|
|
39
|
+
}) : /* @__PURE__ */ t(p, {
|
|
32
40
|
"aria-label": e.name
|
|
33
41
|
})
|
|
34
42
|
}), /* @__PURE__ */ t(s.Header, {
|
|
35
43
|
className: n ? a.defaultAgentHeader : void 0,
|
|
36
44
|
textValue: e.name,
|
|
37
|
-
children: n ? /* @__PURE__ */ i(
|
|
45
|
+
children: n ? /* @__PURE__ */ i(L, {
|
|
38
46
|
children: [/* @__PURE__ */ t(o, {
|
|
47
|
+
...c,
|
|
39
48
|
content: e.name,
|
|
40
|
-
children: /* @__PURE__ */ t(
|
|
49
|
+
children: /* @__PURE__ */ t(d, {
|
|
50
|
+
ref: r,
|
|
41
51
|
as: "span",
|
|
42
52
|
className: a.defaultAgentName,
|
|
43
53
|
variant: "bodyDefaultSemibold",
|
|
44
54
|
children: e.name
|
|
45
55
|
})
|
|
46
|
-
}), /* @__PURE__ */ t(
|
|
56
|
+
}), /* @__PURE__ */ t(f, {
|
|
47
57
|
className: a.defaultAgentStatus,
|
|
48
|
-
color:
|
|
49
|
-
text:
|
|
58
|
+
color: g,
|
|
59
|
+
text: m(I.defaultStatus)
|
|
50
60
|
})]
|
|
51
61
|
}) : e.name
|
|
52
62
|
}), e.description && /* @__PURE__ */ t(s.Subtitle, {
|
|
@@ -56,6 +66,6 @@ function y({
|
|
|
56
66
|
});
|
|
57
67
|
}
|
|
58
68
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
w as BoxAiAgent,
|
|
70
|
+
w as default
|
|
61
71
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-agent-selector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^7.31.1",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"react-intl": "^6.4.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@box/blueprint-web": "^8.3.
|
|
13
|
+
"@box/blueprint-web": "^8.3.1",
|
|
14
14
|
"@box/blueprint-web-assets": "^4.28.0",
|
|
15
15
|
"@box/eslint-plugin-blueprint": "*",
|
|
16
16
|
"@box/storybook-utils": "^0.7.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"sideEffects": [
|
|
47
47
|
"**/*.css"
|
|
48
48
|
],
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "bef9db208515d53f0fb75d387d1740b389f6f753"
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._agentSelector_1k90x_1{margin-inline-start:.75rem}._agentSelector_1k90x_1 ._agentStatus_1k90x_4{margin-inline-start:.5rem}._agentSelector_1k90x_1 ._agentStatus_1k90x_4>span{background:linear-gradient(#f4f4f4 0,#f4f4f4 0) padding-box,linear-gradient(135deg,#fe01da,#2486fc) border-box;border:.0625rem solid rgba(0,0,0,0)}._agentSelector_1k90x_1 ._agentStatus_1k90x_4>span span{background:linear-gradient(135deg,#fe01da,#2486fc);color:transparent;-webkit-background-clip:text;background-clip:text;text-transform:uppercase}._agentSelector_1k90x_1 ._agentLoader_1k90x_18{position:inherit}._agentSelector_1k90x_1 ._agentError_1k90x_21 path{fill:#d5324e}._agentSelector_1k90x_1 ._triggerChip_1k90x_24{max-width:376px;display:flex;text-align:start}._agentSelector_1k90x_1 ._triggerChip_1k90x_24 ._agentLabel_1k90x_29{flex-grow:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._agentSelector_1k90x_1 ._triggerChip_1k90x_24 ._dropdownIndicator_1k90x_35{flex-shrink:0}@media (max-width: 374px){._agentSelector_1k90x_1 ._triggerChip_1k90x_24{width:100%}}._agentListItemIcon_1k90x_44{height:2rem;width:2rem}._agentListContainer_1k90x_49{min-width:320px;max-width:376px}@media (max-width: 376px){._agentListContainer_1k90x_49{max-width:320px}}._agentListRetryButton_1k90x_59{margin:.25rem;max-width:320px;text-wrap:wrap}
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './lib/box-ai-agent-selector';
|
|
2
|
+
export * from './lib/box-ai-agent-selector-with-api';
|
|
3
|
+
export * from './lib/box-ai-agent-selector-with-api-container';
|
|
2
4
|
export * from './lib/contexts';
|
|
3
5
|
export * from './lib/types';
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Function responsible for fetching the list of agents,
|
|
5
|
-
* typically passed from the parent component.
|
|
6
|
-
* The function returns a promise that resolves to the agent list response.
|
|
7
|
-
*/
|
|
8
|
-
fetcher: () => Promise<AgentListResponse>;
|
|
9
|
-
/**
|
|
10
|
-
* Name of the host application for resin event tracking
|
|
11
|
-
* */
|
|
12
|
-
hostAppName?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Callback function to handle logging resin events
|
|
15
|
-
* */
|
|
16
|
-
recordAction?: (payload: RecordActionType) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Determines whether the agent selector component should remain hidden
|
|
19
|
-
* until the initial data fetch is complete.
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
shouldHideAgentSelectorOnLoad?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare function BoxAiAgentSelectorWithApiContainer({ fetcher, shouldHideAgentSelectorOnLoad, hostAppName, recordAction, }: BoxAiAgentSelectorWithApiContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { type BoxAiAgentSelectorWithApiProps } from './types';
|
|
2
|
+
export declare function BoxAiAgentSelectorWithApiContainer({ fetcher, hostAppName, onSelectAgent, recordAction, requestState, shouldHideAgentSelectorOnLoad, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element;
|
|
25
3
|
export default BoxAiAgentSelectorWithApiContainer;
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Function responsible for fetching the list of agents,
|
|
5
|
-
* typically passed from the parent component.
|
|
6
|
-
* The function returns a promise that resolves to the agent list response.
|
|
7
|
-
*/
|
|
8
|
-
fetcher: () => Promise<AgentListResponse>;
|
|
9
|
-
/**
|
|
10
|
-
* Name of the host application for resin event tracking
|
|
11
|
-
* */
|
|
12
|
-
hostAppName?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Callback function to handle logging resin events
|
|
15
|
-
* */
|
|
16
|
-
recordAction?: (payload: RecordActionType) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Determines whether the agent selector component should remain hidden
|
|
19
|
-
* until the initial data fetch is complete.
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
shouldHideAgentSelectorOnLoad?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export declare function BoxAiAgentSelectorWithApi({ fetcher, shouldHideAgentSelectorOnLoad, hostAppName, recordAction, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element | null;
|
|
1
|
+
import { type BoxAiAgentSelectorWithApiProps } from './types';
|
|
2
|
+
export declare function BoxAiAgentSelectorWithApi({ fetcher, hostAppName, onSelectAgent, recordAction, requestState: requestStateProp, shouldHideAgentSelectorOnLoad, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element | null;
|
|
25
3
|
export default BoxAiAgentSelectorWithApi;
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Array of available agents to select from.
|
|
5
|
-
*/
|
|
6
|
-
agents: AgentType[];
|
|
7
|
-
/**
|
|
8
|
-
* Callback function triggered when an error occurs, used to retry fetching the agent list.
|
|
9
|
-
*/
|
|
10
|
-
onErrorAction: () => void;
|
|
11
|
-
/**
|
|
12
|
-
* Callback function to handle logging resin events
|
|
13
|
-
* */
|
|
14
|
-
recordAction?: (payload: RecordActionType) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Current state of the request to fetch agents, representing one of: Success, Error, In Progress, or Not Started.
|
|
17
|
-
*/
|
|
18
|
-
requestState: REQUEST_STATE;
|
|
19
|
-
/**
|
|
20
|
-
* The currently selected agent, or null if no agent is selected.
|
|
21
|
-
*/
|
|
22
|
-
selectedAgent: AgentType | null;
|
|
23
|
-
}
|
|
24
|
-
export declare function BoxAiAgentSelector({ agents, onErrorAction, requestState, selectedAgent, recordAction, }: BoxAiAgentSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { type BoxAiAgentSelectorProps } from './types';
|
|
2
|
+
export declare function BoxAiAgentSelector({ agents, onErrorAction, recordAction, requestState, selectedAgent, }: BoxAiAgentSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
25
3
|
export default BoxAiAgentSelector;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type BoxAiAgentSelectorWithApiProps } from '../../index';
|
|
2
|
+
export declare const defaultBoxAiAgentSelectorProps: {
|
|
3
|
+
fetcher: () => Promise<{
|
|
4
|
+
agents: import("../types").AgentType[];
|
|
5
|
+
}>;
|
|
6
|
+
};
|
|
7
|
+
export declare const DefaultBoxAiAgentSelectorWithApiContainer: (props: BoxAiAgentSelectorWithApiProps) => import("react/jsx-runtime").JSX.Element;
|
package/types/lib/types.d.ts
CHANGED
|
@@ -39,3 +39,52 @@ export type RecordActionType = {
|
|
|
39
39
|
feature: string;
|
|
40
40
|
target?: string;
|
|
41
41
|
};
|
|
42
|
+
export interface BoxAiAgentSelectorWithApiProps {
|
|
43
|
+
/**
|
|
44
|
+
* Function responsible for fetching the list of agents,
|
|
45
|
+
* typically passed from the parent component.
|
|
46
|
+
* The function returns a promise that resolves to the agent list response.
|
|
47
|
+
*/
|
|
48
|
+
fetcher: () => Promise<AgentListResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Name of the host application for resin event tracking
|
|
51
|
+
* */
|
|
52
|
+
hostAppName?: string;
|
|
53
|
+
/** Callback function when an agent is selected */
|
|
54
|
+
onSelectAgent?: (agent: AgentType | null) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Callback function to handle logging resin events
|
|
57
|
+
* */
|
|
58
|
+
recordAction?: (payload: RecordActionType) => void;
|
|
59
|
+
/** Request state of the list fetching
|
|
60
|
+
*/
|
|
61
|
+
requestState?: REQUEST_STATE | null;
|
|
62
|
+
/**
|
|
63
|
+
* Determines whether the agent selector component should remain hidden
|
|
64
|
+
* until the initial data fetch is complete.
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
shouldHideAgentSelectorOnLoad?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface BoxAiAgentSelectorProps {
|
|
70
|
+
/**
|
|
71
|
+
* Array of available agents to select from.
|
|
72
|
+
*/
|
|
73
|
+
agents: AgentType[];
|
|
74
|
+
/**
|
|
75
|
+
* Callback function triggered when an error occurs, used to retry fetching the agent list.
|
|
76
|
+
*/
|
|
77
|
+
onErrorAction: () => void;
|
|
78
|
+
/**
|
|
79
|
+
* Callback function to handle logging resin events
|
|
80
|
+
* */
|
|
81
|
+
recordAction?: (payload: RecordActionType) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Current state of the request to fetch agents, representing one of: Success, Error, In Progress, or Not Started.
|
|
84
|
+
*/
|
|
85
|
+
requestState: REQUEST_STATE;
|
|
86
|
+
/**
|
|
87
|
+
* The currently selected agent, or null if no agent is selected.
|
|
88
|
+
*/
|
|
89
|
+
selectedAgent: AgentType | null;
|
|
90
|
+
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type AgentState } from '../../types';
|
|
2
|
-
import { type AgentsProviderProps } from '../context';
|
|
3
|
-
export declare const initialState: AgentState;
|
|
4
|
-
export declare const DefaultContextProvider: ({ value }: AgentsProviderProps) => import("react/jsx-runtime").JSX.Element;
|