@box/box-ai-content-answers 0.148.4 → 0.148.5

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,32 +1,34 @@
1
- import { Tooltip as a, IconButton as r } from "@box/blueprint-web";
2
- import { Trash as l } from "@box/blueprint-web-assets/icons/Line";
3
- import { useIntl as s } from "react-intl";
1
+ import { Tooltip as r, IconButton as l } from "@box/blueprint-web";
2
+ import { Trash as s } from "@box/blueprint-web-assets/icons/Line";
3
+ import { useIntl as c } from "react-intl";
4
4
  import t from "../esm/lib/components/modal/messages.js";
5
5
  import { jsx as e } from "react/jsx-runtime";
6
- import '../styles/clear-conversation-button.css';const c = "_BoxAIIconColor_ild3b_1", i = "_modalHeader_ild3b_5", d = "_contentAnswersModal_ild3b_10", _ = "_boxAiContentAnswers_ild3b_18", m = "_clearButton_ild3b_26", b = "_contentAnswerModal_ild3b_1", C = "_modalHeaderContainer_ild3b_55", g = "_agentSelectorTrigger_ild3b_63", A = "_agentSelectorContent_ild3b_74", u = {
7
- BoxAIIconColor: c,
8
- modalHeader: i,
9
- contentAnswersModal: d,
10
- boxAiContentAnswers: _,
11
- clearButton: m,
6
+ import '../styles/clear-conversation-button.css';const i = "_BoxAIIconColor_ild3b_1", d = "_modalHeader_ild3b_5", _ = "_contentAnswersModal_ild3b_10", m = "_boxAiContentAnswers_ild3b_18", b = "_clearButton_ild3b_26", C = "_contentAnswerModal_ild3b_1", g = "_modalHeaderContainer_ild3b_55", A = "_agentSelectorTrigger_ild3b_63", u = "_agentSelectorContent_ild3b_74", B = {
7
+ BoxAIIconColor: i,
8
+ modalHeader: d,
9
+ contentAnswersModal: _,
10
+ boxAiContentAnswers: m,
11
+ clearButton: b,
12
12
  "modal-close-button": "_modal-close-button_ild3b_30",
13
- contentAnswerModal: b,
14
- modalHeaderContainer: C,
15
- agentSelectorTrigger: g,
16
- agentSelectorContent: A
17
- }, M = ({
18
- onClick: n
13
+ contentAnswerModal: C,
14
+ modalHeaderContainer: g,
15
+ agentSelectorTrigger: A,
16
+ agentSelectorContent: u
17
+ }, f = ({
18
+ onClick: n,
19
+ hasRequestInProgress: a
19
20
  }) => {
20
- const o = s();
21
- return /* @__PURE__ */ e(a, {
21
+ const o = c();
22
+ return /* @__PURE__ */ e(r, {
22
23
  content: o.formatMessage(t.clearConversationLabel),
23
24
  "data-testid": "clear-conversation-tooltip",
24
25
  variant: "standard",
25
- children: /* @__PURE__ */ e(r, {
26
+ children: /* @__PURE__ */ e(l, {
26
27
  "aria-label": o.formatMessage(t.clearConversationLabel),
27
- className: u.clearButton,
28
+ className: B.clearButton,
28
29
  "data-testid": "clear-conversation-button",
29
- icon: l,
30
+ disabled: a,
31
+ icon: s,
30
32
  onClick: n,
31
33
  size: "small",
32
34
  "data-target-id": "IconButton-clearConversationLabel"
@@ -34,6 +36,6 @@ import '../styles/clear-conversation-button.css';const c = "_BoxAIIconColor_ild3
34
36
  });
35
37
  };
36
38
  export {
37
- M as C,
38
- u as s
39
+ f as C,
40
+ B as s
39
41
  };
@@ -3,7 +3,7 @@ import { ArrowsCollapse as $ } from "@box/blueprint-web-assets/icons/Fill";
3
3
  import { BoxAiLogo as ee } from "@box/blueprint-web-assets/icons/Logo";
4
4
  import { Size8 as w } from "@box/blueprint-web-assets/tokens/tokens";
5
5
  import { BoxAiAgentSelectorWithApi as oe, AgentsProvider as te } from "@box/box-ai-agent-selector";
6
- import { useState as se, useMemo as ae, useCallback as S, useEffect as C } from "react";
6
+ import { useState as se, useMemo as ae, useCallback as I, useEffect as C } from "react";
7
7
  import { useIntl as le } from "react-intl";
8
8
  import { BoxAiContentAnswers as re } from "../../box-ai-content-answers.js";
9
9
  import { A as ne, R as ie } from "../../../../chunks/types.js";
@@ -11,53 +11,53 @@ import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as de } from "../common/co
11
11
  import { s, C as ce } from "../../../../chunks/clear-conversation-button.js";
12
12
  import me from "./hooks/useStopPropagationOnEsc.js";
13
13
  import { Title as fe } from "./title.js";
14
- import x from "./messages.js";
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 ? x.collapseModalAriaLabel : x.closeModalAriaLabel, Ce = (o) => o ? $ : void 0, pe = (o) => {
17
- const a = o === "collapsible";
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) => {
17
+ const l = o === "collapsible";
18
18
  return {
19
- closeModalLabel: ue(a),
20
- closeModalTargetId: ge(a),
21
- closeModalIcon: Ce(a)
19
+ closeModalLabel: ue(l),
20
+ closeModalTargetId: ge(l),
21
+ closeModalIcon: Ce(l)
22
22
  };
23
23
  }, _e = ({
24
24
  children: o,
25
- getAIStudioAgents: a,
26
- hasCustomSuggestedQuestions: B,
25
+ getAIStudioAgents: l,
26
+ hasCustomSuggestedQuestions: x,
27
27
  hostAppName: m,
28
28
  isAIStudioAgentSelectorEnabled: f = !1,
29
- isDebugModeEnabled: I,
29
+ isDebugModeEnabled: B,
30
30
  isStopResponseEnabled: _ = !1,
31
31
  itemSize: h,
32
32
  extension: T,
33
33
  onClearAction: g,
34
34
  onSelectAgent: k,
35
- onSelectedAgentCallback: G,
36
- recordAction: l,
37
- shouldRenderProviders: P = !0,
38
- shouldShowLandingPage: q = !1,
35
+ onSelectedAgentCallback: P,
36
+ recordAction: r,
37
+ shouldRenderProviders: q = !0,
38
+ shouldShowLandingPage: G = !1,
39
39
  stopPropagationOnEsc: H,
40
- variant: b = "closable",
40
+ variant: R = "closable",
41
41
  items: i,
42
42
  parentItem: d,
43
43
  ...z
44
44
  }) => {
45
45
  var E, v;
46
46
  const {
47
- open: L,
47
+ open: b,
48
48
  defaultOpen: F,
49
49
  onOpenChange: j,
50
50
  modal: D,
51
- ...r
52
- } = z, O = le(), Q = V() <= X.Medium;
53
- me(H, L);
54
- const u = (v = (E = r == null ? void 0 : r.questions) == null ? void 0 : E[r.questions.length - 1]) == null ? void 0 : v.error, [U, A] = se(!1), {
55
- closeModalLabel: N,
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,
56
56
  closeModalTargetId: W,
57
57
  closeModalIcon: y
58
- } = ae(() => pe(b), [b]), n = S((t) => {
59
- l && (t.data ?? (t.data = {}), t.data.hostAppName = m, l(t));
60
- }, [m, l]);
58
+ } = ae(() => pe(R), [R]), n = I((t) => {
59
+ r && (t.data ?? (t.data = {}), t.data.hostAppName = m, r(t));
60
+ }, [m, r]);
61
61
  C(() => {
62
62
  i || n({
63
63
  ...p,
@@ -67,7 +67,7 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
67
67
  fileType: T
68
68
  }
69
69
  });
70
- }, [n, T, h, i, l]), C(() => {
70
+ }, [n, T, h, i, r]), C(() => {
71
71
  i && n({
72
72
  ...p,
73
73
  target: "loaded",
@@ -79,8 +79,8 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
79
79
  }))
80
80
  }
81
81
  });
82
- }, [n, d, l]), C(() => {
83
- u && u === ne.AGENT_NOT_FOUND && A(!0);
82
+ }, [n, d, r]), C(() => {
83
+ u && u === ne.AGENT_NOT_FOUND && O(!0);
84
84
  }, [u]);
85
85
  const K = () => {
86
86
  g && (g(), n({
@@ -88,11 +88,11 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
88
88
  action: de,
89
89
  target: "clearChat"
90
90
  }));
91
- }, J = S(async () => (A(!1), a()), [a]), R = /* @__PURE__ */ M(c, {
91
+ }, J = I(async () => (O(!1), l()), [l]), N = /* @__PURE__ */ M(c, {
92
92
  defaultOpen: F,
93
93
  modal: D,
94
94
  onOpenChange: j,
95
- open: L,
95
+ open: b,
96
96
  children: [/* @__PURE__ */ e(c.Trigger, {
97
97
  children: o
98
98
  }), /* @__PURE__ */ M(c.Content, {
@@ -112,12 +112,12 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
112
112
  isAIStudioAgentSelectorEnabled: f
113
113
  }), f && /* @__PURE__ */ e(oe, {
114
114
  contentClassName: s.agentSelectorContent,
115
- disabled: r.hasRequestInProgress,
115
+ disabled: a.hasRequestInProgress,
116
116
  fetcher: J,
117
117
  hostAppName: m,
118
118
  onSelectAgent: k,
119
- onSelectedAgentCallback: G,
120
- recordAction: l,
119
+ onSelectedAgentCallback: P,
120
+ recordAction: r,
121
121
  requestState: U ? ie.ERROR : void 0,
122
122
  shouldHideAgentSelectorOnLoad: !0,
123
123
  triggerChipClassName: s.agentSelectorTrigger
@@ -125,24 +125,25 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
125
125
  })
126
126
  }), /* @__PURE__ */ e(re, {
127
127
  className: s.boxAiContentAnswers,
128
- hasCustomSuggestedQuestions: B,
128
+ hasCustomSuggestedQuestions: x,
129
129
  hostAppName: m,
130
130
  isAIStudioAgentSelectorEnabled: f,
131
- isDebugModeEnabled: I,
131
+ isDebugModeEnabled: B,
132
132
  isStopResponseEnabled: _,
133
133
  items: i,
134
134
  parentItem: d,
135
135
  recordAction: n,
136
- shouldShowLandingPage: q,
137
- ...r
136
+ shouldShowLandingPage: G,
137
+ ...a
138
138
  }), g && /* @__PURE__ */ e(ce, {
139
+ hasRequestInProgress: a.hasRequestInProgress,
139
140
  onClick: K
140
141
  }), /* @__PURE__ */ e(Y, {
141
142
  children: /* @__PURE__ */ e(Z, {
142
- content: O.formatMessage(N),
143
+ content: L.formatMessage(A),
143
144
  "data-testid": "content-answers-close-modal-tooltip",
144
145
  children: /* @__PURE__ */ e(c.Close, {
145
- "aria-label": O.formatMessage(N),
146
+ "aria-label": L.formatMessage(A),
146
147
  className: s["modal-close-button"],
147
148
  "data-target-id": W,
148
149
  icon: y,
@@ -152,9 +153,9 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
152
153
  })]
153
154
  })]
154
155
  });
155
- return P ? /* @__PURE__ */ e(te, {
156
- children: R
157
- }) : R;
156
+ return q ? /* @__PURE__ */ e(te, {
157
+ children: N
158
+ }) : N;
158
159
  };
159
160
  export {
160
161
  _e as IntelligenceModal,
@@ -40,30 +40,30 @@ const Le = ({
40
40
  actions: B,
41
41
  children: i,
42
42
  className: n,
43
- elementId: d = "",
43
+ elementId: l = "",
44
44
  sidebarView: A = "",
45
- title: l,
46
- subheader: r,
47
- ...c
45
+ title: r,
46
+ subheader: c,
47
+ ...d
48
48
  }) => {
49
- const b = `${d}${d === "" ? "" : "_"}${A}`, g = `${b}-content`;
49
+ const b = `${l}${l === "" ? "" : "_"}${A}`, g = `${b}-content`;
50
50
  return /* @__PURE__ */ p("div", {
51
51
  "aria-labelledby": b,
52
52
  className: y(t.bcsContent, n),
53
53
  "data-testid": "bcs-content",
54
54
  id: g,
55
55
  role: "tabpanel",
56
- ...c,
56
+ ...d,
57
57
  children: [/* @__PURE__ */ p("div", {
58
58
  className: t.bcsContentHeader,
59
- children: [l && /* @__PURE__ */ e(K, {
59
+ children: [r && /* @__PURE__ */ e(K, {
60
60
  as: "h3",
61
61
  className: t.bcsTitle,
62
- children: l
62
+ children: r
63
63
  }), B]
64
- }), r && /* @__PURE__ */ e("div", {
64
+ }), c && /* @__PURE__ */ e("div", {
65
65
  className: t.bcsContentSubheader,
66
- children: r
66
+ children: c
67
67
  }), /* @__PURE__ */ e("div", {
68
68
  className: t.bcsScrollContentWrapper,
69
69
  children: /* @__PURE__ */ e("div", {
@@ -77,11 +77,11 @@ function Oe(B) {
77
77
  const {
78
78
  createSession: i,
79
79
  encodedSession: n,
80
- onClearAction: d,
80
+ onClearAction: l,
81
81
  getAIStudioAgents: A,
82
- hasRequestInProgress: l,
83
- hostAppName: r,
84
- isAIStudioAgentSelectorEnabled: c,
82
+ hasRequestInProgress: r,
83
+ hostAppName: c,
84
+ isAIStudioAgentSelectorEnabled: d,
85
85
  isLoading: b,
86
86
  onSelectAgent: g,
87
87
  questions: h,
@@ -148,13 +148,13 @@ function Oe(B) {
148
148
  const G = () => /* @__PURE__ */ p("div", {
149
149
  className: t.bcsBoxAISidebarTitlePart,
150
150
  children: [/* @__PURE__ */ e(Se, {
151
- isAIStudioAgentSelectorEnabled: c
152
- }), c && /* @__PURE__ */ e("div", {
151
+ isAIStudioAgentSelectorEnabled: d
152
+ }), d && /* @__PURE__ */ e("div", {
153
153
  className: t.bcsBoxAISidebarAgentSelector,
154
154
  children: /* @__PURE__ */ e(ne, {
155
- disabled: l,
155
+ disabled: r,
156
156
  fetcher: A,
157
- hostAppName: r,
157
+ hostAppName: c,
158
158
  onAgentsListOpen: x,
159
159
  onSelectAgent: g,
160
160
  onSelectedAgentCallback: D,
@@ -168,7 +168,8 @@ function Oe(B) {
168
168
  children: [/* @__PURE__ */ e(Le, {
169
169
  actions: /* @__PURE__ */ p($, {
170
170
  children: [G(), /* @__PURE__ */ e(de, {
171
- onClick: d
171
+ hasRequestInProgress: r,
172
+ onClick: l
172
173
  }), /* @__PURE__ */ e(X, {
173
174
  content: f(C.sidebarBoxAISwitchToModalView),
174
175
  "data-testid": "content-answers-open-modal-tooltip",
@@ -194,8 +195,8 @@ function Oe(B) {
194
195
  className: t.bcsBoxAISidebarContentAnswers,
195
196
  contentName: O,
196
197
  contentType: f(C.sidebarBoxAIContent),
197
- hostAppName: r,
198
- isAIStudioAgentSelectorEnabled: c,
198
+ hostAppName: c,
199
+ isAIStudioAgentSelectorEnabled: d,
199
200
  isFeedbackEnabled: R,
200
201
  isFeedbackFormEnabled: k,
201
202
  isStopResponseEnabled: q,
@@ -217,15 +218,15 @@ function Oe(B) {
217
218
  contentType: f(C.sidebarBoxAIContent),
218
219
  extension: V,
219
220
  getAIStudioAgents: A,
220
- hasRequestInProgress: l,
221
- hostAppName: r,
222
- isAIStudioAgentSelectorEnabled: c,
221
+ hasRequestInProgress: r,
222
+ hostAppName: c,
223
+ isAIStudioAgentSelectorEnabled: d,
223
224
  isFeedbackEnabled: R,
224
225
  isFeedbackFormEnabled: k,
225
226
  isStopResponseEnabled: q,
226
227
  items: T,
227
228
  itemSize: Q,
228
- onClearAction: d,
229
+ onClearAction: l,
229
230
  onFeedbackFormSubmit: U,
230
231
  onOpenChange: J,
231
232
  onSelectAgent: g,
@@ -1,5 +1,6 @@
1
1
  interface ClearConversationButtonProps {
2
2
  onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
3
+ hasRequestInProgress: boolean;
3
4
  }
4
- export declare const ClearConversationButton: ({ onClick }: ClearConversationButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const ClearConversationButton: ({ onClick, hasRequestInProgress }: ClearConversationButtonProps) => import("react/jsx-runtime").JSX.Element;
5
6
  export default ClearConversationButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.148.4",
3
+ "version": "0.148.5",
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.64.3",
20
+ "@box/blueprint-web": "^12.64.4",
21
21
  "@box/blueprint-web-assets": "^4.65.0",
22
- "@box/box-ai-agent-selector": "^0.58.4",
23
- "@box/item-icon": "^0.23.4",
22
+ "@box/box-ai-agent-selector": "^0.58.5",
23
+ "@box/item-icon": "^0.23.5",
24
24
  "@box/storybook-utils": "^0.14.1",
25
25
  "@testing-library/react": "^15.0.6",
26
26
  "react": "^18.3.0",