@box/box-ai-agent-selector 0.41.15 → 0.42.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.
@@ -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,10 +1,10 @@
1
1
  export default {
2
- "boxAI.agentSelector.agent": "⟦萬 Άğêήτ 國⟧",
3
- "boxAI.agentSelector.agentList": "⟦萬萬 Ǻğέŋť Ļíśţ 國國⟧",
4
- "boxAI.agentSelector.defaultAgent": "⟦萬萬 Ďěƒąūĺţ 國國⟧",
5
- "boxAI.agentSelector.defaultStatus": "⟦萬萬 ĎĚ₣ĂŨĽŤ 國國⟧",
6
- "boxAI.agentSelector.errorMessage": "⟦萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬 ₣âĭľėď ţø ĺôàď ανăϊĺàвľе áġёлŧś. Ýоű'ŕє çüґяëŋţľỳ ůŝϊлĝ ýõűѓ õѓġåиįżàţιοп'ś ďεƒãüĺť ãġěńτ. Ĉļï¢ĸ ĥēřè ťσ řęŧŕỳ. 國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國⟧",
7
- "boxAI.agentSelector.errorTooltip": "⟦萬萬萬萬萬萬萬萬萬萬萬萬 ₣ăîļėď ťσ ľòǻď άνãϊĺáьľė ąğéήťŝ. Ťґў ăġάіŋ. 國國國國國國國國國國國國⟧",
8
- "boxAI.agentSelector.loadingMessage": "⟦萬萬萬萬萬萬萬 Ļòâďîήġ āνάīĺâьĺέ åġėпτŝ 國國國國國國國⟧",
9
- "boxAI.agentSelector.selectAgent": "⟦萬萬萬萬 Ŝёľëçţ ăņ Áġęηţ 國國國國⟧"
2
+ "boxAI.agentSelector.agent": "⟦萬 Áĝéлŧ 國⟧",
3
+ "boxAI.agentSelector.agentList": "⟦萬萬 Άĝĕйŧ Ľíśτ 國國⟧",
4
+ "boxAI.agentSelector.defaultAgent": "⟦萬萬 Ďèƒãűļţ 國國⟧",
5
+ "boxAI.agentSelector.defaultStatus": "⟦萬萬 ĎĘ₣ΆŰĿŦ 國國⟧",
6
+ "boxAI.agentSelector.errorMessage": "⟦萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬 ₣āįĺèď ŧō ĺőäď ăνåįĺåвļē áĝëпťѕ. Υοű'řê ĉµřґęηťľŷ úşìиğ ўόúг õřĝâлĩżαťĩоή'ŝ ďеƒάûļť ăġēиŧ. Ċľį¢κ ħέѓë ţô ѓέťгУ. 國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國⟧",
7
+ "boxAI.agentSelector.errorTooltip": "⟦萬萬萬萬萬萬萬萬萬萬萬萬 ₣αĩļęď ťò ľοàď āναįļàвĺê αğёήŧѕ. Ŧґÿ ăĝåιη. 國國國國國國國國國國國國⟧",
8
+ "boxAI.agentSelector.loadingMessage": "⟦萬萬萬萬萬萬萬 Ĺôāďιŋġ ǻνāϊĺąвļë áğėʼnŧѕ 國國國國國國國⟧",
9
+ "boxAI.agentSelector.selectAgent": "⟦萬萬萬萬 Ŝěļėçť āп Äğĕпτ 國國國國⟧"
10
10
  }
@@ -1,16 +1,16 @@
1
1
  # AI agent label
2
- boxAI.agentSelector.agent = ⟦萬 Άğêήτ 國⟧
2
+ boxAI.agentSelector.agent = ⟦萬 Áĝéлŧ 國⟧
3
3
  # Aria Label for the list displaying the agents
4
- boxAI.agentSelector.agentList = ⟦萬萬 Ǻğέŋť Ļíśţ 國國⟧
4
+ boxAI.agentSelector.agentList = ⟦萬萬 Άĝĕйŧ Ľíśτ 國國⟧
5
5
  # Label for the default agent used when no other agents are available
6
- boxAI.agentSelector.defaultAgent = ⟦萬萬 Ďěƒąūĺţ 國國⟧
6
+ boxAI.agentSelector.defaultAgent = ⟦萬萬 Ďèƒãűļţ 國國⟧
7
7
  # Status indicator to define whether or not the agent on the list is the default for the enterprise
8
- boxAI.agentSelector.defaultStatus = ⟦萬萬 ĎĚ₣ĂŨĽŤ 國國⟧
8
+ boxAI.agentSelector.defaultStatus = ⟦萬萬 ĎĘ₣ΆŰĿŦ 國國⟧
9
9
  # Error message for retry option when the agents failed to load
10
- boxAI.agentSelector.errorMessage = ⟦萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬 ₣âĭľėď ţø ĺôàď ανăϊĺàвľе áġёлŧś. Ýоű'ŕє çüґяëŋţľỳ ůŝϊлĝ ýõűѓ õѓġåиįżàţιοп'ś ďεƒãüĺť ãġěńτ. Ĉļï¢ĸ ĥēřè ťσ řęŧŕỳ. 國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國⟧
10
+ boxAI.agentSelector.errorMessage = ⟦萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬 ₣āįĺèď ŧō ĺőäď ăνåįĺåвļē áĝëпťѕ. Υοű'řê ĉµřґęηťľŷ úşìиğ ўόúг õřĝâлĩżαťĩоή'ŝ ďеƒάûļť ăġēиŧ. Ċľį¢κ ħέѓë ţô ѓέťгУ. 國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國國⟧
11
11
  # Error tooltip content for agent selector when the agents failed to load
12
- boxAI.agentSelector.errorTooltip = ⟦萬萬萬萬萬萬萬萬萬萬萬萬 ₣ăîļėď ťσ ľòǻď άνãϊĺáьľė ąğéήťŝ. Ťґў ăġάіŋ. 國國國國國國國國國國國國⟧
12
+ boxAI.agentSelector.errorTooltip = ⟦萬萬萬萬萬萬萬萬萬萬萬萬 ₣αĩļęď ťò ľοàď āναįļàвĺê αğёήŧѕ. Ŧґÿ ăĝåιη. 國國國國國國國國國國國國⟧
13
13
  # Message for loading indicator while loading available agents
14
- boxAI.agentSelector.loadingMessage = ⟦萬萬萬萬萬萬萬 Ļòâďîήġ āνάīĺâьĺέ åġėпτŝ 國國國國國國國⟧
14
+ boxAI.agentSelector.loadingMessage = ⟦萬萬萬萬萬萬萬 Ĺôāďιŋġ ǻνāϊĺąвļë áğėʼnŧѕ 國國國國國國國⟧
15
15
  # Label for the AI agent selector when the user has not selected any agent
16
- boxAI.agentSelector.selectAgent = ⟦萬萬萬萬 Ŝёľëçţ ăņ Áġęηţ 國國國國⟧
16
+ boxAI.agentSelector.selectAgent = ⟦萬萬萬萬 Ŝěļėçť āп Äğĕпτ 國國國國⟧
@@ -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.15",
3
+ "version": "0.42.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@ariakit/react": "^0.4.15",