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