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