@box/box-ai-agent-selector 0.52.5 → 0.53.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/dist/chunks/types.js +5 -2
- package/dist/esm/index.js +13 -12
- package/dist/esm/lib/box-ai-agent-selector-with-api-container.js +16 -14
- package/dist/esm/lib/box-ai-agent-selector-with-api.js +51 -49
- package/dist/esm/lib/box-ai-agent-selector.js +1511 -1507
- package/dist/i18n/en-x-pseudo.js +8 -8
- package/dist/i18n/en-x-pseudo.properties +8 -8
- package/dist/styles/box-ai-agent-selector.css +1 -1
- 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/box-ai-agent-selector.d.ts +1 -1
- package/dist/types/lib/types.d.ts +13 -0
- package/package.json +2 -2
package/dist/chunks/types.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
let
|
1
|
+
let t = /* @__PURE__ */ function(e) {
|
2
2
|
return e.NOT_STARTED = "not_started", e.IN_PROGRESS = "in_progress", e.SUCCESS = "success", e.ERROR = "error", e.CANCELLED = "cancelled", e;
|
3
|
+
}({}), r = /* @__PURE__ */ function(e) {
|
4
|
+
return e.LEFT = "left", e.OFFSET_FROM_LEFT = "offset_from_left", e;
|
3
5
|
}({});
|
4
6
|
export {
|
5
|
-
|
7
|
+
t as R,
|
8
|
+
r as S
|
6
9
|
};
|
package/dist/esm/index.js
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
import { BoxAiAgentSelector as t } from "./lib/box-ai-agent-selector.js";
|
2
2
|
import { BoxAiAgentSelectorWithApi as A } from "./lib/box-ai-agent-selector-with-api.js";
|
3
|
-
import { BoxAiAgentSelectorWithApiContainer as
|
4
|
-
import { AI_AGENTS_LOCAL_STORAGE_KEY as
|
5
|
-
import { R as n } from "../chunks/types.js";
|
6
|
-
import { ACTIONS as
|
7
|
-
import { AgentsProvider as
|
3
|
+
import { BoxAiAgentSelectorWithApiContainer as s } from "./lib/box-ai-agent-selector-with-api-container.js";
|
4
|
+
import { AI_AGENTS_LOCAL_STORAGE_KEY as S } from "./lib/constants.js";
|
5
|
+
import { R as f, S as n } from "../chunks/types.js";
|
6
|
+
import { ACTIONS as a } from "./lib/contexts/actions.js";
|
7
|
+
import { AgentsProvider as m, useAgents as T, useAgentsDispatch as _ } from "./lib/contexts/context.js";
|
8
8
|
import { default as l } from "./lib/hooks/useLocalStorageAIAgents.js";
|
9
9
|
export {
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
a as ACTIONS,
|
11
|
+
S as AI_AGENTS_LOCAL_STORAGE_KEY,
|
12
|
+
m as AgentsProvider,
|
13
13
|
t as BoxAiAgentSelector,
|
14
14
|
A as BoxAiAgentSelectorWithApi,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
T as
|
15
|
+
s as BoxAiAgentSelectorWithApiContainer,
|
16
|
+
f as REQUEST_STATE,
|
17
|
+
n as SELECTOR_ALIGNMENT,
|
18
|
+
T as useAgents,
|
19
|
+
_ as useAgentsDispatch,
|
19
20
|
l as useLocalStorageAIAgents
|
20
21
|
};
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import "./box-ai-agent-selector.js";
|
2
|
-
import { BoxAiAgentSelectorWithApi as
|
2
|
+
import { BoxAiAgentSelectorWithApi as E } from "./box-ai-agent-selector-with-api.js";
|
3
|
+
import { S } from "../../chunks/types.js";
|
3
4
|
import { jsx as r } from "react/jsx-runtime";
|
4
|
-
import { AgentsProvider as
|
5
|
+
import { AgentsProvider as c } from "./contexts/context.js";
|
5
6
|
import "./constants.js";
|
6
|
-
import "../../chunks/types.js";
|
7
7
|
import "./contexts/actions.js";
|
8
8
|
import "./hooks/useLocalStorageAIAgents.js";
|
9
|
-
function
|
9
|
+
function O({
|
10
10
|
fetcher: t,
|
11
11
|
hostAppName: o,
|
12
12
|
onSelectAgent: i,
|
@@ -14,14 +14,15 @@ function j({
|
|
14
14
|
recordAction: m,
|
15
15
|
requestState: p,
|
16
16
|
disabled: n,
|
17
|
-
|
18
|
-
|
17
|
+
selectorAlignment: A = S.OFFSET_FROM_LEFT,
|
18
|
+
shouldHideAgentSelectorOnLoad: f = !0,
|
19
|
+
triggerChipClassName: a,
|
19
20
|
contentClassName: l,
|
20
|
-
useAgentLocalStorage:
|
21
|
+
useAgentLocalStorage: s = !1
|
21
22
|
// All non-Box AI Q&A experiences should pass in false
|
22
23
|
}) {
|
23
|
-
return /* @__PURE__ */ r(
|
24
|
-
children: /* @__PURE__ */ r(
|
24
|
+
return /* @__PURE__ */ r(c, {
|
25
|
+
children: /* @__PURE__ */ r(E, {
|
25
26
|
contentClassName: l,
|
26
27
|
disabled: n,
|
27
28
|
fetcher: t,
|
@@ -30,13 +31,14 @@ function j({
|
|
30
31
|
onSelectedAgentCallback: e,
|
31
32
|
recordAction: m,
|
32
33
|
requestState: p,
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
selectorAlignment: A,
|
35
|
+
shouldHideAgentSelectorOnLoad: f,
|
36
|
+
triggerChipClassName: a,
|
37
|
+
useAgentLocalStorage: s
|
36
38
|
})
|
37
39
|
});
|
38
40
|
}
|
39
41
|
export {
|
40
|
-
|
41
|
-
|
42
|
+
O as BoxAiAgentSelectorWithApiContainer,
|
43
|
+
O as default
|
42
44
|
};
|
@@ -1,87 +1,89 @@
|
|
1
|
-
import { useState as x, useCallback as
|
1
|
+
import { useState as x, useCallback as O, useEffect as o } from "react";
|
2
2
|
import { BoxAiAgentSelector as D } from "./box-ai-agent-selector.js";
|
3
|
-
import { LOGGER_BASE_CONFIG as
|
3
|
+
import { LOGGER_BASE_CONFIG as c, LOGGER_TARGET as g } from "./constants.js";
|
4
4
|
import { ACTIONS as S } from "./contexts/actions.js";
|
5
|
-
import { useAgentsDispatch as
|
6
|
-
import { R as r } from "../../chunks/types.js";
|
7
|
-
import { jsx as
|
8
|
-
function
|
9
|
-
fetcher:
|
10
|
-
hostAppName:
|
5
|
+
import { useAgentsDispatch as Q, useAgents as d } from "./contexts/context.js";
|
6
|
+
import { R as r, S as q } from "../../chunks/types.js";
|
7
|
+
import { jsx as y } from "react/jsx-runtime";
|
8
|
+
function J({
|
9
|
+
fetcher: A,
|
10
|
+
hostAppName: m,
|
11
11
|
onSelectAgent: f,
|
12
|
-
onSelectedAgentCallback:
|
13
|
-
recordAction:
|
14
|
-
requestState:
|
15
|
-
disabled:
|
12
|
+
onSelectedAgentCallback: _,
|
13
|
+
recordAction: n,
|
14
|
+
requestState: e,
|
15
|
+
disabled: h,
|
16
16
|
onAgentsListOpen: C,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
selectorAlignment: L = q.OFFSET_FROM_LEFT,
|
18
|
+
shouldHideAgentSelectorOnLoad: N,
|
19
|
+
triggerChipClassName: p,
|
20
|
+
contentClassName: F,
|
21
|
+
useAgentLocalStorage: I = !1,
|
21
22
|
// All non-Box AI Q&A experiences should pass in false
|
22
23
|
variant: U = "modal"
|
23
24
|
}) {
|
24
|
-
const
|
25
|
+
const E = Q(), {
|
25
26
|
agents: R,
|
26
27
|
requestState: i,
|
27
28
|
selectedAgent: t
|
28
|
-
} =
|
29
|
-
|
30
|
-
}, [
|
31
|
-
|
29
|
+
} = d(), [l, a] = x(!1), T = O((s) => {
|
30
|
+
n && (s.data ?? (s.data = {}), s.data.hostAppName = m, n(s));
|
31
|
+
}, [m, n]), u = O(async () => {
|
32
|
+
E({
|
32
33
|
type: S.SET_REQUEST_STATE,
|
33
34
|
requestState: r.IN_PROGRESS
|
34
35
|
});
|
35
36
|
try {
|
36
|
-
const s = await
|
37
|
-
|
37
|
+
const s = await A();
|
38
|
+
E({
|
38
39
|
type: S.SET_AGENT_LIST,
|
39
40
|
agents: s.agents
|
40
|
-
}),
|
41
|
-
...
|
42
|
-
target:
|
41
|
+
}), T({
|
42
|
+
...c,
|
43
|
+
target: g.LOADED_AGENTS
|
43
44
|
});
|
44
45
|
} catch {
|
45
|
-
|
46
|
+
E({
|
46
47
|
type: S.SET_REQUEST_STATE,
|
47
48
|
requestState: r.ERROR
|
48
|
-
}),
|
49
|
-
...
|
50
|
-
target:
|
49
|
+
}), T({
|
50
|
+
...c,
|
51
|
+
target: g.ERROR_LOADING_AGENTS
|
51
52
|
});
|
52
53
|
}
|
53
|
-
}, [
|
54
|
-
return
|
55
|
-
G ?
|
54
|
+
}, [E, T, A]), G = i !== r.SUCCESS || !R.length || !t;
|
55
|
+
return o(() => {
|
56
|
+
G ? u().finally(() => {
|
56
57
|
a(!0);
|
57
58
|
}) : a(!0);
|
58
|
-
}, [
|
59
|
-
|
59
|
+
}, [u, G]), o(() => {
|
60
|
+
e && e !== i && (e !== r.SUCCESS && E({
|
60
61
|
type: S.SET_AGENT_LIST,
|
61
62
|
agents: []
|
62
|
-
}),
|
63
|
+
}), E({
|
63
64
|
type: S.SET_REQUEST_STATE,
|
64
|
-
requestState:
|
65
|
+
requestState: e
|
65
66
|
}));
|
66
|
-
}, [
|
67
|
+
}, [E, e]), o(() => {
|
67
68
|
f && f(t);
|
68
|
-
}, [f, t == null ? void 0 : t.id]),
|
69
|
-
|
70
|
-
}, [
|
69
|
+
}, [f, t == null ? void 0 : t.id]), o(() => {
|
70
|
+
_ && _(t);
|
71
|
+
}, [_, t == null ? void 0 : t.id]), N && !l || i === r.SUCCESS && R.length <= 1 ? null : /* @__PURE__ */ y(D, {
|
71
72
|
agents: R,
|
72
|
-
contentClassName:
|
73
|
-
disabled:
|
73
|
+
contentClassName: F,
|
74
|
+
disabled: h,
|
74
75
|
onAgentsListOpen: C,
|
75
|
-
onErrorAction:
|
76
|
-
recordAction:
|
76
|
+
onErrorAction: u,
|
77
|
+
recordAction: T,
|
77
78
|
requestState: i,
|
78
79
|
selectedAgent: t,
|
79
|
-
|
80
|
-
|
80
|
+
selectorAlignment: L,
|
81
|
+
triggerChipClassName: p,
|
82
|
+
useAgentLocalStorage: I,
|
81
83
|
variant: U
|
82
84
|
});
|
83
85
|
}
|
84
86
|
export {
|
85
|
-
|
86
|
-
|
87
|
+
J as BoxAiAgentSelectorWithApi,
|
88
|
+
J as default
|
87
89
|
};
|