@box/box-ai-agent-selector 0.47.14 → 0.48.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,85 +1,90 @@
1
- import { TooltipProvider as c, Text as n, Tooltip as i, Status as m } from "@box/blueprint-web";
1
+ import { TooltipProvider as m, Text as n, Tooltip as s, Status as u } from "@box/blueprint-web";
2
2
  import { BoxAiLogo as p } from "@box/blueprint-web-assets/icons/Logo";
3
- import { SurfaceStatusSurfaceGray as u } from "@box/blueprint-web-assets/tokens/tokens";
4
- import { forwardRef as f, useMemo as g } from "react";
5
- import { useIntl as _ } from "react-intl";
6
- import I from "./messages.js";
7
- import { jsx as t, jsxs as o } from "react/jsx-runtime";
8
- import '../../styles/box-ai-agent.css';const h = "_agentListItem_xtqqd_1", q = "_agentInfo_xtqqd_11", A = "_thumbnailWrapper_xtqqd_20", x = "_agentListItemIcon_xtqqd_23", v = "_defaultAgentHeader_xtqqd_33", L = "_agentHeader_xtqqd_44", N = "_defaultAgentName_xtqqd_51", S = "_agentDescription_xtqqd_59", b = "_defaultAgentStatusWrapper_xtqqd_69", a = {
9
- agentListItem: h,
10
- agentInfo: q,
11
- thumbnailWrapper: A,
12
- agentListItemIcon: x,
13
- defaultAgentHeader: v,
14
- agentHeader: L,
15
- defaultAgentName: N,
16
- agentDescription: S,
17
- defaultAgentStatusWrapper: b
18
- }, w = /* @__PURE__ */ f(({
19
- agent: e
20
- }, d) => {
3
+ import { SurfaceStatusSurfaceGray as f } from "@box/blueprint-web-assets/tokens/tokens";
4
+ import { forwardRef as g, useMemo as _ } from "react";
5
+ import { useIntl as I } from "react-intl";
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 = {
9
+ agentListItem: q,
10
+ agentInfo: A,
11
+ thumbnailWrapper: x,
12
+ agentListItemIcon: L,
13
+ defaultAgentHeader: N,
14
+ agentHeader: S,
15
+ defaultAgentName: v,
16
+ agentDescription: b,
17
+ defaultAgentStatusWrapper: H
18
+ }, w = /* @__PURE__ */ g(({
19
+ agent: t
20
+ }, o) => {
21
21
  const {
22
- formatMessage: l
23
- } = _(), r = e.isEnterpriseDefault, s = g(() => {
24
- if (e.imageURL)
22
+ formatMessage: c
23
+ } = I(), r = t.isEnterpriseDefault, d = _(() => {
24
+ if (t.customIcon)
25
+ return /* @__PURE__ */ e(t.customIcon, {});
26
+ if (t.imageURL)
25
27
  try {
26
- return new URL(e.imageURL).toString();
28
+ const l = new URL(t.imageURL);
29
+ return /* @__PURE__ */ e("img", {
30
+ "aria-label": t.name,
31
+ src: l.toString()
32
+ });
27
33
  } catch {
28
34
  return;
29
35
  }
30
- }, [e]);
31
- return /* @__PURE__ */ t("div", {
32
- ref: d,
36
+ else
37
+ return /* @__PURE__ */ e(p, {
38
+ "aria-label": t.name
39
+ });
40
+ }, [t]);
41
+ return /* @__PURE__ */ e("div", {
42
+ ref: o,
33
43
  className: a.agentListItem,
34
44
  "data-target-id": "SmallList.Item-boxAIAgent",
35
- id: e.id,
36
- children: /* @__PURE__ */ o(c, {
37
- children: [/* @__PURE__ */ t("div", {
45
+ id: t.id,
46
+ children: /* @__PURE__ */ i(m, {
47
+ children: [/* @__PURE__ */ e("div", {
38
48
  className: a.thumbnailWrapper,
39
- children: /* @__PURE__ */ t("div", {
49
+ children: /* @__PURE__ */ e("div", {
40
50
  className: a.agentListItemIcon,
41
- children: s ? /* @__PURE__ */ t("img", {
42
- "aria-label": e.name,
43
- src: s
44
- }) : /* @__PURE__ */ t(p, {
45
- "aria-label": e.name
46
- })
51
+ children: d
47
52
  })
48
- }), /* @__PURE__ */ o("div", {
53
+ }), /* @__PURE__ */ i("div", {
49
54
  className: a.agentInfo,
50
- children: [/* @__PURE__ */ t(n, {
55
+ children: [/* @__PURE__ */ e(n, {
51
56
  as: "span",
52
57
  className: r ? a.defaultAgentHeader : a.agentHeader,
53
- children: r ? /* @__PURE__ */ t(i, {
54
- content: e.name,
55
- children: /* @__PURE__ */ t(n, {
58
+ children: r ? /* @__PURE__ */ e(s, {
59
+ content: t.name,
60
+ children: /* @__PURE__ */ e(n, {
56
61
  as: "span",
57
62
  className: a.defaultAgentName,
58
63
  variant: "subtitle",
59
- children: e.name
64
+ children: t.name
60
65
  })
61
- }) : /* @__PURE__ */ t(n, {
66
+ }) : /* @__PURE__ */ e(n, {
62
67
  as: "span",
63
68
  variant: "subtitle",
64
- children: e.name
69
+ children: t.name
65
70
  })
66
- }), e.description && /* @__PURE__ */ t(i, {
67
- content: e.description,
68
- children: /* @__PURE__ */ t(n, {
71
+ }), t.description && /* @__PURE__ */ e(s, {
72
+ content: t.description,
73
+ children: /* @__PURE__ */ e(n, {
69
74
  as: "span",
70
75
  className: a.agentDescription,
71
76
  variant: "caption",
72
- children: e.description
77
+ children: t.description
73
78
  })
74
79
  })]
75
- }), /* @__PURE__ */ t("div", {
76
- children: /* @__PURE__ */ t(n, {
80
+ }), /* @__PURE__ */ e("div", {
81
+ children: /* @__PURE__ */ e(n, {
77
82
  as: "span",
78
83
  className: a.defaultAgentStatusWrapper,
79
- children: r && /* @__PURE__ */ t(m, {
84
+ children: r && /* @__PURE__ */ e(u, {
80
85
  className: a.defaultAgentStatus,
81
- color: u,
82
- text: l(I.defaultStatus)
86
+ color: f,
87
+ text: c(h.defaultStatus)
83
88
  })
84
89
  })
85
90
  })]
@@ -1,3 +1,3 @@
1
1
  import { BoxAiAgentSelectorWithApiProps } from './types';
2
- export declare function BoxAiAgentSelectorWithApiContainer({ fetcher, hostAppName, onSelectAgent, onSelectedAgentCallback, 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, useAgentLocalStorage, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default BoxAiAgentSelectorWithApiContainer;
@@ -1,3 +1,4 @@
1
1
  import { BoxAiAgentSelectorWithApiProps } from './types';
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;
2
+ export declare function BoxAiAgentSelectorWithApi({ fetcher, hostAppName, onSelectAgent, onSelectedAgentCallback, recordAction, requestState: requestStateProp, disabled, onAgentsListOpen, shouldHideAgentSelectorOnLoad, triggerChipClassName, contentClassName, useAgentLocalStorage, // All non-Box AI Q&A experiences should pass in false
3
+ variant, }: BoxAiAgentSelectorWithApiProps): import("react/jsx-runtime").JSX.Element | null;
3
4
  export default BoxAiAgentSelectorWithApi;
@@ -1,3 +1,4 @@
1
1
  import { BoxAiAgentSelectorProps } from './types';
2
- export declare function BoxAiAgentSelector({ agents, contentClassName, onErrorAction, recordAction, requestState, disabled, onAgentsListOpen, selectedAgent, triggerChipClassName, variant, }: BoxAiAgentSelectorProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function BoxAiAgentSelector({ agents, contentClassName, onErrorAction, recordAction, requestState, disabled, onAgentsListOpen, selectedAgent, triggerChipClassName, useAgentLocalStorage, // All non-Box AI Q&A experiences should pass in true
3
+ variant, }: BoxAiAgentSelectorProps): import("react/jsx-runtime").JSX.Element;
3
4
  export default BoxAiAgentSelector;
@@ -8,6 +8,7 @@ export type AgentType = {
8
8
  imageURL?: string;
9
9
  isEnterpriseDefault?: boolean;
10
10
  suggestedQuestions?: string[] | null;
11
+ customIcon?: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, 'ref'> & React.RefAttributes<SVGSVGElement>>;
11
12
  };
12
13
  export declare enum REQUEST_STATE {
13
14
  NOT_STARTED = "not_started",
@@ -82,6 +83,7 @@ export interface BoxAiAgentSelectorWithApiProps {
82
83
  */
83
84
  shouldHideAgentSelectorOnLoad?: boolean;
84
85
  triggerChipClassName?: string;
86
+ useAgentLocalStorage?: boolean;
85
87
  /**
86
88
  * Styling variant of agent selector
87
89
  * */
@@ -118,6 +120,7 @@ export interface BoxAiAgentSelectorProps {
118
120
  */
119
121
  selectedAgent: AgentType | null;
120
122
  triggerChipClassName?: string;
123
+ useAgentLocalStorage?: boolean;
121
124
  /**
122
125
  * Styling variant of agent selector
123
126
  * */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-agent-selector",
3
- "version": "0.47.14",
3
+ "version": "0.48.0",
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.33.2",
16
+ "@box/blueprint-web": "^12.34.0",
17
17
  "@box/blueprint-web-assets": "^4.59.0",
18
18
  "@box/eslint-plugin-blueprint": "^1.0.3",
19
19
  "@box/storybook-utils": "^0.13.13",