@box/box-ai-agent-selector 0.41.8 → 0.41.10

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,16 +1,16 @@
1
- import { useState as I, useCallback as m, useEffect as f } from "react";
2
- import { BoxAiAgentSelector as L } from "./box-ai-agent-selector.js";
3
- import { LOGGER_BASE_CONFIG as a, LOGGER_TARGET as l } from "./constants.js";
4
- import { ACTIONS as E } from "./contexts/actions.js";
5
- import { useAgentsDispatch as U, useAgents as x } from "./contexts/context.js";
6
- import { R as S } from "../../chunks/types.js";
1
+ import { useState as L, useCallback as a, useEffect as u } from "react";
2
+ import { BoxAiAgentSelector as U } from "./box-ai-agent-selector.js";
3
+ import { LOGGER_BASE_CONFIG as g, LOGGER_TARGET as l } from "./constants.js";
4
+ import { ACTIONS as S } from "./contexts/actions.js";
5
+ import { useAgentsDispatch as d, useAgents as x } from "./contexts/context.js";
6
+ import { R as r } from "../../chunks/types.js";
7
7
  import { jsx as D } from "react/jsx-runtime";
8
8
  function k({
9
- fetcher: u,
10
- hostAppName: R,
11
- onSelectAgent: i,
9
+ fetcher: R,
10
+ hostAppName: _,
11
+ onSelectAgent: n,
12
12
  recordAction: T,
13
- requestState: s,
13
+ requestState: E,
14
14
  disabled: G,
15
15
  onAgentsListOpen: C,
16
16
  shouldHideAgentSelectorOnLoad: h,
@@ -18,59 +18,59 @@ function k({
18
18
  contentClassName: O,
19
19
  variant: N = "modal"
20
20
  }) {
21
- const e = U(), {
21
+ const e = d(), {
22
22
  agents: A,
23
- requestState: r,
24
- selectedAgent: n
25
- } = x(), [d, _] = I(!1), o = m((t) => {
26
- T && (t.data ?? (t.data = {}), t.data.hostAppName = R, T(t));
27
- }, [R, T]), c = m(async () => {
23
+ requestState: i,
24
+ selectedAgent: s
25
+ } = x(), [I, c] = L(!1), o = a((t) => {
26
+ T && (t.data ?? (t.data = {}), t.data.hostAppName = _, T(t));
27
+ }, [_, T]), f = a(async () => {
28
28
  e({
29
- type: E.SET_REQUEST_STATE,
30
- requestState: S.IN_PROGRESS
29
+ type: S.SET_REQUEST_STATE,
30
+ requestState: r.IN_PROGRESS
31
31
  });
32
32
  try {
33
- const t = await u();
33
+ const t = await R();
34
34
  e({
35
- type: E.SET_AGENT_LIST,
35
+ type: S.SET_AGENT_LIST,
36
36
  agents: t.agents
37
37
  }), o({
38
- ...a,
38
+ ...g,
39
39
  target: l.LOADED_AGENTS
40
40
  });
41
41
  } catch {
42
42
  e({
43
- type: E.SET_REQUEST_STATE,
44
- requestState: S.ERROR
43
+ type: S.SET_REQUEST_STATE,
44
+ requestState: r.ERROR
45
45
  }), o({
46
- ...a,
46
+ ...g,
47
47
  target: l.ERROR_LOADING_AGENTS
48
48
  });
49
49
  }
50
- }, [e, o, u]), g = r !== S.SUCCESS || !A.length || !n;
51
- return f(() => {
52
- g ? c().finally(() => {
53
- _(!0);
54
- }) : _(!0);
55
- }, [c, g]), f(() => {
56
- s && s !== r && (s !== S.SUCCESS && e({
57
- type: E.SET_AGENT_LIST,
50
+ }, [e, o, R]), m = i !== r.SUCCESS || !A.length || !s;
51
+ return u(() => {
52
+ m ? f().finally(() => {
53
+ c(!0);
54
+ }) : c(!0);
55
+ }, [f, m]), u(() => {
56
+ E && E !== i && (E !== r.SUCCESS && e({
57
+ type: S.SET_AGENT_LIST,
58
58
  agents: []
59
59
  }), e({
60
- type: E.SET_REQUEST_STATE,
61
- requestState: s
60
+ type: S.SET_REQUEST_STATE,
61
+ requestState: E
62
62
  }));
63
- }, [e, s]), f(() => {
64
- i && i(n);
65
- }, [i, n]), h && !d || r === S.SUCCESS && A.length <= 1 ? null : /* @__PURE__ */ D(L, {
63
+ }, [e, E]), u(() => {
64
+ n && n(s);
65
+ }, [n, s == null ? void 0 : s.id]), h && !I || i === r.SUCCESS && A.length <= 1 ? null : /* @__PURE__ */ D(U, {
66
66
  agents: A,
67
67
  contentClassName: O,
68
68
  disabled: G,
69
69
  onAgentsListOpen: C,
70
- onErrorAction: c,
70
+ onErrorAction: f,
71
71
  recordAction: o,
72
- requestState: r,
73
- selectedAgent: n,
72
+ requestState: i,
73
+ selectedAgent: s,
74
74
  triggerChipClassName: p,
75
75
  variant: N
76
76
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-agent-selector",
3
- "version": "0.41.8",
3
+ "version": "0.41.10",
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.3.1",
16
+ "@box/blueprint-web": "^12.4.0",
17
17
  "@box/blueprint-web-assets": "^4.47.0",
18
18
  "@box/eslint-plugin-blueprint": "^1.0.3",
19
19
  "@box/storybook-utils": "^0.12.6",