@box/box-ai-agent-selector 0.41.14 → 0.41.16
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/dist/esm/lib/box-ai-agent-selector-with-api-container.js +21 -19
- package/dist/esm/lib/box-ai-agent-selector-with-api.js +46 -43
- package/dist/types/lib/box-ai-agent-selector-with-api-container.d.ts +1 -1
- package/dist/types/lib/box-ai-agent-selector-with-api.d.ts +1 -1
- package/dist/types/lib/types.d.ts +2 -0
- package/package.json +2 -2
@@ -1,37 +1,39 @@
|
|
1
1
|
import "./box-ai-agent-selector.js";
|
2
|
-
import { BoxAiAgentSelectorWithApi as
|
2
|
+
import { BoxAiAgentSelectorWithApi as l } from "./box-ai-agent-selector-with-api.js";
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
4
|
-
import { AgentsProvider as
|
4
|
+
import { AgentsProvider as u } from "./contexts/context.js";
|
5
5
|
import "./constants.js";
|
6
6
|
import "../../chunks/types.js";
|
7
7
|
import "./contexts/actions.js";
|
8
8
|
import "./hooks/useLocalStorageAIAgents.js";
|
9
|
-
function
|
9
|
+
function W({
|
10
10
|
fetcher: t,
|
11
11
|
hostAppName: o,
|
12
12
|
onSelectAgent: i,
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
onSelectedAgentCallback: e,
|
14
|
+
recordAction: m,
|
15
|
+
requestState: p,
|
16
|
+
disabled: n,
|
17
|
+
shouldHideAgentSelectorOnLoad: A = !0,
|
18
|
+
triggerChipClassName: f,
|
19
|
+
contentClassName: c
|
19
20
|
}) {
|
20
|
-
return /* @__PURE__ */ r(
|
21
|
-
children: /* @__PURE__ */ r(
|
22
|
-
contentClassName:
|
23
|
-
disabled:
|
21
|
+
return /* @__PURE__ */ r(u, {
|
22
|
+
children: /* @__PURE__ */ r(l, {
|
23
|
+
contentClassName: c,
|
24
|
+
disabled: n,
|
24
25
|
fetcher: t,
|
25
26
|
hostAppName: o,
|
26
27
|
onSelectAgent: i,
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
onSelectedAgentCallback: e,
|
29
|
+
recordAction: m,
|
30
|
+
requestState: p,
|
31
|
+
shouldHideAgentSelectorOnLoad: A,
|
32
|
+
triggerChipClassName: f
|
31
33
|
})
|
32
34
|
});
|
33
35
|
}
|
34
36
|
export {
|
35
|
-
|
36
|
-
|
37
|
+
W as BoxAiAgentSelectorWithApiContainer,
|
38
|
+
W as default
|
37
39
|
};
|
@@ -1,42 +1,43 @@
|
|
1
|
-
import { useState as
|
2
|
-
import { BoxAiAgentSelector as
|
3
|
-
import { LOGGER_BASE_CONFIG as g, LOGGER_TARGET as
|
1
|
+
import { useState as l, useCallback as c, useEffect as T } from "react";
|
2
|
+
import { BoxAiAgentSelector as x } from "./box-ai-agent-selector.js";
|
3
|
+
import { LOGGER_BASE_CONFIG as g, LOGGER_TARGET as h } from "./constants.js";
|
4
4
|
import { ACTIONS as S } from "./contexts/actions.js";
|
5
|
-
import { useAgentsDispatch as
|
5
|
+
import { useAgentsDispatch as D, useAgents as F } from "./contexts/context.js";
|
6
6
|
import { R as r } from "../../chunks/types.js";
|
7
|
-
import { jsx as
|
8
|
-
function
|
9
|
-
fetcher:
|
10
|
-
hostAppName:
|
11
|
-
onSelectAgent:
|
12
|
-
|
7
|
+
import { jsx as Q } from "react/jsx-runtime";
|
8
|
+
function W({
|
9
|
+
fetcher: m,
|
10
|
+
hostAppName: A,
|
11
|
+
onSelectAgent: f,
|
12
|
+
onSelectedAgentCallback: n,
|
13
|
+
recordAction: u,
|
13
14
|
requestState: E,
|
14
|
-
disabled:
|
15
|
+
disabled: p,
|
15
16
|
onAgentsListOpen: C,
|
16
|
-
shouldHideAgentSelectorOnLoad:
|
17
|
-
triggerChipClassName:
|
18
|
-
contentClassName:
|
19
|
-
variant:
|
17
|
+
shouldHideAgentSelectorOnLoad: O,
|
18
|
+
triggerChipClassName: N,
|
19
|
+
contentClassName: I,
|
20
|
+
variant: L = "modal"
|
20
21
|
}) {
|
21
|
-
const e =
|
22
|
-
agents:
|
22
|
+
const e = D(), {
|
23
|
+
agents: R,
|
23
24
|
requestState: i,
|
24
|
-
selectedAgent:
|
25
|
-
} =
|
26
|
-
|
27
|
-
}, [
|
25
|
+
selectedAgent: t
|
26
|
+
} = F(), [U, a] = l(!1), o = c((s) => {
|
27
|
+
u && (s.data ?? (s.data = {}), s.data.hostAppName = A, u(s));
|
28
|
+
}, [A, u]), _ = c(async () => {
|
28
29
|
e({
|
29
30
|
type: S.SET_REQUEST_STATE,
|
30
31
|
requestState: r.IN_PROGRESS
|
31
32
|
});
|
32
33
|
try {
|
33
|
-
const
|
34
|
+
const s = await m();
|
34
35
|
e({
|
35
36
|
type: S.SET_AGENT_LIST,
|
36
|
-
agents:
|
37
|
+
agents: s.agents
|
37
38
|
}), o({
|
38
39
|
...g,
|
39
|
-
target:
|
40
|
+
target: h.LOADED_AGENTS
|
40
41
|
});
|
41
42
|
} catch {
|
42
43
|
e({
|
@@ -44,15 +45,15 @@ function k({
|
|
44
45
|
requestState: r.ERROR
|
45
46
|
}), o({
|
46
47
|
...g,
|
47
|
-
target:
|
48
|
+
target: h.ERROR_LOADING_AGENTS
|
48
49
|
});
|
49
50
|
}
|
50
|
-
}, [e, o,
|
51
|
-
return
|
52
|
-
|
53
|
-
|
54
|
-
}) :
|
55
|
-
}, [
|
51
|
+
}, [e, o, m]), G = i !== r.SUCCESS || !R.length || !t;
|
52
|
+
return T(() => {
|
53
|
+
G ? _().finally(() => {
|
54
|
+
a(!0);
|
55
|
+
}) : a(!0);
|
56
|
+
}, [_, G]), T(() => {
|
56
57
|
E && E !== i && (E !== r.SUCCESS && e({
|
57
58
|
type: S.SET_AGENT_LIST,
|
58
59
|
agents: []
|
@@ -60,22 +61,24 @@ function k({
|
|
60
61
|
type: S.SET_REQUEST_STATE,
|
61
62
|
requestState: E
|
62
63
|
}));
|
63
|
-
}, [e, E]),
|
64
|
-
|
65
|
-
}, [
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
}, [e, E]), T(() => {
|
65
|
+
f && f(t);
|
66
|
+
}, [f, t == null ? void 0 : t.id]), T(() => {
|
67
|
+
n && n(t);
|
68
|
+
}, [n, t == null ? void 0 : t.id]), O && !U || i === r.SUCCESS && R.length <= 1 ? null : /* @__PURE__ */ Q(x, {
|
69
|
+
agents: R,
|
70
|
+
contentClassName: I,
|
71
|
+
disabled: p,
|
69
72
|
onAgentsListOpen: C,
|
70
|
-
onErrorAction:
|
73
|
+
onErrorAction: _,
|
71
74
|
recordAction: o,
|
72
75
|
requestState: i,
|
73
|
-
selectedAgent:
|
74
|
-
triggerChipClassName:
|
75
|
-
variant:
|
76
|
+
selectedAgent: t,
|
77
|
+
triggerChipClassName: N,
|
78
|
+
variant: L
|
76
79
|
});
|
77
80
|
}
|
78
81
|
export {
|
79
|
-
|
80
|
-
|
82
|
+
W as BoxAiAgentSelectorWithApi,
|
83
|
+
W as default
|
81
84
|
};
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { BoxAiAgentSelectorWithApiProps } from './types';
|
2
|
-
export declare function BoxAiAgentSelectorWithApiContainer({ fetcher, hostAppName, onSelectAgent, recordAction, requestState, disabled, shouldHideAgentSelectorOnLoad, triggerChipClassName, contentClassName, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element;
|
2
|
+
export declare function BoxAiAgentSelectorWithApiContainer({ fetcher, hostAppName, onSelectAgent, onSelectedAgentCallback, recordAction, requestState, disabled, shouldHideAgentSelectorOnLoad, triggerChipClassName, contentClassName, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element;
|
3
3
|
export default BoxAiAgentSelectorWithApiContainer;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { BoxAiAgentSelectorWithApiProps } from './types';
|
2
|
-
export declare function BoxAiAgentSelectorWithApi({ fetcher, hostAppName, onSelectAgent, recordAction, requestState: requestStateProp, disabled, onAgentsListOpen, shouldHideAgentSelectorOnLoad, triggerChipClassName, contentClassName, variant, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element | null;
|
2
|
+
export declare function BoxAiAgentSelectorWithApi({ fetcher, hostAppName, onSelectAgent, onSelectedAgentCallback, recordAction, requestState: requestStateProp, disabled, onAgentsListOpen, shouldHideAgentSelectorOnLoad, triggerChipClassName, contentClassName, variant, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element | null;
|
3
3
|
export default BoxAiAgentSelectorWithApi;
|
@@ -59,6 +59,8 @@ export interface BoxAiAgentSelectorWithApiProps {
|
|
59
59
|
hostAppName?: string;
|
60
60
|
/** Callback function when an agent is selected */
|
61
61
|
onSelectAgent?: (agent: AgentType | null) => void;
|
62
|
+
/** Callback function when an agent is selected; does not get overridden */
|
63
|
+
onSelectedAgentCallback?: (agent: AgentType | null) => void;
|
62
64
|
/**
|
63
65
|
* Callback function to handle logging resin events
|
64
66
|
* */
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/box-ai-agent-selector",
|
3
|
-
"version": "0.41.
|
3
|
+
"version": "0.41.16",
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
5
5
|
"peerDependencies": {
|
6
6
|
"@ariakit/react": "^0.4.15",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"devDependencies": {
|
14
14
|
"@ariakit/react": "^0.4.15",
|
15
15
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
16
|
-
"@box/blueprint-web": "^12.7.
|
16
|
+
"@box/blueprint-web": "^12.7.1",
|
17
17
|
"@box/blueprint-web-assets": "^4.48.0",
|
18
18
|
"@box/eslint-plugin-blueprint": "^1.0.3",
|
19
19
|
"@box/storybook-utils": "^0.13.1",
|