@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.
@@ -1,37 +1,39 @@
1
1
  import "./box-ai-agent-selector.js";
2
- import { BoxAiAgentSelectorWithApi as c } from "./box-ai-agent-selector-with-api.js";
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 l } from "./contexts/context.js";
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 S({
9
+ function W({
10
10
  fetcher: t,
11
11
  hostAppName: o,
12
12
  onSelectAgent: i,
13
- recordAction: e,
14
- requestState: m,
15
- disabled: p,
16
- shouldHideAgentSelectorOnLoad: n = !0,
17
- triggerChipClassName: A,
18
- contentClassName: f
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(l, {
21
- children: /* @__PURE__ */ r(c, {
22
- contentClassName: f,
23
- disabled: p,
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
- recordAction: e,
28
- requestState: m,
29
- shouldHideAgentSelectorOnLoad: n,
30
- triggerChipClassName: A
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
- S as BoxAiAgentSelectorWithApiContainer,
36
- S as default
37
+ W as BoxAiAgentSelectorWithApiContainer,
38
+ W as default
37
39
  };
@@ -1,42 +1,43 @@
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";
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 d, useAgents as x } from "./contexts/context.js";
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 D } from "react/jsx-runtime";
8
- function k({
9
- fetcher: R,
10
- hostAppName: _,
11
- onSelectAgent: n,
12
- recordAction: T,
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: G,
15
+ disabled: p,
15
16
  onAgentsListOpen: C,
16
- shouldHideAgentSelectorOnLoad: h,
17
- triggerChipClassName: p,
18
- contentClassName: O,
19
- variant: N = "modal"
17
+ shouldHideAgentSelectorOnLoad: O,
18
+ triggerChipClassName: N,
19
+ contentClassName: I,
20
+ variant: L = "modal"
20
21
  }) {
21
- const e = d(), {
22
- agents: A,
22
+ const e = D(), {
23
+ agents: R,
23
24
  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 () => {
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 t = await R();
34
+ const s = await m();
34
35
  e({
35
36
  type: S.SET_AGENT_LIST,
36
- agents: t.agents
37
+ agents: s.agents
37
38
  }), o({
38
39
  ...g,
39
- target: l.LOADED_AGENTS
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: l.ERROR_LOADING_AGENTS
48
+ target: h.ERROR_LOADING_AGENTS
48
49
  });
49
50
  }
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(() => {
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]), 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
- agents: A,
67
- contentClassName: O,
68
- disabled: G,
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: f,
73
+ onErrorAction: _,
71
74
  recordAction: o,
72
75
  requestState: i,
73
- selectedAgent: s,
74
- triggerChipClassName: p,
75
- variant: N
76
+ selectedAgent: t,
77
+ triggerChipClassName: N,
78
+ variant: L
76
79
  });
77
80
  }
78
81
  export {
79
- k as BoxAiAgentSelectorWithApi,
80
- k as default
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.14",
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.0",
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",