@box/box-ai-agent-selector 0.51.1 → 0.52.1

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,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.1",
3
+ "version": "0.52.1",
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.55.0",
16
+ "@box/blueprint-web": "^12.56.0",
17
17
  "@box/blueprint-web-assets": "^4.63.0",
18
18
  "@box/eslint-plugin-blueprint": "^1.0.3",
19
19
  "@box/storybook-utils": "^0.13.18",