@box/box-ai-content-answers 0.148.10 → 0.148.12

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/dist/esm/index.js CHANGED
@@ -1,27 +1,28 @@
1
1
  import { BoxAiContentAnswers as r } from "./lib/box-ai-content-answers.js";
2
- import { AnswerContent as s } from "./lib/components/answer/answer-content.js";
3
- import { References as n } from "./lib/components/answer/references.js";
4
- import { withApiWrapper as a } from "./lib/components/api-wrapper/api-wrapper.js";
5
- import { C as T } from "../chunks/clear-conversation-button.js";
6
- import { IntelligenceModal as m } from "./lib/components/modal/modal.js";
7
- import { IntelligenceSidebar as P } from "./lib/components/sidebar/sidebar.js";
8
- import { APP_MODE as S } from "./lib/constants.js";
9
- import { usePromptFocus as i } from "./lib/hooks/usePromptFocus.js";
10
- import { A as O, C as l, F as U, R as c, S as I, U as N } from "../chunks/types.js";
2
+ import { AnswerContent as E } from "./lib/components/answer/answer-content.js";
3
+ import { References as p } from "./lib/components/answer/references.js";
4
+ import { withApiWrapper as n } from "./lib/components/api-wrapper/api-wrapper.js";
5
+ import { C as _ } from "../chunks/clear-conversation-button.js";
6
+ import { IntelligenceModal as A } from "./lib/components/modal/modal.js";
7
+ import { IntelligenceSidebar as m } from "./lib/components/sidebar/sidebar.js";
8
+ import { AI_AGENTS_LOCAL_STORAGE_KEY as S, APP_MODE as P } from "./lib/constants.js";
9
+ import { usePromptFocus as C } from "./lib/hooks/usePromptFocus.js";
10
+ import { A as l, C as I, F as N, R as U, S as c, U as u } from "../chunks/types.js";
11
11
  export {
12
- O as ANSWER_ERROR,
13
- S as APP_MODE,
14
- s as AnswerContent,
12
+ S as AI_AGENTS_LOCAL_STORAGE_KEY,
13
+ l as ANSWER_ERROR,
14
+ P as APP_MODE,
15
+ E as AnswerContent,
15
16
  r as BoxAiContentAnswers,
16
- l as CONTENT_ERROR,
17
- T as ClearConversationButton,
18
- U as FeedbackIssueType,
19
- m as IntelligenceModal,
20
- P as IntelligenceSidebar,
21
- c as REQUEST_STATE,
22
- n as References,
23
- I as SUGGESTED_QUESTION_PROMPT_TYPE,
24
- N as USER_INPUT_PROMPT_TYPE,
25
- i as usePromptFocus,
26
- a as withApiWrapper
17
+ I as CONTENT_ERROR,
18
+ _ as ClearConversationButton,
19
+ N as FeedbackIssueType,
20
+ A as IntelligenceModal,
21
+ m as IntelligenceSidebar,
22
+ U as REQUEST_STATE,
23
+ p as References,
24
+ c as SUGGESTED_QUESTION_PROMPT_TYPE,
25
+ u as USER_INPUT_PROMPT_TYPE,
26
+ C as usePromptFocus,
27
+ n as withApiWrapper
27
28
  };
@@ -10,14 +10,14 @@ import { A as ne, R as ie } from "../../../../chunks/types.js";
10
10
  import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as de } from "../common/constants.js";
11
11
  import { s, C as ce } from "../../../../chunks/clear-conversation-button.js";
12
12
  import me from "./hooks/useStopPropagationOnEsc.js";
13
- import { Title as fe } from "./title.js";
13
+ import { Title as ge } from "./title.js";
14
14
  import S from "./messages.js";
15
15
  import { jsxs as M, jsx as e } from "react/jsx-runtime";
16
- const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", ue = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel, Ce = (o) => o ? $ : void 0, pe = (o) => {
16
+ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", ue = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel, Ce = (o) => o ? $ : void 0, pe = (o) => {
17
17
  const l = o === "collapsible";
18
18
  return {
19
19
  closeModalLabel: ue(l),
20
- closeModalTargetId: ge(l),
20
+ closeModalTargetId: fe(l),
21
21
  closeModalIcon: Ce(l)
22
22
  };
23
23
  }, _e = ({
@@ -25,37 +25,37 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
25
25
  getAIStudioAgents: l,
26
26
  hasCustomSuggestedQuestions: x,
27
27
  hostAppName: m,
28
- isAIStudioAgentSelectorEnabled: f = !1,
28
+ isAIStudioAgentSelectorEnabled: g = !1,
29
29
  isDebugModeEnabled: B,
30
30
  isStopResponseEnabled: _ = !1,
31
31
  itemSize: h,
32
32
  extension: T,
33
- onClearAction: g,
33
+ onClearAction: f,
34
34
  onSelectAgent: k,
35
35
  onSelectedAgentCallback: P,
36
36
  recordAction: r,
37
37
  shouldRenderProviders: q = !0,
38
38
  shouldShowLandingPage: G = !1,
39
39
  stopPropagationOnEsc: H,
40
- variant: R = "closable",
40
+ variant: L = "closable",
41
41
  items: i,
42
42
  parentItem: d,
43
43
  ...z
44
44
  }) => {
45
45
  var E, v;
46
46
  const {
47
- open: b,
47
+ open: R,
48
48
  defaultOpen: F,
49
49
  onOpenChange: j,
50
50
  modal: D,
51
51
  ...a
52
- } = z, L = le(), Q = V() <= X.Medium;
53
- me(H, b);
54
- const u = (v = (E = a == null ? void 0 : a.questions) == null ? void 0 : E[a.questions.length - 1]) == null ? void 0 : v.error, [U, O] = se(!1), {
55
- closeModalLabel: A,
52
+ } = z, b = le(), Q = V() <= X.Medium;
53
+ me(H, R);
54
+ const u = (v = (E = a == null ? void 0 : a.questions) == null ? void 0 : E[a.questions.length - 1]) == null ? void 0 : v.error, [U, A] = se(!1), {
55
+ closeModalLabel: O,
56
56
  closeModalTargetId: W,
57
57
  closeModalIcon: y
58
- } = ae(() => pe(R), [R]), n = I((t) => {
58
+ } = ae(() => pe(L), [L]), n = I((t) => {
59
59
  r && (t.data ?? (t.data = {}), t.data.hostAppName = m, r(t));
60
60
  }, [m, r]);
61
61
  C(() => {
@@ -80,19 +80,19 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
80
80
  }
81
81
  });
82
82
  }, [n, d, r]), C(() => {
83
- u && u === ne.AGENT_NOT_FOUND && O(!0);
83
+ u && u === ne.AGENT_NOT_FOUND && A(!0);
84
84
  }, [u]);
85
85
  const K = () => {
86
- g && (g(), n({
86
+ f && (f(), n({
87
87
  ...p,
88
88
  action: de,
89
89
  target: "clearChat"
90
90
  }));
91
- }, J = I(async () => (O(!1), l()), [l]), N = /* @__PURE__ */ M(c, {
91
+ }, J = I(async () => (A(!1), l()), [l]), N = /* @__PURE__ */ M(c, {
92
92
  defaultOpen: F,
93
93
  modal: D,
94
94
  onOpenChange: j,
95
- open: b,
95
+ open: R,
96
96
  children: [/* @__PURE__ */ e(c.Trigger, {
97
97
  children: o
98
98
  }), /* @__PURE__ */ M(c.Content, {
@@ -108,9 +108,9 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
108
108
  "data-testid": "content-answers-icon-color",
109
109
  height: w,
110
110
  width: w
111
- }), /* @__PURE__ */ e(fe, {
112
- isAIStudioAgentSelectorEnabled: f
113
- }), f && /* @__PURE__ */ e(oe, {
111
+ }), /* @__PURE__ */ e(ge, {
112
+ isAIStudioAgentSelectorEnabled: g
113
+ }), g && /* @__PURE__ */ e(oe, {
114
114
  contentClassName: s.agentSelectorContent,
115
115
  disabled: a.hasRequestInProgress,
116
116
  fetcher: J,
@@ -120,14 +120,15 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
120
120
  recordAction: r,
121
121
  requestState: U ? ie.ERROR : void 0,
122
122
  shouldHideAgentSelectorOnLoad: !0,
123
- triggerChipClassName: s.agentSelectorTrigger
123
+ triggerChipClassName: s.agentSelectorTrigger,
124
+ useAgentLocalStorage: !0
124
125
  })]
125
126
  })
126
127
  }), /* @__PURE__ */ e(re, {
127
128
  className: s.boxAiContentAnswers,
128
129
  hasCustomSuggestedQuestions: x,
129
130
  hostAppName: m,
130
- isAIStudioAgentSelectorEnabled: f,
131
+ isAIStudioAgentSelectorEnabled: g,
131
132
  isDebugModeEnabled: B,
132
133
  isStopResponseEnabled: _,
133
134
  items: i,
@@ -135,15 +136,15 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
135
136
  recordAction: n,
136
137
  shouldShowLandingPage: G,
137
138
  ...a
138
- }), g && /* @__PURE__ */ e(ce, {
139
+ }), f && /* @__PURE__ */ e(ce, {
139
140
  hasRequestInProgress: a.hasRequestInProgress,
140
141
  onClick: K
141
142
  }), /* @__PURE__ */ e(Y, {
142
143
  children: /* @__PURE__ */ e(Z, {
143
- content: L.formatMessage(A),
144
+ content: b.formatMessage(O),
144
145
  "data-testid": "content-answers-close-modal-tooltip",
145
146
  children: /* @__PURE__ */ e(c.Close, {
146
- "aria-label": L.formatMessage(A),
147
+ "aria-label": b.formatMessage(O),
147
148
  className: s["modal-close-button"],
148
149
  "data-target-id": W,
149
150
  icon: y,
@@ -14,12 +14,12 @@ import { IntelligenceModal as le } from "../modal/modal.js";
14
14
  import { IntelligenceSidebarContext as be } from "./context.js";
15
15
  import C from "./messages.js";
16
16
  import Se from "./title.js";
17
- import { jsxs as p, Fragment as $, jsx as e } from "react/jsx-runtime";
18
- import '../../../../styles/content.css';const ue = "_bcsSidebarBase_gfv6u_2", pe = "_bcsContent_gfv6u_2", Ae = "_bcsBoxAISidebar_gfv6u_2", ge = "_bcsContentHeader_gfv6u_6", he = "_bcsTitle_gfv6u_15", me = "_bcsScrollContent_gfv6u_22", fe = "_withModalOpen_gfv6u_32", _e = "_bcsBoxAISidebarAgentSelector_gfv6u_35", Ie = "_bcsBoxAISidebarAgentSelectorContainer_gfv6u_39", xe = "_bcsBoxAISidebarChatActions_gfv6u_43", Ce = "_bcsBoxAISidebarContent_gfv6u_47", Be = "_bcsBoxAISidebarExpand_gfv6u_50", ve = "_bcsBoxAISidebarTitlePart_gfv6u_53", we = "_sidebarChip_gfv6u_77", Te = "_bcsContentSubheader_gfv6u_90", Ee = "_bcsScrollContentWrapper_gfv6u_99", Ne = "_withSubheader_gfv6u_104", Pe = "_expanded_gfv6u_107", t = {
17
+ import { jsxs as A, Fragment as $, jsx as e } from "react/jsx-runtime";
18
+ import '../../../../styles/content.css';const ue = "_bcsSidebarBase_gfv6u_2", Ae = "_bcsContent_gfv6u_2", ge = "_bcsBoxAISidebar_gfv6u_2", pe = "_bcsContentHeader_gfv6u_6", he = "_bcsTitle_gfv6u_15", me = "_bcsScrollContent_gfv6u_22", fe = "_withModalOpen_gfv6u_32", _e = "_bcsBoxAISidebarAgentSelector_gfv6u_35", Ie = "_bcsBoxAISidebarAgentSelectorContainer_gfv6u_39", xe = "_bcsBoxAISidebarChatActions_gfv6u_43", Ce = "_bcsBoxAISidebarContent_gfv6u_47", Be = "_bcsBoxAISidebarExpand_gfv6u_50", ve = "_bcsBoxAISidebarTitlePart_gfv6u_53", we = "_sidebarChip_gfv6u_77", Te = "_bcsContentSubheader_gfv6u_90", Ee = "_bcsScrollContentWrapper_gfv6u_99", Ne = "_withSubheader_gfv6u_104", Pe = "_expanded_gfv6u_107", t = {
19
19
  bcsSidebarBase: ue,
20
- bcsContent: pe,
21
- bcsBoxAISidebar: Ae,
22
- bcsContentHeader: ge,
20
+ bcsContent: Ae,
21
+ bcsBoxAISidebar: ge,
22
+ bcsContentHeader: pe,
23
23
  bcsTitle: he,
24
24
  bcsScrollContent: me,
25
25
  withModalOpen: fe,
@@ -34,27 +34,27 @@ import '../../../../styles/content.css';const ue = "_bcsSidebarBase_gfv6u_2", pe
34
34
  bcsScrollContentWrapper: Ee,
35
35
  withSubheader: Ne,
36
36
  expanded: Pe
37
- }, Me = `${ie}_${re}`;
38
- ce(Me);
39
- const Le = ({
37
+ }, Le = `${ie}_${re}`;
38
+ ce(Le);
39
+ const Me = ({
40
40
  actions: B,
41
41
  children: i,
42
42
  className: n,
43
43
  elementId: l = "",
44
- sidebarView: A = "",
44
+ sidebarView: g = "",
45
45
  title: r,
46
46
  subheader: c,
47
47
  ...d
48
48
  }) => {
49
- const b = `${l}${l === "" ? "" : "_"}${A}`, g = `${b}-content`;
50
- return /* @__PURE__ */ p("div", {
49
+ const b = `${l}${l === "" ? "" : "_"}${g}`, p = `${b}-content`;
50
+ return /* @__PURE__ */ A("div", {
51
51
  "aria-labelledby": b,
52
52
  className: y(t.bcsContent, n),
53
53
  "data-testid": "bcs-content",
54
- id: g,
54
+ id: p,
55
55
  role: "tabpanel",
56
56
  ...d,
57
- children: [/* @__PURE__ */ p("div", {
57
+ children: [/* @__PURE__ */ A("div", {
58
58
  className: t.bcsContentHeader,
59
59
  children: [r && /* @__PURE__ */ e(K, {
60
60
  as: "h3",
@@ -78,12 +78,12 @@ function Oe(B) {
78
78
  createSession: i,
79
79
  encodedSession: n,
80
80
  onClearAction: l,
81
- getAIStudioAgents: A,
81
+ getAIStudioAgents: g,
82
82
  hasRequestInProgress: r,
83
83
  hostAppName: c,
84
84
  isAIStudioAgentSelectorEnabled: d,
85
85
  isLoading: b,
86
- onSelectAgent: g,
86
+ onSelectAgent: p,
87
87
  questions: h,
88
88
  shouldShowLandingPage: N = !0,
89
89
  sendQuestion: m,
@@ -91,7 +91,7 @@ function Oe(B) {
91
91
  ...P
92
92
  } = B, {
93
93
  formatMessage: f
94
- } = oe(), M = u.useRef(!1), [w, L] = u.useState(!1), {
94
+ } = oe(), L = u.useRef(!1), [w, M] = u.useState(!1), {
95
95
  cache: s,
96
96
  contentName: O,
97
97
  elementId: H,
@@ -122,9 +122,9 @@ function Oe(B) {
122
122
  const x = (o = !1) => {
123
123
  !I && !n && !b && i && i(!0, !1), o && W && W();
124
124
  }, J = () => {
125
- L(!1);
125
+ M(!1);
126
126
  }, Y = () => {
127
- x(), L(!0);
127
+ x(), M(!0);
128
128
  };
129
129
  u.useEffect(() => (I && !n && i && i(!0, !0), n && a.length > 0 && a[a.length - 1].isCompleted === !1 && m({
130
130
  prompt: a[a.length - 1].prompt
@@ -143,9 +143,9 @@ function Oe(B) {
143
143
  v();
144
144
  }), []), u.useEffect(() => {
145
145
  const o = a[a.length - 1];
146
- !I && !M.current && n && (o != null && o.isLoading) && (m(o, E, !1), M.current = !0);
146
+ !I && !L.current && n && (o != null && o.isLoading) && (m(o, E, !1), L.current = !0);
147
147
  }, [n]);
148
- const G = () => /* @__PURE__ */ p("div", {
148
+ const G = () => /* @__PURE__ */ A("div", {
149
149
  className: t.bcsBoxAISidebarTitlePart,
150
150
  children: [/* @__PURE__ */ e(Se, {
151
151
  isAIStudioAgentSelectorEnabled: d
@@ -153,20 +153,21 @@ function Oe(B) {
153
153
  className: t.bcsBoxAISidebarAgentSelector,
154
154
  children: /* @__PURE__ */ e(ne, {
155
155
  disabled: r,
156
- fetcher: A,
156
+ fetcher: g,
157
157
  hostAppName: c,
158
158
  onAgentsListOpen: x,
159
- onSelectAgent: g,
159
+ onSelectAgent: p,
160
160
  onSelectedAgentCallback: D,
161
161
  recordAction: S,
162
162
  shouldHideAgentSelectorOnLoad: !0,
163
+ useAgentLocalStorage: !0,
163
164
  variant: "sidebar"
164
165
  })
165
166
  })]
166
167
  });
167
- return /* @__PURE__ */ p($, {
168
- children: [/* @__PURE__ */ e(Le, {
169
- actions: /* @__PURE__ */ p($, {
168
+ return /* @__PURE__ */ A($, {
169
+ children: [/* @__PURE__ */ e(Me, {
170
+ actions: /* @__PURE__ */ A($, {
170
171
  children: [G(), /* @__PURE__ */ e(de, {
171
172
  hasRequestInProgress: r,
172
173
  onClick: l
@@ -217,7 +218,7 @@ function Oe(B) {
217
218
  contentName: O,
218
219
  contentType: f(C.sidebarBoxAIContent),
219
220
  extension: V,
220
- getAIStudioAgents: A,
221
+ getAIStudioAgents: g,
221
222
  hasRequestInProgress: r,
222
223
  hostAppName: c,
223
224
  isAIStudioAgentSelectorEnabled: d,
@@ -229,7 +230,7 @@ function Oe(B) {
229
230
  onClearAction: l,
230
231
  onFeedbackFormSubmit: U,
231
232
  onOpenChange: J,
232
- onSelectAgent: g,
233
+ onSelectAgent: p,
233
234
  onUserIntentToUseAI: x,
234
235
  open: w,
235
236
  questions: h,
@@ -5,7 +5,8 @@ const _ = {
5
5
  HUBS_MODAL: "hubs_modal",
6
6
  NOTES_MODAL: "notes_modal",
7
7
  QUICK_ACTIONS: "quick_actions"
8
- };
8
+ }, A = "aiAgent";
9
9
  export {
10
+ A as AI_AGENTS_LOCAL_STORAGE_KEY,
10
11
  _ as APP_MODE
11
12
  };
@@ -6,3 +6,4 @@ export declare const APP_MODE: {
6
6
  NOTES_MODAL: string;
7
7
  QUICK_ACTIONS: string;
8
8
  };
9
+ export declare const AI_AGENTS_LOCAL_STORAGE_KEY = "aiAgent";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.148.10",
3
+ "version": "0.148.12",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.56.1",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@box/babel-plugin-target-attributes": "1.3.0",
20
- "@box/blueprint-web": "^12.68.1",
20
+ "@box/blueprint-web": "^12.68.2",
21
21
  "@box/blueprint-web-assets": "^4.66.0",
22
- "@box/box-ai-agent-selector": "^0.58.11",
23
- "@box/item-icon": "^0.23.10",
22
+ "@box/box-ai-agent-selector": "^0.58.12",
23
+ "@box/item-icon": "^0.23.11",
24
24
  "@box/storybook-utils": "^0.14.2",
25
25
  "@testing-library/react": "^15.0.6",
26
26
  "react": "^18.3.0",