@box/box-ai-agent-selector 0.12.2 → 0.13.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/esm/index.js CHANGED
@@ -1,12 +1,16 @@
1
- import { BoxAiAgentSelectorWithApiContainer as t } from "./lib/box-ai-agent-selector-with-api-container.js";
2
- import { ACTIONS as A } from "./lib/contexts/actions.js";
3
- import { AgentsProvider as i, useAgents as n, useAgentsDispatch as p } from "./lib/contexts/context.js";
4
- import { R as g } from "../chunks/types.js";
1
+ import { BoxAiAgentSelector as t } from "./lib/box-ai-agent-selector.js";
2
+ import { BoxAiAgentSelectorWithApi as A } from "./lib/box-ai-agent-selector-with-api.js";
3
+ import { BoxAiAgentSelectorWithApiContainer as p } from "./lib/box-ai-agent-selector-with-api-container.js";
4
+ import { ACTIONS as n } from "./lib/contexts/actions.js";
5
+ import { AgentsProvider as f, useAgents as g, useAgentsDispatch as m } from "./lib/contexts/context.js";
6
+ import { R as c } from "../chunks/types.js";
5
7
  export {
6
- A as ACTIONS,
7
- i as AgentsProvider,
8
+ n as ACTIONS,
9
+ f as AgentsProvider,
8
10
  t as BoxAiAgentSelector,
9
- g as REQUEST_STATE,
10
- n as useAgents,
11
- p as useAgentsDispatch
11
+ A as BoxAiAgentSelectorWithApi,
12
+ p as BoxAiAgentSelectorWithApiContainer,
13
+ c as REQUEST_STATE,
14
+ g as useAgents,
15
+ m as useAgentsDispatch
12
16
  };
@@ -1,22 +1,26 @@
1
- import { BoxAiAgentSelectorWithApi as n } from "./box-ai-agent-selector-with-api.js";
2
- import { AgentsProvider as A } from "./contexts/context.js";
1
+ import { BoxAiAgentSelectorWithApi as m } from "./box-ai-agent-selector-with-api.js";
2
+ import { AgentsProvider as p } from "./contexts/context.js";
3
3
  import { jsx as r } from "react/jsx-runtime";
4
- function c({
4
+ function u({
5
5
  fetcher: t,
6
- shouldHideAgentSelectorOnLoad: e = !0,
7
- hostAppName: o,
8
- recordAction: i
6
+ hostAppName: e,
7
+ onSelectAgent: o,
8
+ recordAction: i,
9
+ requestState: n,
10
+ shouldHideAgentSelectorOnLoad: A = !0
9
11
  }) {
10
- return /* @__PURE__ */ r(A, {
11
- children: /* @__PURE__ */ r(n, {
12
+ return /* @__PURE__ */ r(p, {
13
+ children: /* @__PURE__ */ r(m, {
12
14
  fetcher: t,
13
- hostAppName: o,
15
+ hostAppName: e,
16
+ onSelectAgent: o,
14
17
  recordAction: i,
15
- shouldHideAgentSelectorOnLoad: e
18
+ requestState: n,
19
+ shouldHideAgentSelectorOnLoad: A
16
20
  })
17
21
  });
18
22
  }
19
23
  export {
20
- c as BoxAiAgentSelectorWithApiContainer,
21
- c as default
24
+ u as BoxAiAgentSelectorWithApiContainer,
25
+ u as default
22
26
  };
@@ -1,59 +1,71 @@
1
- import { useState as _, useCallback as T, useEffect as l } from "react";
2
- import { BoxAiAgentSelector as p } from "./box-ai-agent-selector.js";
3
- import { LOGGER_BASE_CONFIG as u, LOGGER_TARGET as R } from "./constants.js";
4
- import { ACTIONS as n } from "./contexts/actions.js";
5
- import { useAgentsDispatch as G, useAgents as O } from "./contexts/context.js";
6
- import { R as S } from "../../chunks/types.js";
1
+ import { useState as p, useCallback as m, useEffect as f } from "react";
2
+ import { BoxAiAgentSelector as C } from "./box-ai-agent-selector.js";
3
+ import { LOGGER_BASE_CONFIG as u, LOGGER_TARGET as a } from "./constants.js";
4
+ import { ACTIONS as E } from "./contexts/actions.js";
5
+ import { useAgentsDispatch as O, useAgents as N } from "./contexts/context.js";
6
+ import { R as i } from "../../chunks/types.js";
7
7
  import { jsx as h } from "react/jsx-runtime";
8
- function U({
9
- fetcher: E,
10
- shouldHideAgentSelectorOnLoad: a,
11
- hostAppName: i,
12
- recordAction: r
8
+ function y({
9
+ fetcher: R,
10
+ hostAppName: _,
11
+ onSelectAgent: T,
12
+ recordAction: n,
13
+ requestState: s,
14
+ shouldHideAgentSelectorOnLoad: g
13
15
  }) {
14
- const e = G(), {
15
- agents: A,
16
- requestState: c,
17
- selectedAgent: g
18
- } = O(), [m, f] = _(!1), s = T((t) => {
19
- r && (t.data ?? (t.data = {}), t.data.hostAppName = i, r(t));
20
- }, [i, r]), o = T(async () => {
16
+ const e = O(), {
17
+ agents: c,
18
+ requestState: S,
19
+ selectedAgent: o
20
+ } = N(), [G, l] = p(!1), r = m((t) => {
21
+ n && (t.data ?? (t.data = {}), t.data.hostAppName = _, n(t));
22
+ }, [_, n]), A = m(async () => {
21
23
  e({
22
- type: n.SET_REQUEST_STATE,
23
- requestState: S.IN_PROGRESS
24
+ type: E.SET_REQUEST_STATE,
25
+ requestState: i.IN_PROGRESS
24
26
  });
25
27
  try {
26
- const t = await E();
28
+ const t = await R();
27
29
  e({
28
- type: n.SET_AGENT_LIST,
30
+ type: E.SET_AGENT_LIST,
29
31
  agents: t.agents
30
- }), s({
32
+ }), r({
31
33
  ...u,
32
- target: R.LOADED_AGENTS
34
+ target: a.LOADED_AGENTS
33
35
  });
34
36
  } catch {
35
37
  e({
36
- type: n.SET_REQUEST_STATE,
37
- requestState: S.ERROR
38
- }), s({
38
+ type: E.SET_REQUEST_STATE,
39
+ requestState: i.ERROR
40
+ }), r({
39
41
  ...u,
40
- target: R.ERROR_LOADING_AGENTS
42
+ target: a.ERROR_LOADING_AGENTS
41
43
  });
42
44
  }
43
- }, [e, s, E]);
44
- return l(() => {
45
- o().finally(() => {
46
- f(!0);
45
+ }, [e, r, R]);
46
+ return f(() => {
47
+ A().finally(() => {
48
+ l(!0);
47
49
  });
48
- }, [o]), a && !m || c === S.SUCCESS && A.length <= 1 ? null : /* @__PURE__ */ h(p, {
49
- agents: A,
50
- onErrorAction: o,
51
- recordAction: s,
52
- requestState: c,
53
- selectedAgent: g
50
+ }, [A]), f(() => {
51
+ s && s !== S && (s !== i.SUCCESS && e({
52
+ type: E.SET_AGENT_LIST,
53
+ agents: []
54
+ }), e({
55
+ type: E.SET_REQUEST_STATE,
56
+ requestState: s
57
+ }));
58
+ }, [e, S, s]), f(() => {
59
+ T && T(o);
60
+ }, [T, o]), g && !G || S === i.SUCCESS && c.length <= 1 ? null : /* @__PURE__ */ h(C, {
61
+ agents: c,
62
+ onErrorAction: A,
63
+ recordAction: r,
64
+ requestState: S,
65
+ selectedAgent: o
54
66
  });
55
67
  }
56
68
  export {
57
- U as BoxAiAgentSelectorWithApi,
58
- U as default
69
+ y as BoxAiAgentSelectorWithApi,
70
+ y as default
59
71
  };
@@ -1,107 +1,128 @@
1
1
  import "../../styles/box-ai-agent-selector.css";
2
- import { FilterChip as l, Popover as g, Tooltip as y, Status as j, LoadingIndicator as w, SmallList as B, Button as b } from "@box/blueprint-web";
3
- import { AlertBadge as x } from "@box/blueprint-web-assets/icons/Fill";
4
- import { useState as P, useEffect as A, useCallback as I } from "react";
5
- import { useIntl as D } from "react-intl";
6
- import { BoxAiAgent as M } from "./box-ai-agent.js";
7
- import { LOGGER_BASE_CONFIG as E, LOGGER_ACTION_CLICK as f, LOGGER_TARGET as d } from "./constants.js";
8
- import { ACTIONS as k } from "./contexts/actions.js";
9
- import { useAgentsDispatch as F } from "./contexts/context.js";
2
+ import { useFullTextTooltip as B, FilterChip as c, Popover as p, Tooltip as v, Status as w, LoadingIndicator as P, SmallList as A, Button as D } from "@box/blueprint-web";
3
+ import { AlertBadge as M } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { useState as F, useRef as j, useEffect as K, useCallback as x } from "react";
5
+ import { useIntl as U } from "react-intl";
6
+ import { BoxAiAgent as Q } from "./box-ai-agent.js";
7
+ import { LOGGER_BASE_CONFIG as L, LOGGER_ACTION_CLICK as f, LOGGER_TARGET as E } from "./constants.js";
8
+ import { ACTIONS as V } from "./contexts/actions.js";
9
+ import { useAgentsDispatch as W } from "./contexts/context.js";
10
10
  import r from "./messages.js";
11
- import { R as S } from "../../chunks/types.js";
12
- import { jsx as t, jsxs as h } from "react/jsx-runtime";
13
- const K = "_agentSelector_1vtwj_1", U = "_agentStatus_1vtwj_4", Q = "_agentLoader_1vtwj_18", Y = "_agentError_1vtwj_21", z = "_agentListItemIcon_1vtwj_25", H = "_agentListContainer_1vtwj_30", J = "_agentListRetryButton_1vtwj_35", a = {
14
- agentSelector: K,
15
- agentStatus: U,
16
- agentLoader: Q,
17
- agentError: Y,
18
- agentListItemIcon: z,
19
- agentListContainer: H,
20
- agentListRetryButton: J
11
+ import { R as h } from "../../chunks/types.js";
12
+ import { jsx as t, jsxs as u } from "react/jsx-runtime";
13
+ const Y = "_agentSelector_1k90x_1", z = "_agentStatus_1k90x_4", H = "_agentLoader_1k90x_18", J = "_agentError_1k90x_21", X = "_triggerChip_1k90x_24", Z = "_agentLabel_1k90x_29", $ = "_dropdownIndicator_1k90x_35", q = "_agentListItemIcon_1k90x_44", tt = "_agentListContainer_1k90x_49", et = "_agentListRetryButton_1k90x_59", e = {
14
+ agentSelector: Y,
15
+ agentStatus: z,
16
+ agentLoader: H,
17
+ agentError: J,
18
+ triggerChip: X,
19
+ agentLabel: Z,
20
+ dropdownIndicator: $,
21
+ agentListItemIcon: q,
22
+ agentListContainer: tt,
23
+ agentListRetryButton: et
21
24
  };
22
- function it({
25
+ function dt({
23
26
  agents: N,
24
- onErrorAction: u,
27
+ onErrorAction: C,
28
+ recordAction: a,
25
29
  requestState: m,
26
- selectedAgent: n,
27
- recordAction: e
30
+ selectedAgent: n
28
31
  }) {
29
32
  const {
30
33
  formatMessage: o
31
- } = D(), [c, p] = P(!1), C = o(r.selectAgent), v = o(r.defaultAgent), R = F(), T = m === S.SUCCESS, _ = m === S.IN_PROGRESS, s = m === S.ERROR;
32
- let L = "";
33
- T ? L = (n == null ? void 0 : n.name) || C : s && (L = v), A(() => {
34
- c && e && e({
35
- ...E,
34
+ } = U(), [l, _] = F(!1), S = o(r.selectAgent), G = o(r.defaultAgent), I = W(), R = m === h.SUCCESS, d = m === h.IN_PROGRESS, g = m === h.ERROR;
35
+ let i = "";
36
+ R ? i = (n == null ? void 0 : n.name) || S : g && (i = G);
37
+ const T = j(null), {
38
+ Wrapper: O,
39
+ wrapperProps: b
40
+ } = B({
41
+ ref: T,
42
+ textValue: i
43
+ });
44
+ K(() => {
45
+ l && a && a({
46
+ ...L,
36
47
  action: f,
37
- target: d.OPEN_SELECTOR
48
+ target: E.OPEN_SELECTOR
38
49
  });
39
- }, [c, e]);
40
- const G = I((i) => {
41
- p(!1), R({
42
- type: k.SET_SELECTED_AGENT,
43
- id: i.id
44
- }), e && e({
45
- ...E,
50
+ }, [l, a]);
51
+ const k = x((s) => {
52
+ _(!1), I({
53
+ type: V.SET_SELECTED_AGENT,
54
+ id: s.id
55
+ }), a && a({
56
+ ...L,
46
57
  action: f,
47
- target: d.SELECT_AGENT
58
+ target: E.SELECT_AGENT
48
59
  });
49
- }, [R, e]), O = I(() => {
50
- p(!1), u(), e && e({
51
- ...E,
60
+ }, [I, a]), y = x(() => {
61
+ _(!1), C(), a && a({
62
+ ...L,
52
63
  action: f,
53
- target: d.RETRY_LOADING_AGENTS
64
+ target: E.RETRY_LOADING_AGENTS
54
65
  });
55
- }, [u, e]);
56
- return /* @__PURE__ */ t(l.Group, {
57
- className: a.agentSelector,
58
- name: C,
66
+ }, [C, a]);
67
+ return /* @__PURE__ */ t(c.Group, {
68
+ className: e.agentSelector,
69
+ name: S,
59
70
  type: "multiple",
60
- children: /* @__PURE__ */ h(g.Root, {
71
+ children: /* @__PURE__ */ u(p.Root, {
61
72
  modal: !1,
62
- onOpenChange: p,
63
- open: c,
64
- children: [/* @__PURE__ */ t(y, {
73
+ onOpenChange: _,
74
+ open: l,
75
+ children: [/* @__PURE__ */ t(v, {
65
76
  content: o(r.errorTooltip),
66
- hidden: !s,
77
+ hidden: !g || l,
67
78
  side: "bottom",
68
79
  variant: "error",
69
- children: /* @__PURE__ */ t(g.Trigger, {
70
- disabled: _,
71
- children: /* @__PURE__ */ h(l.TriggerChip, {
80
+ children: /* @__PURE__ */ t(p.Trigger, {
81
+ disabled: d,
82
+ children: /* @__PURE__ */ u(c.TriggerChip, {
83
+ className: e.triggerChip,
72
84
  value: "trigger-chip",
73
- children: [/* @__PURE__ */ t(j, {
74
- className: a.agentStatus,
85
+ children: [/* @__PURE__ */ t(w, {
86
+ className: e.agentStatus,
75
87
  colorIndex: 0,
76
88
  text: o(r.agent)
77
- }), _ && /* @__PURE__ */ t(w, {
89
+ }), d && /* @__PURE__ */ t(P, {
78
90
  "aria-label": o(r.loadingMessage),
79
- className: a.agentLoader,
91
+ className: e.agentLoader,
80
92
  variant: "default"
81
- }), s && /* @__PURE__ */ t(x, {
82
- className: a.agentError,
93
+ }), g && /* @__PURE__ */ t(M, {
94
+ className: e.agentError,
83
95
  height: "1rem",
84
96
  role: "presentation",
85
97
  width: "1rem"
86
- }), /* @__PURE__ */ t(l.Label, {
87
- children: L
88
- }), !_ && /* @__PURE__ */ t(l.DropdownIndicator, {})]
98
+ }), /* @__PURE__ */ t(O, {
99
+ ...b,
100
+ content: i,
101
+ children: /* @__PURE__ */ t(c.Label, {
102
+ ref: T,
103
+ className: e.agentLabel,
104
+ children: i
105
+ })
106
+ }), !d && /* @__PURE__ */ t("div", {
107
+ className: e.dropdownIndicator,
108
+ children: /* @__PURE__ */ t(c.DropdownIndicator, {})
109
+ })]
89
110
  })
90
111
  })
91
- }), /* @__PURE__ */ t(g.ContentContainer, {
112
+ }), /* @__PURE__ */ t(p.ContentContainer, {
92
113
  align: "start",
93
- className: a.agentListContainer,
94
- children: /* @__PURE__ */ h(g.MainContent, {
95
- children: [T && /* @__PURE__ */ t(B, {
96
- className: a.agentList,
114
+ className: e.agentListContainer,
115
+ children: /* @__PURE__ */ u(p.MainContent, {
116
+ children: [R && /* @__PURE__ */ t(A, {
117
+ className: e.agentList,
97
118
  selectedKeys: [(n == null ? void 0 : n.id) || ""],
98
- children: N.map((i) => /* @__PURE__ */ t(M, {
99
- agent: i,
100
- onAction: () => G(i)
101
- }, i.id))
102
- }), s && /* @__PURE__ */ t(b, {
103
- className: a.agentListRetryButton,
104
- onClick: O,
119
+ children: N.map((s) => /* @__PURE__ */ t(Q, {
120
+ agent: s,
121
+ onAction: () => k(s)
122
+ }, s.id))
123
+ }), g && /* @__PURE__ */ t(D, {
124
+ className: e.agentListRetryButton,
125
+ onClick: y,
105
126
  variant: "tertiary",
106
127
  children: o(r.errorMessage)
107
128
  })]
@@ -111,6 +132,6 @@ function it({
111
132
  });
112
133
  }
113
134
  export {
114
- it as BoxAiAgentSelector,
115
- it as default
135
+ dt as BoxAiAgentSelector,
136
+ dt as default
116
137
  };
@@ -1,52 +1,62 @@
1
1
  import "../../styles/box-ai-agent.css";
2
- import { SmallList as s, Tooltip as o, Text as r, Status as c } from "@box/blueprint-web";
3
- import { BoxAiLogo as d } from "@box/blueprint-web-assets/icons/Logo";
4
- import { SurfaceStatusSurfaceGray as u } from "@box/blueprint-web-assets/tokens/tokens";
5
- import { useIntl as f } from "react-intl";
6
- import g from "./messages.js";
7
- import { jsxs as i, jsx as t, Fragment as A } from "react/jsx-runtime";
8
- const _ = "_agentListItem_1s7vn_1", p = "_agentListItemIcon_1s7vn_1", I = "_defaultAgentHeader_1s7vn_5", L = "_defaultAgentName_1s7vn_9", S = "_defaultAgentStatus_1s7vn_15", a = {
9
- agentListItem: _,
10
- agentListItemIcon: p,
11
- defaultAgentHeader: I,
12
- defaultAgentName: L,
13
- defaultAgentStatus: S
2
+ import { useFullTextTooltip as u, SmallList as s, Text as d, Status as f } from "@box/blueprint-web";
3
+ import { BoxAiLogo as p } from "@box/blueprint-web-assets/icons/Logo";
4
+ import { SurfaceStatusSurfaceGray as g } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import { useRef as A } from "react";
6
+ import { useIntl as _ } from "react-intl";
7
+ import I from "./messages.js";
8
+ import { jsxs as i, jsx as t, Fragment as L } from "react/jsx-runtime";
9
+ const S = "_agentListItem_1s7vn_1", x = "_agentListItemIcon_1s7vn_1", N = "_defaultAgentHeader_1s7vn_5", h = "_defaultAgentName_1s7vn_9", v = "_defaultAgentStatus_1s7vn_15", a = {
10
+ agentListItem: S,
11
+ agentListItemIcon: x,
12
+ defaultAgentHeader: N,
13
+ defaultAgentName: h,
14
+ defaultAgentStatus: v
14
15
  };
15
- function y({
16
+ function w({
16
17
  agent: e,
17
- onAction: m
18
+ onAction: l
18
19
  }) {
19
20
  const {
20
- formatMessage: l
21
- } = f(), n = e.isEnterpriseDefault;
21
+ formatMessage: m
22
+ } = _(), n = e.isEnterpriseDefault, r = A(null), {
23
+ Wrapper: o,
24
+ wrapperProps: c
25
+ } = u({
26
+ ref: r,
27
+ textValue: e.name,
28
+ skipOverflowCheck: !n
29
+ });
22
30
  return /* @__PURE__ */ i(s.Item, {
23
31
  className: a.agentListItem,
24
32
  id: e.id,
25
- onAction: m,
33
+ onAction: l,
26
34
  children: [/* @__PURE__ */ t(s.Thumbnail, {
27
35
  className: a.agentListItemIcon,
28
36
  children: e.imageURL ? /* @__PURE__ */ t("img", {
29
37
  "aria-label": e.name,
30
38
  src: e.imageURL
31
- }) : /* @__PURE__ */ t(d, {
39
+ }) : /* @__PURE__ */ t(p, {
32
40
  "aria-label": e.name
33
41
  })
34
42
  }), /* @__PURE__ */ t(s.Header, {
35
43
  className: n ? a.defaultAgentHeader : void 0,
36
44
  textValue: e.name,
37
- children: n ? /* @__PURE__ */ i(A, {
45
+ children: n ? /* @__PURE__ */ i(L, {
38
46
  children: [/* @__PURE__ */ t(o, {
47
+ ...c,
39
48
  content: e.name,
40
- children: /* @__PURE__ */ t(r, {
49
+ children: /* @__PURE__ */ t(d, {
50
+ ref: r,
41
51
  as: "span",
42
52
  className: a.defaultAgentName,
43
53
  variant: "bodyDefaultSemibold",
44
54
  children: e.name
45
55
  })
46
- }), /* @__PURE__ */ t(c, {
56
+ }), /* @__PURE__ */ t(f, {
47
57
  className: a.defaultAgentStatus,
48
- color: u,
49
- text: l(g.defaultStatus)
58
+ color: g,
59
+ text: m(I.defaultStatus)
50
60
  })]
51
61
  }) : e.name
52
62
  }), e.description && /* @__PURE__ */ t(s.Subtitle, {
@@ -56,6 +66,6 @@ function y({
56
66
  });
57
67
  }
58
68
  export {
59
- y as BoxAiAgent,
60
- y as default
69
+ w as BoxAiAgent,
70
+ w as default
61
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-agent-selector",
3
- "version": "0.12.2",
3
+ "version": "0.13.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^7.31.1",
@@ -10,7 +10,7 @@
10
10
  "react-intl": "^6.4.2"
11
11
  },
12
12
  "devDependencies": {
13
- "@box/blueprint-web": "^8.2.1",
13
+ "@box/blueprint-web": "^8.3.1",
14
14
  "@box/blueprint-web-assets": "^4.28.0",
15
15
  "@box/eslint-plugin-blueprint": "*",
16
16
  "@box/storybook-utils": "^0.7.0",
@@ -46,5 +46,5 @@
46
46
  "sideEffects": [
47
47
  "**/*.css"
48
48
  ],
49
- "gitHead": "96011024263060e997f2e1fe8ae9e496bc68be33"
49
+ "gitHead": "bef9db208515d53f0fb75d387d1740b389f6f753"
50
50
  }
@@ -1 +1 @@
1
- ._agentSelector_1vtwj_1{margin-inline-start:.75rem}._agentSelector_1vtwj_1 ._agentStatus_1vtwj_4{margin-inline-start:.5rem}._agentSelector_1vtwj_1 ._agentStatus_1vtwj_4>span{background:linear-gradient(#f4f4f4 0,#f4f4f4 0) padding-box,linear-gradient(135deg,#fe01da,#2486fc) border-box;border:.0625rem solid rgba(0,0,0,0)}._agentSelector_1vtwj_1 ._agentStatus_1vtwj_4>span span{background:linear-gradient(135deg,#fe01da,#2486fc);color:transparent;-webkit-background-clip:text;background-clip:text;text-transform:uppercase}._agentSelector_1vtwj_1 ._agentLoader_1vtwj_18{position:inherit}._agentSelector_1vtwj_1 ._agentError_1vtwj_21 path{fill:#d5324e}._agentListItemIcon_1vtwj_25{height:2rem;width:2rem}._agentListContainer_1vtwj_30{min-width:320px;max-width:500px}._agentListRetryButton_1vtwj_35{margin:.25rem;max-width:320px;text-wrap:wrap}
1
+ ._agentSelector_1k90x_1{margin-inline-start:.75rem}._agentSelector_1k90x_1 ._agentStatus_1k90x_4{margin-inline-start:.5rem}._agentSelector_1k90x_1 ._agentStatus_1k90x_4>span{background:linear-gradient(#f4f4f4 0,#f4f4f4 0) padding-box,linear-gradient(135deg,#fe01da,#2486fc) border-box;border:.0625rem solid rgba(0,0,0,0)}._agentSelector_1k90x_1 ._agentStatus_1k90x_4>span span{background:linear-gradient(135deg,#fe01da,#2486fc);color:transparent;-webkit-background-clip:text;background-clip:text;text-transform:uppercase}._agentSelector_1k90x_1 ._agentLoader_1k90x_18{position:inherit}._agentSelector_1k90x_1 ._agentError_1k90x_21 path{fill:#d5324e}._agentSelector_1k90x_1 ._triggerChip_1k90x_24{max-width:376px;display:flex;text-align:start}._agentSelector_1k90x_1 ._triggerChip_1k90x_24 ._agentLabel_1k90x_29{flex-grow:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._agentSelector_1k90x_1 ._triggerChip_1k90x_24 ._dropdownIndicator_1k90x_35{flex-shrink:0}@media (max-width: 374px){._agentSelector_1k90x_1 ._triggerChip_1k90x_24{width:100%}}._agentListItemIcon_1k90x_44{height:2rem;width:2rem}._agentListContainer_1k90x_49{min-width:320px;max-width:376px}@media (max-width: 376px){._agentListContainer_1k90x_49{max-width:320px}}._agentListRetryButton_1k90x_59{margin:.25rem;max-width:320px;text-wrap:wrap}
package/types/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- export { BoxAiAgentSelectorWithApiContainer as BoxAiAgentSelector } from './lib/box-ai-agent-selector-with-api-container';
1
+ export * from './lib/box-ai-agent-selector';
2
+ export * from './lib/box-ai-agent-selector-with-api';
3
+ export * from './lib/box-ai-agent-selector-with-api-container';
2
4
  export * from './lib/contexts';
3
5
  export * from './lib/types';
@@ -1,25 +1,3 @@
1
- import { type AgentListResponse, type RecordActionType } from './types';
2
- export interface BoxAiAgentSelectorWithApiContainerProps {
3
- /**
4
- * Function responsible for fetching the list of agents,
5
- * typically passed from the parent component.
6
- * The function returns a promise that resolves to the agent list response.
7
- */
8
- fetcher: () => Promise<AgentListResponse>;
9
- /**
10
- * Name of the host application for resin event tracking
11
- * */
12
- hostAppName?: string;
13
- /**
14
- * Callback function to handle logging resin events
15
- * */
16
- recordAction?: (payload: RecordActionType) => void;
17
- /**
18
- * Determines whether the agent selector component should remain hidden
19
- * until the initial data fetch is complete.
20
- * @default true
21
- */
22
- shouldHideAgentSelectorOnLoad?: boolean;
23
- }
24
- export declare function BoxAiAgentSelectorWithApiContainer({ fetcher, shouldHideAgentSelectorOnLoad, hostAppName, recordAction, }: BoxAiAgentSelectorWithApiContainerProps): import("react/jsx-runtime").JSX.Element;
1
+ import { type BoxAiAgentSelectorWithApiProps } from './types';
2
+ export declare function BoxAiAgentSelectorWithApiContainer({ fetcher, hostAppName, onSelectAgent, recordAction, requestState, shouldHideAgentSelectorOnLoad, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element;
25
3
  export default BoxAiAgentSelectorWithApiContainer;
@@ -1,25 +1,3 @@
1
- import { type AgentListResponse, type RecordActionType } from './types';
2
- export interface BoxAiAgentSelectorWithApiProps {
3
- /**
4
- * Function responsible for fetching the list of agents,
5
- * typically passed from the parent component.
6
- * The function returns a promise that resolves to the agent list response.
7
- */
8
- fetcher: () => Promise<AgentListResponse>;
9
- /**
10
- * Name of the host application for resin event tracking
11
- * */
12
- hostAppName?: string;
13
- /**
14
- * Callback function to handle logging resin events
15
- * */
16
- recordAction?: (payload: RecordActionType) => void;
17
- /**
18
- * Determines whether the agent selector component should remain hidden
19
- * until the initial data fetch is complete.
20
- * @default true
21
- */
22
- shouldHideAgentSelectorOnLoad?: boolean;
23
- }
24
- export declare function BoxAiAgentSelectorWithApi({ fetcher, shouldHideAgentSelectorOnLoad, hostAppName, recordAction, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element | null;
1
+ import { type BoxAiAgentSelectorWithApiProps } from './types';
2
+ export declare function BoxAiAgentSelectorWithApi({ fetcher, hostAppName, onSelectAgent, recordAction, requestState: requestStateProp, shouldHideAgentSelectorOnLoad, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element | null;
25
3
  export default BoxAiAgentSelectorWithApi;
@@ -1,25 +1,3 @@
1
- import { REQUEST_STATE, type AgentType, type RecordActionType } from './types';
2
- export interface BoxAiAgentSelectorProps {
3
- /**
4
- * Array of available agents to select from.
5
- */
6
- agents: AgentType[];
7
- /**
8
- * Callback function triggered when an error occurs, used to retry fetching the agent list.
9
- */
10
- onErrorAction: () => void;
11
- /**
12
- * Callback function to handle logging resin events
13
- * */
14
- recordAction?: (payload: RecordActionType) => void;
15
- /**
16
- * Current state of the request to fetch agents, representing one of: Success, Error, In Progress, or Not Started.
17
- */
18
- requestState: REQUEST_STATE;
19
- /**
20
- * The currently selected agent, or null if no agent is selected.
21
- */
22
- selectedAgent: AgentType | null;
23
- }
24
- export declare function BoxAiAgentSelector({ agents, onErrorAction, requestState, selectedAgent, recordAction, }: BoxAiAgentSelectorProps): import("react/jsx-runtime").JSX.Element;
1
+ import { type BoxAiAgentSelectorProps } from './types';
2
+ export declare function BoxAiAgentSelector({ agents, onErrorAction, recordAction, requestState, selectedAgent, }: BoxAiAgentSelectorProps): import("react/jsx-runtime").JSX.Element;
25
3
  export default BoxAiAgentSelector;
@@ -0,0 +1,7 @@
1
+ import { type BoxAiAgentSelectorWithApiProps } from '../../index';
2
+ export declare const defaultBoxAiAgentSelectorProps: {
3
+ fetcher: () => Promise<{
4
+ agents: import("../types").AgentType[];
5
+ }>;
6
+ };
7
+ export declare const DefaultBoxAiAgentSelectorWithApiContainer: (props: BoxAiAgentSelectorWithApiProps) => import("react/jsx-runtime").JSX.Element;
@@ -39,3 +39,52 @@ export type RecordActionType = {
39
39
  feature: string;
40
40
  target?: string;
41
41
  };
42
+ export interface BoxAiAgentSelectorWithApiProps {
43
+ /**
44
+ * Function responsible for fetching the list of agents,
45
+ * typically passed from the parent component.
46
+ * The function returns a promise that resolves to the agent list response.
47
+ */
48
+ fetcher: () => Promise<AgentListResponse>;
49
+ /**
50
+ * Name of the host application for resin event tracking
51
+ * */
52
+ hostAppName?: string;
53
+ /** Callback function when an agent is selected */
54
+ onSelectAgent?: (agent: AgentType | null) => void;
55
+ /**
56
+ * Callback function to handle logging resin events
57
+ * */
58
+ recordAction?: (payload: RecordActionType) => void;
59
+ /** Request state of the list fetching
60
+ */
61
+ requestState?: REQUEST_STATE | null;
62
+ /**
63
+ * Determines whether the agent selector component should remain hidden
64
+ * until the initial data fetch is complete.
65
+ * @default true
66
+ */
67
+ shouldHideAgentSelectorOnLoad?: boolean;
68
+ }
69
+ export interface BoxAiAgentSelectorProps {
70
+ /**
71
+ * Array of available agents to select from.
72
+ */
73
+ agents: AgentType[];
74
+ /**
75
+ * Callback function triggered when an error occurs, used to retry fetching the agent list.
76
+ */
77
+ onErrorAction: () => void;
78
+ /**
79
+ * Callback function to handle logging resin events
80
+ * */
81
+ recordAction?: (payload: RecordActionType) => void;
82
+ /**
83
+ * Current state of the request to fetch agents, representing one of: Success, Error, In Progress, or Not Started.
84
+ */
85
+ requestState: REQUEST_STATE;
86
+ /**
87
+ * The currently selected agent, or null if no agent is selected.
88
+ */
89
+ selectedAgent: AgentType | null;
90
+ }
@@ -1,4 +0,0 @@
1
- import { type AgentState } from '../../types';
2
- import { type AgentsProviderProps } from '../context';
3
- export declare const initialState: AgentState;
4
- export declare const DefaultContextProvider: ({ value }: AgentsProviderProps) => import("react/jsx-runtime").JSX.Element;