@box/box-ai-agent-selector 0.51.0 → 0.52.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,56 +1,58 @@
1
- import { TooltipProvider as m, Text as n, Tooltip as s, Status as u } from "@box/blueprint-web";
2
- import { BoxAiLogo24 as p } from "@box/blueprint-web-assets/icons/Logo";
1
+ import { TooltipProvider as u, Text as n, Tooltip as s, Status as p } from "@box/blueprint-web";
2
+ import { BoxAiLogo24 as i } from "@box/blueprint-web-assets/icons/Logo";
3
3
  import { SurfaceStatusSurfaceGray as f } from "@box/blueprint-web-assets/tokens/tokens";
4
4
  import { forwardRef as g, useMemo as _ } from "react";
5
5
  import { useIntl as I } from "react-intl";
6
6
  import h from "./messages.js";
7
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
8
- import '../../styles/box-ai-agent.css';const q = "_agentListItem_xtqqd_1", A = "_agentInfo_xtqqd_11", x = "_thumbnailWrapper_xtqqd_20", L = "_agentListItemIcon_xtqqd_23", N = "_defaultAgentHeader_xtqqd_33", S = "_agentHeader_xtqqd_44", v = "_defaultAgentName_xtqqd_51", b = "_agentDescription_xtqqd_59", H = "_defaultAgentStatusWrapper_xtqqd_69", a = {
7
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
8
+ import '../../styles/box-ai-agent.css';const q = "_agentListItem_xtqqd_1", A = "_agentInfo_xtqqd_11", x = "_thumbnailWrapper_xtqqd_20", L = "_agentListItemIcon_xtqqd_23", N = "_defaultAgentHeader_xtqqd_33", S = "_agentHeader_xtqqd_44", b = "_defaultAgentName_xtqqd_51", v = "_agentDescription_xtqqd_59", H = "_defaultAgentStatusWrapper_xtqqd_69", a = {
9
9
  agentListItem: q,
10
10
  agentInfo: A,
11
11
  thumbnailWrapper: x,
12
12
  agentListItemIcon: L,
13
13
  defaultAgentHeader: N,
14
14
  agentHeader: S,
15
- defaultAgentName: v,
16
- agentDescription: b,
15
+ defaultAgentName: b,
16
+ agentDescription: v,
17
17
  defaultAgentStatusWrapper: H
18
18
  }, w = /* @__PURE__ */ g(({
19
19
  agent: t
20
- }, o) => {
20
+ }, c) => {
21
21
  const {
22
- formatMessage: c
23
- } = I(), r = t.isEnterpriseDefault, d = _(() => {
22
+ formatMessage: d
23
+ } = I(), r = t.isEnterpriseDefault, l = _(() => {
24
24
  if (t.customIcon)
25
25
  return /* @__PURE__ */ e(t.customIcon, {});
26
26
  if (t.imageURL)
27
27
  try {
28
- const l = new URL(t.imageURL);
28
+ const m = new URL(t.imageURL);
29
29
  return /* @__PURE__ */ e("img", {
30
30
  "aria-label": t.name,
31
- src: l.toString()
31
+ src: m.toString()
32
32
  });
33
33
  } catch {
34
- return;
34
+ return /* @__PURE__ */ e(i, {
35
+ "aria-label": t.name
36
+ });
35
37
  }
36
38
  else
37
- return /* @__PURE__ */ e(p, {
39
+ return /* @__PURE__ */ e(i, {
38
40
  "aria-label": t.name
39
41
  });
40
42
  }, [t]);
41
43
  return /* @__PURE__ */ e("div", {
42
- ref: o,
44
+ ref: c,
43
45
  className: a.agentListItem,
44
46
  "data-target-id": "SmallList.Item-boxAIAgent",
45
47
  id: t.id,
46
- children: /* @__PURE__ */ i(m, {
48
+ children: /* @__PURE__ */ o(u, {
47
49
  children: [/* @__PURE__ */ e("div", {
48
50
  className: a.thumbnailWrapper,
49
51
  children: /* @__PURE__ */ e("div", {
50
52
  className: a.agentListItemIcon,
51
- children: d
53
+ children: l
52
54
  })
53
- }), /* @__PURE__ */ i("div", {
55
+ }), /* @__PURE__ */ o("div", {
54
56
  className: a.agentInfo,
55
57
  children: [/* @__PURE__ */ e(n, {
56
58
  as: "span",
@@ -81,10 +83,10 @@ import '../../styles/box-ai-agent.css';const q = "_agentListItem_xtqqd_1", A = "
81
83
  children: /* @__PURE__ */ e(n, {
82
84
  as: "span",
83
85
  className: a.defaultAgentStatusWrapper,
84
- children: r && /* @__PURE__ */ e(u, {
86
+ children: r && /* @__PURE__ */ e(p, {
85
87
  className: a.defaultAgentStatus,
86
88
  color: f,
87
- text: c(h.defaultStatus)
89
+ text: d(h.defaultStatus)
88
90
  })
89
91
  })
90
92
  })]
@@ -1,44 +1,44 @@
1
1
  import { R as E } from "../../../chunks/types.js";
2
2
  import { ACTIONS as t } from "./actions.js";
3
- const l = (r, e) => {
4
- var u;
3
+ const A = (s, e) => {
4
+ var u, l;
5
5
  switch (e.type) {
6
6
  case t.SET_AGENT_LIST: {
7
- const s = ((u = e == null ? void 0 : e.agents) == null ? void 0 : u.find((S) => S.isEnterpriseDefault)) || null;
8
- return {
7
+ let r = ((u = e == null ? void 0 : e.agents) == null ? void 0 : u.find((S) => S.isSelected)) || null;
8
+ return r || (r = ((l = e == null ? void 0 : e.agents) == null ? void 0 : l.find((S) => S.isEnterpriseDefault)) || null), {
9
9
  agents: (e == null ? void 0 : e.agents) || [],
10
10
  requestState: E.SUCCESS,
11
- selectedAgent: s
11
+ selectedAgent: r
12
12
  };
13
13
  }
14
14
  case t.SET_ASK_CONFIG:
15
15
  return {
16
- agents: r.agents.map((s) => s.id === e.id ? {
17
- ...s,
16
+ agents: s.agents.map((r) => r.id === e.id ? {
17
+ ...r,
18
18
  ask: e.ask
19
- } : s),
20
- requestState: r.requestState,
21
- selectedAgent: r.selectedAgent ? {
22
- ...r.selectedAgent,
19
+ } : r),
20
+ requestState: s.requestState,
21
+ selectedAgent: s.selectedAgent ? {
22
+ ...s.selectedAgent,
23
23
  ask: e.ask
24
24
  } : null
25
25
  };
26
26
  case t.SET_REQUEST_STATE:
27
27
  return {
28
- ...r,
28
+ ...s,
29
29
  requestState: e.requestState || E.NOT_STARTED
30
30
  };
31
31
  case t.SET_SELECTED_AGENT: {
32
- const s = r.agents.find((S) => S.id === e.id) || null;
32
+ const r = s.agents.find((S) => S.id === e.id) || null;
33
33
  return {
34
- ...r,
35
- selectedAgent: s
34
+ ...s,
35
+ selectedAgent: r
36
36
  };
37
37
  }
38
38
  default:
39
- return r;
39
+ return s;
40
40
  }
41
41
  };
42
42
  export {
43
- l as agentsReducer
43
+ A as agentsReducer
44
44
  };
@@ -1,4 +1,5 @@
1
1
  import { AgentState, AgentType } from '../types';
2
2
  export declare const mockAgents: AgentType[];
3
+ export declare const mockAgentsWithSelectedAgent: AgentType[];
3
4
  export declare const mockAgentsWithLongNamesAndDescriptions: AgentType[];
4
5
  export declare const mockAgentProviderState: AgentState;
@@ -7,6 +7,7 @@ export type AgentType = {
7
7
  description?: string;
8
8
  imageURL?: string;
9
9
  isEnterpriseDefault?: boolean;
10
+ isSelected?: boolean;
10
11
  suggestedQuestions?: string[] | null;
11
12
  customIcon?: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, 'ref'> & React.RefAttributes<SVGSVGElement>>;
12
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-agent-selector",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@ariakit/react": "^0.4.15",