@box/box-ai-content-answers 1.6.1 → 1.7.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,14 +1,14 @@
1
1
  import p from "clsx";
2
2
  import * as s from "react";
3
- import { C as K } from "../../chunks/types.js";
4
- import { jsx as u, jsxs as V } from "react/jsx-runtime";
5
- import { Content as W } from "./components/content/content.js";
6
- import { Footer as X } from "./components/footer/footer.js";
7
- import '../../styles/box-ai-content-answers.css';const Y = "_container_1p5tb_1", Z = "_contentAnswers_1p5tb_8", $ = "_sidebar_1p5tb_19", a = {
8
- container: Y,
9
- contentAnswers: Z,
10
- sidebar: $
11
- }, ee = ({
3
+ import { C as W } from "../../chunks/types.js";
4
+ import { jsx as u, jsxs as X } from "react/jsx-runtime";
5
+ import { Content as Y } from "./components/content/content.js";
6
+ import { Footer as Z } from "./components/footer/footer.js";
7
+ import '../../styles/box-ai-content-answers.css';const $ = "_container_1p5tb_1", v = "_contentAnswers_1p5tb_8", P = "_sidebar_1p5tb_19", a = {
8
+ container: $,
9
+ contentAnswers: v,
10
+ sidebar: P
11
+ }, oe = ({
12
12
  className: _,
13
13
  contentType: h,
14
14
  contentName: Q,
@@ -19,61 +19,63 @@ import '../../styles/box-ai-content-answers.css';const Y = "_container_1p5tb_1",
19
19
  isDebugModeEnabled: E,
20
20
  isStopResponseEnabled: M,
21
21
  isStreamingEnabled: n,
22
+ promptValue: R,
22
23
  questions: i,
23
24
  recordAction: l,
24
- retryQuestion: R,
25
+ retryQuestion: x,
26
+ setPromptValue: C,
25
27
  showLoadingIndicator: g,
26
- stopQuestion: x,
27
- submitQuestion: C,
28
- suggestedQuestions: F,
29
- useAnimation: D,
30
- onAgentEditorToggle: v,
28
+ stopQuestion: F,
29
+ submitQuestion: D,
30
+ suggestedQuestions: N,
31
+ useAnimation: k,
32
+ onAgentEditorToggle: T,
31
33
  onUserIntentToUseAI: e,
32
- promptButtonClickHandler: N,
34
+ promptButtonClickHandler: j,
33
35
  variant: o = "modal",
34
- hostAppName: k,
35
- isReactMarkdownEnabled: j,
36
- ...y
36
+ hostAppName: y,
37
+ isReactMarkdownEnabled: O,
38
+ ...z
37
39
  }) => {
38
- const [f, m] = s.useState(null), [S, O] = s.useState(t != null), [c, z] = s.useState(!1), B = t === K.LARGE_FILE, G = (!S || B) && !g, b = (r) => {
40
+ const [f, m] = s.useState(null), [S, B] = s.useState(t != null), [c, G] = s.useState(!1), L = t === W.LARGE_FILE, H = (!S || L) && !g, b = (r) => {
39
41
  l && l({
40
42
  ...r,
41
43
  component: o
42
44
  });
43
- }, L = () => {
45
+ }, J = () => {
44
46
  e && e(!1);
45
- }, H = (r) => {
47
+ }, K = (r) => {
46
48
  m(r), e && e(!0);
47
- }, J = () => {
49
+ }, V = () => {
48
50
  e && e(!0);
49
51
  };
50
52
  return s.useEffect(() => {
51
- O(t != null);
53
+ B(t != null);
52
54
  }, [t]), /* @__PURE__ */ u("div", {
53
55
  className: p(_, a.container),
54
- children: /* @__PURE__ */ V("div", {
56
+ children: /* @__PURE__ */ X("div", {
55
57
  className: p(a.contentAnswers, o === "sidebar" && a.sidebar),
56
- children: [!c && /* @__PURE__ */ u(W, {
57
- ...y,
58
+ children: [!c && /* @__PURE__ */ u(Y, {
59
+ ...z,
58
60
  askSuggestedQuestion: f,
59
61
  contentName: Q,
60
62
  contentType: h,
61
63
  error: t,
62
64
  hasCustomSuggestedQuestions: w,
63
65
  hasRequestInProgress: d,
64
- hostAppName: k,
66
+ hostAppName: y,
65
67
  isErrorMessageShown: S,
66
- isReactMarkdownEnabled: j,
68
+ isReactMarkdownEnabled: O,
67
69
  isStreamingEnabled: n,
68
- onSuggestedQuestionInteraction: L,
70
+ onSuggestedQuestionInteraction: J,
69
71
  questions: i,
70
72
  recordAction: b,
71
- setAskSuggestedQuestion: H,
73
+ setAskSuggestedQuestion: K,
72
74
  showLoadingIndicator: g,
73
- suggestedQuestions: F,
74
- useAnimation: n && D,
75
+ suggestedQuestions: N,
76
+ useAnimation: n && k,
75
77
  variant: o
76
- }), G && /* @__PURE__ */ u(X, {
78
+ }), H && /* @__PURE__ */ u(Z, {
77
79
  askSuggestedQuestion: f,
78
80
  enableDebugMode: E,
79
81
  hasRequestInProgress: d,
@@ -82,15 +84,17 @@ import '../../styles/box-ai-content-answers.css';const Y = "_container_1p5tb_1",
82
84
  isStopResponseEnabled: M,
83
85
  isStreamingEnabled: n,
84
86
  lastQuestion: i[i.length - 1],
85
- onRetryQuestion: R,
86
- onStopQuestion: x,
87
- onUserInteraction: J,
88
- promptButtonClickHandler: N,
87
+ onRetryQuestion: x,
88
+ onStopQuestion: F,
89
+ onUserInteraction: V,
90
+ promptButtonClickHandler: j,
91
+ promptValue: R,
89
92
  recordAction: b,
90
- sendQuestion: C,
93
+ sendQuestion: D,
91
94
  setAskSuggestedQuestion: m,
95
+ setPromptValue: C,
92
96
  toggleDebugMode: () => {
93
- z(!c);
97
+ G(!c);
94
98
  },
95
99
  variant: o
96
100
  })]
@@ -98,6 +102,6 @@ import '../../styles/box-ai-content-answers.css';const Y = "_container_1p5tb_1",
98
102
  });
99
103
  };
100
104
  export {
101
- ee as BoxAiContentAnswers,
102
- ee as default
105
+ oe as BoxAiContentAnswers,
106
+ oe as default
103
107
  };
@@ -1,162 +1,166 @@
1
- import g from "clsx";
2
- import Q from "lodash/noop";
1
+ import tt from "clsx";
2
+ import at from "lodash/noop";
3
3
  import * as r from "react";
4
- import { useIntl as tt } from "react-intl";
5
- import { useBreakpoint as at, Breakpoint as rt, TextArea as et, FilterChip as T, Tooltip as ot, Button as nt } from "@box/blueprint-web";
6
- import { ArrowUp as it } from "@box/blueprint-web-assets/icons/Fill";
7
- import { BubbleStar as st } from "@box/blueprint-web-assets/icons/Medium";
8
- import { useAgents as lt } from "@box/box-ai-agent-selector";
9
- import { getAIAgentConfig as X } from "../common/agentUtils.js";
10
- import { isDebugModeTrigger as mt, isEnterTrigger as pt } from "../common/keyInputUtils.js";
11
- import { TEXT_AREA as m, INPUT_TARGET_ID as ct } from "./constants.js";
12
- import { FooterActions as ut } from "./footer-actions.js";
13
- import { s as p, S as ft } from "../../../../chunks/stopResponseButton.js";
14
- import { U as dt } from "../../../../chunks/types.js";
15
- import s from "./messages.js";
16
- import { LOGGER_BASE_CONFIG as I, LOGGER_ACTION_CLICK as bt, LOGGER_ACTION_KEYPRESS as ht } from "../common/constants.js";
17
- import { jsxs as _, jsx as l } from "react/jsx-runtime";
18
- const Xt = ({
19
- askSuggestedQuestion: u,
20
- enableDebugMode: B = !1,
21
- hasRequestInProgress: o,
22
- isAIStudioAgentSelectorEnabled: h,
23
- isDebugModeShown: N,
24
- isStopResponseEnabled: P,
25
- isStreamingEnabled: H,
26
- lastQuestion: C,
27
- onRetryQuestion: G,
28
- onStopQuestion: S,
29
- onUserInteraction: L = Q,
30
- recordAction: n,
31
- sendQuestion: v,
32
- setAskSuggestedQuestion: x,
33
- toggleDebugMode: c,
34
- promptButtonClickHandler: y,
35
- variant: F = "modal"
4
+ import { useIntl as rt } from "react-intl";
5
+ import { useBreakpoint as nt, Breakpoint as et, TextArea as it, FilterChip as L, Tooltip as ot, Button as st } from "@box/blueprint-web";
6
+ import { ArrowUp as lt } from "@box/blueprint-web-assets/icons/Fill";
7
+ import { BubbleStar as ct } from "@box/blueprint-web-assets/icons/Medium";
8
+ import { useAgents as mt } from "@box/box-ai-agent-selector";
9
+ import { getAIAgentConfig as H } from "../common/agentUtils.js";
10
+ import { isDebugModeTrigger as ft, isEnterTrigger as pt } from "../common/keyInputUtils.js";
11
+ import { TEXT_AREA as l, INPUT_TARGET_ID as ut } from "./constants.js";
12
+ import { FooterActions as dt } from "./footer-actions.js";
13
+ import { s as f, S as bt } from "../../../../chunks/stopResponseButton.js";
14
+ import { U as ht } from "../../../../chunks/types.js";
15
+ import c from "./messages.js";
16
+ import { LOGGER_BASE_CONFIG as S, LOGGER_ACTION_CLICK as Ct, LOGGER_ACTION_KEYPRESS as Et } from "../common/constants.js";
17
+ import { jsxs as M, jsx as m } from "react/jsx-runtime";
18
+ const Ht = ({
19
+ askSuggestedQuestion: d,
20
+ enableDebugMode: x = !1,
21
+ hasRequestInProgress: e,
22
+ isAIStudioAgentSelectorEnabled: E,
23
+ isDebugModeShown: y,
24
+ isStopResponseEnabled: F,
25
+ isStreamingEnabled: K,
26
+ lastQuestion: T,
27
+ onRetryQuestion: A,
28
+ onStopQuestion: U,
29
+ onUserInteraction: k = at,
30
+ promptValue: p,
31
+ recordAction: i,
32
+ sendQuestion: O,
33
+ setAskSuggestedQuestion: R,
34
+ setPromptValue: o,
35
+ toggleDebugMode: u,
36
+ promptButtonClickHandler: X,
37
+ variant: W = "modal"
36
38
  }) => {
37
- const O = F === "sidebar", i = tt(), K = at(), a = r.useRef(null), U = K <= rt.Medium && !O ? m.MAX_ROWS_MOBILE : m.MAX_ROWS, [f, A] = r.useState(!0), [W, R] = r.useState(!1), {
38
- selectedAgent: E
39
- } = lt(), {
40
- answer: j,
41
- isCompleted: D
42
- } = C ?? {}, Y = H && D === !1 && (P || j), d = r.useCallback(() => {
39
+ const w = W === "sidebar", s = rt(), j = nt(), a = r.useRef(null), D = j <= et.Medium && !w ? l.MAX_ROWS_MOBILE : l.MAX_ROWS, [b, v] = r.useState(!0), [Y, B] = r.useState(!1), {
40
+ selectedAgent: _
41
+ } = mt(), {
42
+ answer: J,
43
+ isCompleted: P
44
+ } = T ?? {}, Z = K && P === !1 && (F || J), h = r.useCallback(() => {
43
45
  a.current && a.current.focus();
44
- }, [a]), M = r.useCallback(() => {
45
- var e;
46
- L();
47
- let t = ((e = a.current) == null ? void 0 : e.value) ?? "";
48
- a.current && t.length > m.MAX_LENGTH && (a.current.value = t.slice(0, m.MAX_LENGTH), t = a.current.value), R(t.length >= m.MAX_LENGTH), A(t.trim().length === 0);
49
- }, [a, L]), b = r.useCallback((t = dt) => {
50
- if (d(), !o && a.current) {
51
- const e = {
46
+ }, [a]), N = r.useCallback(() => {
47
+ var n;
48
+ k();
49
+ let t = ((n = a.current) == null ? void 0 : n.value) ?? "";
50
+ a.current && t.length > l.MAX_LENGTH && (a.current.value = t.slice(0, l.MAX_LENGTH), t = a.current.value), o && o(t), B(t.length >= l.MAX_LENGTH), v(t.trim().length === 0);
51
+ }, [k, o]), C = r.useCallback((t = ht) => {
52
+ if (h(), !e && a.current) {
53
+ const n = {
52
54
  prompt: a.current.value,
53
55
  promptType: t
54
56
  };
55
- if (e.prompt && e.prompt.trim()) {
56
- const q = X(h, E);
57
- v(e, q), a.current.value = "", A(!0), R(!1);
57
+ if (n.prompt && n.prompt.trim()) {
58
+ const V = H(E, _);
59
+ O(n, V), a.current.value = "", o && o(""), v(!0), B(!1);
58
60
  }
59
- N && c && c();
61
+ y && u && u();
60
62
  }
61
- }, [E, d, o, a, h, N, v, c]), V = r.useCallback((t) => {
62
- t.preventDefault(), !o && !f && n && n({
63
- ...I,
64
- action: bt,
63
+ }, [_, h, e, E, y, O, o, u]), $ = r.useCallback((t) => {
64
+ t.preventDefault(), !e && !b && i && i({
65
+ ...S,
66
+ action: Ct,
65
67
  target: "ask"
66
- }), b();
67
- }, [o, f, n, b]), J = r.useCallback((t) => {
68
- B && c && mt(t) && c(), pt(t) && (t.preventDefault(), !o && !f && n && n({
69
- ...I,
70
- action: ht,
68
+ }), C();
69
+ }, [e, b, i, C]), z = r.useCallback((t) => {
70
+ x && u && ft(t) && u(), pt(t) && (t.preventDefault(), !e && !b && i && i({
71
+ ...S,
72
+ action: Et,
71
73
  target: "ask"
72
- }), b());
73
- }, [B, o, f, n, b, c]), Z = r.useCallback((t) => {
74
- const e = X(h, E);
75
- G(t, e);
76
- }, [E, h, G]);
74
+ }), C());
75
+ }, [x, e, b, i, C, u]), q = r.useCallback((t) => {
76
+ const n = H(E, _);
77
+ A(t, n);
78
+ }, [_, E, A]);
77
79
  r.useEffect(() => {
78
- queueMicrotask(d);
80
+ queueMicrotask(h);
79
81
  }, []), r.useEffect(() => {
80
- if (u && a.current && !o && x) {
82
+ a.current && p !== void 0 && a.current.value !== p && (a.current.value = p, v(p.trim().length === 0), B(p.length >= l.MAX_LENGTH));
83
+ }, [p]), r.useEffect(() => {
84
+ if (d && a.current && !e && R) {
81
85
  const {
82
86
  prompt: t,
83
- type: e
84
- } = u;
85
- a.current.value = t, b(e), x(null);
87
+ type: n
88
+ } = d;
89
+ a.current.value = t, o && o(t), C(n), R(null);
86
90
  }
87
- }, [u == null ? void 0 : u.id]);
88
- const $ = r.useCallback((t) => {
89
- a.current && (a.current.value = t, M(), d());
90
- }, [M, d]), k = !!y, z = () => /* @__PURE__ */ l(T.Group, {
91
+ }, [d == null ? void 0 : d.id]);
92
+ const g = r.useCallback((t) => {
93
+ a.current && (a.current.value = t, N(), h());
94
+ }, [N, h]), G = !!X, Q = () => /* @__PURE__ */ m(L.Group, {
91
95
  name: "prompt-library",
92
96
  type: "single",
93
- children: /* @__PURE__ */ _(T.ChipButton, {
94
- "aria-label": i.formatMessage(s.openPromptLibraryBtn),
95
- className: p.promptButton,
97
+ children: /* @__PURE__ */ M(L.ChipButton, {
98
+ "aria-label": s.formatMessage(c.openPromptLibraryBtn),
99
+ className: f.promptButton,
96
100
  "data-target-id": "open-prompt-library-button",
97
101
  "data-testid": "open-prompt-library-button",
98
102
  onClick: () => {
99
- y($);
103
+ X(g);
100
104
  },
101
105
  value: "add-prompt",
102
- children: [/* @__PURE__ */ l(T.Icon, {
103
- icon: st
104
- }), /* @__PURE__ */ l(T.Label, {
105
- children: i.formatMessage(s.promptsBtn)
106
+ children: [/* @__PURE__ */ m(L.Icon, {
107
+ icon: ct
108
+ }), /* @__PURE__ */ m(L.Label, {
109
+ children: s.formatMessage(c.promptsBtn)
106
110
  })]
107
111
  })
108
- }), w = (t) => Y ? /* @__PURE__ */ l(ft, {
109
- lastQuestion: C,
110
- onStopQuestion: S,
111
- recordAction: n,
112
+ }), I = (t) => Z ? /* @__PURE__ */ m(bt, {
113
+ lastQuestion: T,
114
+ onStopQuestion: U,
115
+ recordAction: i,
112
116
  size: t
113
- }) : /* @__PURE__ */ l(ot, {
114
- content: i.formatMessage(s.ask),
117
+ }) : /* @__PURE__ */ m(ot, {
118
+ content: s.formatMessage(c.ask),
115
119
  "data-testid": "ask-tooltip",
116
120
  variant: "standard",
117
- children: /* @__PURE__ */ l(nt, {
118
- "aria-label": i.formatMessage(s.ask),
119
- className: p.inputAreaButton,
121
+ children: /* @__PURE__ */ m(st, {
122
+ "aria-label": s.formatMessage(c.ask),
123
+ className: f.inputAreaButton,
120
124
  "data-testid": "content-answers-submit-button",
121
- disabled: f || o,
122
- icon: it,
125
+ disabled: b || e,
126
+ icon: lt,
123
127
  loading: !1,
124
- loadingAriaLabel: i.formatMessage(s.askDisabledTooltip),
125
- onClick: V,
128
+ loadingAriaLabel: s.formatMessage(c.askDisabledTooltip),
129
+ onClick: $,
126
130
  size: t,
127
131
  "data-target-id": "Button-ask"
128
132
  })
129
133
  });
130
- return /* @__PURE__ */ _("div", {
131
- children: [C && /* @__PURE__ */ l(ut, {
132
- lastQuestion: C,
133
- onRetryButtonInteraction: L,
134
- onRetryQuestion: Z,
135
- recordAction: n
136
- }), /* @__PURE__ */ _("div", {
137
- className: g(p.questionInput, O && p.sidebar, !k && p.questionInputWithOutPromptLibrary),
138
- children: [/* @__PURE__ */ l(et, {
134
+ return /* @__PURE__ */ M("div", {
135
+ children: [T && /* @__PURE__ */ m(dt, {
136
+ lastQuestion: T,
137
+ onRetryButtonInteraction: k,
138
+ onRetryQuestion: q,
139
+ recordAction: i
140
+ }), /* @__PURE__ */ M("div", {
141
+ className: tt(f.questionInput, w && f.sidebar, !G && f.questionInputWithOutPromptLibrary),
142
+ children: [/* @__PURE__ */ m(it, {
139
143
  ref: a,
140
- className: p.textArea,
141
- "data-target-id": ct,
144
+ className: f.textArea,
145
+ "data-target-id": ut,
142
146
  "data-testid": "content-answers-question-input",
143
- error: W && i.formatMessage(s.maxCharactersReachedError, {
144
- characterLimit: m.MAX_LENGTH
147
+ error: Y && s.formatMessage(c.maxCharactersReachedError, {
148
+ characterLimit: l.MAX_LENGTH
145
149
  }),
146
150
  hideLabel: !0,
147
- label: i.formatMessage(s.askQuestionPlaceholder),
148
- maxLength: m.MAX_LENGTH,
149
- maxRows: U,
150
- onChange: M,
151
- onKeyDown: J,
152
- placeholder: i.formatMessage(s.askQuestionPlaceholder)
153
- }), k && /* @__PURE__ */ _("div", {
154
- className: p.actionContainer,
155
- children: [z(), w("small")]
156
- }), !k && w("large")]
151
+ label: s.formatMessage(c.askQuestionPlaceholder),
152
+ maxLength: l.MAX_LENGTH,
153
+ maxRows: D,
154
+ onChange: N,
155
+ onKeyDown: z,
156
+ placeholder: s.formatMessage(c.askQuestionPlaceholder)
157
+ }), G && /* @__PURE__ */ M("div", {
158
+ className: f.actionContainer,
159
+ children: [Q(), I("small")]
160
+ }), !G && I("large")]
157
161
  })]
158
162
  });
159
163
  };
160
164
  export {
161
- Xt as Footer
165
+ Ht as Footer
162
166
  };
@@ -1,26 +1,26 @@
1
- import { useBreakpoint as V, Breakpoint as X, Modal as c, TooltipProvider as Y, Tooltip as Z } from "@box/blueprint-web";
2
- import { ArrowsCollapse as $ } from "@box/blueprint-web-assets/icons/Fill";
3
- import { BoxAiLogo as ee } from "@box/blueprint-web-assets/icons/Logo";
1
+ import { useBreakpoint as Y, Breakpoint as Z, Modal as c, TooltipProvider as $, Tooltip as ee } from "@box/blueprint-web";
2
+ import { ArrowsCollapse as oe } from "@box/blueprint-web-assets/icons/Fill";
3
+ import { BoxAiLogo as te } from "@box/blueprint-web-assets/icons/Logo";
4
4
  import { Size8 as w } from "@box/blueprint-web-assets/tokens/tokens";
5
- import { BoxAiAgentSelectorWithApi as oe, AgentsProvider as te } from "@box/box-ai-agent-selector";
6
- import { useState as se, useMemo as ae, useCallback as I, useEffect as C } from "react";
7
- import { useIntl as le } from "react-intl";
8
- import { BoxAiContentAnswers as re } from "../../box-ai-content-answers.js";
9
- import { A as ne, R as ie } from "../../../../chunks/types.js";
10
- import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as de } from "../common/constants.js";
11
- import { s, C as ce } from "../../../../chunks/clear-conversation-button.js";
12
- import me from "./hooks/useStopPropagationOnEsc.js";
13
- import { Title as ge } from "./title.js";
5
+ import { BoxAiAgentSelectorWithApi as se, AgentsProvider as ae } from "@box/box-ai-agent-selector";
6
+ import { useState as le, useMemo as re, useCallback as I, useEffect as C } from "react";
7
+ import { useIntl as ne } from "react-intl";
8
+ import { BoxAiContentAnswers as ie } from "../../box-ai-content-answers.js";
9
+ import { A as de, R as ce } from "../../../../chunks/types.js";
10
+ import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as me } from "../common/constants.js";
11
+ import { s, C as ge } from "../../../../chunks/clear-conversation-button.js";
12
+ import fe from "./hooks/useStopPropagationOnEsc.js";
13
+ import { Title as ue } 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 fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", ue = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel, Ce = (o) => o ? $ : void 0, pe = (o) => {
16
+ const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", pe = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel, Me = (o) => o ? oe : void 0, he = (o) => {
17
17
  const l = o === "collapsible";
18
18
  return {
19
- closeModalLabel: ue(l),
20
- closeModalTargetId: fe(l),
21
- closeModalIcon: Ce(l)
19
+ closeModalLabel: pe(l),
20
+ closeModalTargetId: Ce(l),
21
+ closeModalIcon: Me(l)
22
22
  };
23
- }, _e = ({
23
+ }, Pe = ({
24
24
  children: o,
25
25
  getAIStudioAgents: l,
26
26
  hasCustomSuggestedQuestions: x,
@@ -33,29 +33,31 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
33
33
  onClearAction: f,
34
34
  onSelectAgent: k,
35
35
  onSelectedAgentCallback: P,
36
+ promptValue: q,
36
37
  recordAction: r,
37
- shouldRenderProviders: q = !0,
38
- shouldShowLandingPage: G = !1,
39
- stopPropagationOnEsc: H,
38
+ setPromptValue: G,
39
+ shouldRenderProviders: H = !0,
40
+ shouldShowLandingPage: z = !1,
41
+ stopPropagationOnEsc: F,
40
42
  variant: L = "closable",
41
43
  items: i,
42
44
  parentItem: d,
43
- ...z
45
+ ...j
44
46
  }) => {
45
47
  var E, v;
46
48
  const {
47
49
  open: R,
48
- defaultOpen: F,
49
- onOpenChange: j,
50
- modal: D,
50
+ defaultOpen: D,
51
+ onOpenChange: Q,
52
+ modal: U,
51
53
  ...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), {
54
+ } = j, b = ne(), W = Y() <= Z.Medium;
55
+ fe(F, R);
56
+ const u = (v = (E = a == null ? void 0 : a.questions) == null ? void 0 : E[a.questions.length - 1]) == null ? void 0 : v.error, [y, A] = le(!1), {
55
57
  closeModalLabel: O,
56
- closeModalTargetId: W,
57
- closeModalIcon: y
58
- } = ae(() => pe(L), [L]), n = I((t) => {
58
+ closeModalTargetId: K,
59
+ closeModalIcon: J
60
+ } = re(() => he(L), [L]), n = I((t) => {
59
61
  r && (t.data ?? (t.data = {}), t.data.hostAppName = m, r(t));
60
62
  }, [m, r]);
61
63
  C(() => {
@@ -80,18 +82,18 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
80
82
  }
81
83
  });
82
84
  }, [n, d, r]), C(() => {
83
- u && u === ne.AGENT_NOT_FOUND && A(!0);
85
+ u && u === de.AGENT_NOT_FOUND && A(!0);
84
86
  }, [u]);
85
- const K = () => {
87
+ const V = () => {
86
88
  f && (f(), n({
87
89
  ...p,
88
- action: de,
90
+ action: me,
89
91
  target: "clearChat"
90
92
  }));
91
- }, J = I(async () => (A(!1), l()), [l]), N = /* @__PURE__ */ M(c, {
92
- defaultOpen: F,
93
- modal: D,
94
- onOpenChange: j,
93
+ }, X = I(async () => (A(!1), l()), [l]), N = /* @__PURE__ */ M(c, {
94
+ defaultOpen: D,
95
+ modal: U,
96
+ onOpenChange: Q,
95
97
  open: R,
96
98
  children: [/* @__PURE__ */ e(c.Trigger, {
97
99
  children: o
@@ -103,28 +105,28 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
103
105
  className: s.modalHeaderContainer,
104
106
  children: /* @__PURE__ */ M("div", {
105
107
  className: s.modalHeader,
106
- children: [!Q && /* @__PURE__ */ e(ee, {
108
+ children: [!W && /* @__PURE__ */ e(te, {
107
109
  className: s.BoxAIIconColor,
108
110
  "data-testid": "content-answers-icon-color",
109
111
  height: w,
110
112
  width: w
111
- }), /* @__PURE__ */ e(ge, {
113
+ }), /* @__PURE__ */ e(ue, {
112
114
  isAIStudioAgentSelectorEnabled: g
113
- }), g && /* @__PURE__ */ e(oe, {
115
+ }), g && /* @__PURE__ */ e(se, {
114
116
  contentClassName: s.agentSelectorContent,
115
117
  disabled: a.hasRequestInProgress,
116
- fetcher: J,
118
+ fetcher: X,
117
119
  hostAppName: m,
118
120
  onSelectAgent: k,
119
121
  onSelectedAgentCallback: P,
120
122
  recordAction: r,
121
- requestState: U ? ie.ERROR : void 0,
123
+ requestState: y ? ce.ERROR : void 0,
122
124
  shouldHideAgentSelectorOnLoad: !0,
123
125
  triggerChipClassName: s.agentSelectorTrigger,
124
126
  useAgentLocalStorage: !0
125
127
  })]
126
128
  })
127
- }), /* @__PURE__ */ e(re, {
129
+ }), /* @__PURE__ */ e(ie, {
128
130
  className: s.boxAiContentAnswers,
129
131
  hasCustomSuggestedQuestions: x,
130
132
  hostAppName: m,
@@ -133,32 +135,34 @@ const fe = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
133
135
  isStopResponseEnabled: _,
134
136
  items: i,
135
137
  parentItem: d,
138
+ promptValue: q,
136
139
  recordAction: n,
137
- shouldShowLandingPage: G,
140
+ setPromptValue: G,
141
+ shouldShowLandingPage: z,
138
142
  ...a
139
- }), f && /* @__PURE__ */ e(ce, {
143
+ }), f && /* @__PURE__ */ e(ge, {
140
144
  hasRequestInProgress: a.hasRequestInProgress,
141
- onClick: K
142
- }), /* @__PURE__ */ e(Y, {
143
- children: /* @__PURE__ */ e(Z, {
145
+ onClick: V
146
+ }), /* @__PURE__ */ e($, {
147
+ children: /* @__PURE__ */ e(ee, {
144
148
  content: b.formatMessage(O),
145
149
  "data-testid": "content-answers-close-modal-tooltip",
146
150
  children: /* @__PURE__ */ e(c.Close, {
147
151
  "aria-label": b.formatMessage(O),
148
152
  className: s["modal-close-button"],
149
- "data-target-id": W,
150
- icon: y,
153
+ "data-target-id": K,
154
+ icon: J,
151
155
  size: "small"
152
156
  })
153
157
  })
154
158
  })]
155
159
  })]
156
160
  });
157
- return q ? /* @__PURE__ */ e(te, {
161
+ return H ? /* @__PURE__ */ e(ae, {
158
162
  children: N
159
163
  }) : N;
160
164
  };
161
165
  export {
162
- _e as IntelligenceModal,
163
- _e as default
166
+ Pe as IntelligenceModal,
167
+ Pe as default
164
168
  };
@@ -1,44 +1,44 @@
1
- import { Text as te, Tooltip as $, IconButton as y } from "@box/blueprint-web";
2
- import { ArrowsExpand as oe, XMark as ne } from "@box/blueprint-web-assets/icons/Fill";
3
- import { useAgents as se, BoxAiAgentSelectorWithApi as ae } from "@box/box-ai-agent-selector";
4
- import Q from "clsx";
5
- import H from "lodash/isEqual";
6
- import * as h from "react";
7
- import { useIntl as ie } from "react-intl";
8
- import { BoxAiContentAnswers as re } from "../../box-ai-content-answers.js";
9
- import { withApiWrapper as ce } from "../api-wrapper/api-wrapper.js";
10
- import { ORIGIN_BOXAI_SIDEBAR as de, EVENT_JS_READY as le } from "../common/constants.js";
11
- import { mark as be } from "../common/performance.js";
12
- import { C as Se } from "../../../../chunks/clear-conversation-button.js";
13
- import { IntelligenceModal as pe } from "../modal/modal.js";
14
- import { IntelligenceSidebarContext as Ae } from "./context.js";
15
- import b from "./messages.js";
16
- import he from "./title.js";
17
- import { jsxs as m, Fragment as V, jsx as e } from "react/jsx-runtime";
18
- import '../../../../styles/content.css';const me = "_bcsSidebarBase_1kkpe_2", Ie = "_bcsContent_1kkpe_2", _e = "_bcsBoxAISidebar_1kkpe_2", ue = "_bcsContentHeader_1kkpe_6", Ce = "_bcsTitle_1kkpe_15", xe = "_bcsScrollContent_1kkpe_22", ge = "_withModalOpen_1kkpe_32", Be = "_bcsBoxAISidebarAgentSelector_1kkpe_35", fe = "_bcsBoxAISidebarAgentSelectorContainer_1kkpe_39", ke = "_bcsBoxAISidebarChatActions_1kkpe_43", we = "_bcsBoxAISidebarContent_1kkpe_47", Te = "_bcsBoxAISidebarExpand_1kkpe_50", Ee = "_bcsBoxAISidebarClear_1kkpe_53", Ne = "_bcsBoxAISidebarTitlePart_1kkpe_56", ve = "_bcsBoxAISidebarClose_1kkpe_77", Me = "_sidebarChip_1kkpe_88", Pe = "_bcsContentSubheader_1kkpe_101", Le = "_bcsScrollContentWrapper_1kkpe_110", Oe = "_withSubheader_1kkpe_115", Re = "_expanded_1kkpe_118", t = {
19
- bcsSidebarBase: me,
20
- bcsContent: Ie,
21
- bcsBoxAISidebar: _e,
22
- bcsContentHeader: ue,
23
- bcsTitle: Ce,
24
- bcsScrollContent: xe,
25
- withModalOpen: ge,
26
- bcsBoxAISidebarAgentSelector: Be,
27
- bcsBoxAISidebarAgentSelectorContainer: fe,
28
- bcsBoxAISidebarChatActions: ke,
29
- bcsBoxAISidebarContent: we,
30
- bcsBoxAISidebarExpand: Te,
31
- bcsBoxAISidebarClear: Ee,
32
- bcsBoxAISidebarTitlePart: Ne,
33
- bcsBoxAISidebarClose: ve,
34
- sidebarChip: Me,
35
- bcsContentSubheader: Pe,
36
- bcsScrollContentWrapper: Le,
37
- withSubheader: Oe,
38
- expanded: Re
39
- }, qe = `${de}_${le}`;
40
- be(qe);
41
- const Ue = ({
1
+ import { Text as ne, Tooltip as y, IconButton as H } from "@box/blueprint-web";
2
+ import { ArrowsExpand as se, XMark as ae } from "@box/blueprint-web-assets/icons/Fill";
3
+ import { useAgents as ie, BoxAiAgentSelectorWithApi as re } from "@box/box-ai-agent-selector";
4
+ import D from "clsx";
5
+ import Q from "lodash/isEqual";
6
+ import * as b from "react";
7
+ import { useIntl as ce } from "react-intl";
8
+ import { BoxAiContentAnswers as de } from "../../box-ai-content-answers.js";
9
+ import { withApiWrapper as le } from "../api-wrapper/api-wrapper.js";
10
+ import { ORIGIN_BOXAI_SIDEBAR as be, EVENT_JS_READY as pe } from "../common/constants.js";
11
+ import { mark as Se } from "../common/performance.js";
12
+ import { C as Ae } from "../../../../chunks/clear-conversation-button.js";
13
+ import { IntelligenceModal as me } from "../modal/modal.js";
14
+ import { IntelligenceSidebarContext as he } from "./context.js";
15
+ import p from "./messages.js";
16
+ import Ie from "./title.js";
17
+ import { jsxs as h, Fragment as z, jsx as e } from "react/jsx-runtime";
18
+ import '../../../../styles/content.css';const ue = "_bcsSidebarBase_1kkpe_2", _e = "_bcsContent_1kkpe_2", Ce = "_bcsBoxAISidebar_1kkpe_2", xe = "_bcsContentHeader_1kkpe_6", ge = "_bcsTitle_1kkpe_15", Be = "_bcsScrollContent_1kkpe_22", fe = "_withModalOpen_1kkpe_32", ke = "_bcsBoxAISidebarAgentSelector_1kkpe_35", we = "_bcsBoxAISidebarAgentSelectorContainer_1kkpe_39", Te = "_bcsBoxAISidebarChatActions_1kkpe_43", Ee = "_bcsBoxAISidebarContent_1kkpe_47", Ne = "_bcsBoxAISidebarExpand_1kkpe_50", ve = "_bcsBoxAISidebarClear_1kkpe_53", Pe = "_bcsBoxAISidebarTitlePart_1kkpe_56", Me = "_bcsBoxAISidebarClose_1kkpe_77", Le = "_sidebarChip_1kkpe_88", Oe = "_bcsContentSubheader_1kkpe_101", Re = "_bcsScrollContentWrapper_1kkpe_110", qe = "_withSubheader_1kkpe_115", Ue = "_expanded_1kkpe_118", t = {
19
+ bcsSidebarBase: ue,
20
+ bcsContent: _e,
21
+ bcsBoxAISidebar: Ce,
22
+ bcsContentHeader: xe,
23
+ bcsTitle: ge,
24
+ bcsScrollContent: Be,
25
+ withModalOpen: fe,
26
+ bcsBoxAISidebarAgentSelector: ke,
27
+ bcsBoxAISidebarAgentSelectorContainer: we,
28
+ bcsBoxAISidebarChatActions: Te,
29
+ bcsBoxAISidebarContent: Ee,
30
+ bcsBoxAISidebarExpand: Ne,
31
+ bcsBoxAISidebarClear: ve,
32
+ bcsBoxAISidebarTitlePart: Pe,
33
+ bcsBoxAISidebarClose: Me,
34
+ sidebarChip: Le,
35
+ bcsContentSubheader: Oe,
36
+ bcsScrollContentWrapper: Re,
37
+ withSubheader: qe,
38
+ expanded: Ue
39
+ }, Ve = `${be}_${pe}`;
40
+ Se(Ve);
41
+ const We = ({
42
42
  actions: f,
43
43
  children: i,
44
44
  className: o,
@@ -48,17 +48,17 @@ const Ue = ({
48
48
  subheader: c,
49
49
  ...d
50
50
  }) => {
51
- const p = `${S}${S === "" ? "" : "_"}${I}`, _ = `${p}-content`;
52
- return /* @__PURE__ */ m("div", {
53
- "aria-labelledby": p,
54
- className: Q(t.bcsContent, o),
51
+ const A = `${S}${S === "" ? "" : "_"}${I}`, u = `${A}-content`;
52
+ return /* @__PURE__ */ h("div", {
53
+ "aria-labelledby": A,
54
+ className: D(t.bcsContent, o),
55
55
  "data-testid": "bcs-content",
56
- id: _,
56
+ id: u,
57
57
  role: "tabpanel",
58
58
  ...d,
59
- children: [/* @__PURE__ */ m("div", {
59
+ children: [/* @__PURE__ */ h("div", {
60
60
  className: t.bcsContentHeader,
61
- children: [r && /* @__PURE__ */ e(te, {
61
+ children: [r && /* @__PURE__ */ e(ne, {
62
62
  as: "h3",
63
63
  className: t.bcsTitle,
64
64
  children: r
@@ -75,7 +75,7 @@ const Ue = ({
75
75
  })]
76
76
  });
77
77
  };
78
- function We(f) {
78
+ function Fe(f) {
79
79
  const {
80
80
  createSession: i,
81
81
  encodedSession: o,
@@ -84,55 +84,55 @@ function We(f) {
84
84
  hasRequestInProgress: r,
85
85
  hostAppName: c,
86
86
  isAIStudioAgentSelectorEnabled: d,
87
- isLoading: p,
88
- onSelectAgent: _,
89
- questions: u,
87
+ isLoading: A,
88
+ onSelectAgent: u,
89
+ questions: _,
90
90
  shouldShowLandingPage: N = !0,
91
91
  sendQuestion: C,
92
92
  stopQuestion: k,
93
- embedTheAnswerButtonConfig: z,
93
+ embedTheAnswerButtonConfig: j,
94
94
  onClose: v,
95
- ...M
95
+ ...P
96
96
  } = f, {
97
97
  formatMessage: l
98
- } = ie(), P = h.useRef(!1), [w, L] = h.useState(!1), {
98
+ } = ce(), M = b.useRef(!1), [w, L] = b.useState(!1), {
99
99
  cache: s,
100
100
  contentName: O,
101
- elementId: D,
102
- fileExtension: j,
101
+ elementId: J,
102
+ fileExtension: X,
103
103
  isFeedbackEnabled: R,
104
104
  isFeedbackFormEnabled: q,
105
105
  isStopResponseEnabled: U,
106
106
  items: T,
107
- itemSize: J,
108
- onFeedbackFormSubmit: W,
109
- onUserInteraction: F,
110
- onSelectedAgentCallback: X,
111
- recordAction: A,
107
+ itemSize: Y,
108
+ onFeedbackFormSubmit: V,
109
+ onUserInteraction: W,
110
+ onSelectedAgentCallback: G,
111
+ recordAction: m,
112
112
  setCacheValue: x,
113
113
  shouldPreinitSession: g
114
- } = h.useContext(Ae), {
115
- agents: Y,
116
- requestState: G,
114
+ } = b.useContext(he), {
115
+ agents: K,
116
+ requestState: Z,
117
117
  selectedAgent: E
118
- } = se(), {
118
+ } = ie(), {
119
119
  questions: a
120
- } = s;
121
- s.shouldShowLandingPage !== N && x("shouldShowLandingPage", N), s.encodedSession !== o && x("encodedSession", o), H(s.questions, u) || x("questions", u), H(s.agents.selectedAgent, E) || x("agents", {
122
- agents: Y,
123
- requestState: G,
120
+ } = s, [F, $] = b.useState("");
121
+ s.shouldShowLandingPage !== N && x("shouldShowLandingPage", N), s.encodedSession !== o && x("encodedSession", o), Q(s.questions, _) || x("questions", _), Q(s.agents.selectedAgent, E) || x("agents", {
122
+ agents: K,
123
+ requestState: Z,
124
124
  selectedAgent: E
125
125
  });
126
126
  const B = (n = !1) => {
127
- !g && !o && !p && i && i(!0, !1), n && F && F();
128
- }, K = () => {
127
+ !g && !o && !A && i && i(!0, !1), n && W && W();
128
+ }, ee = () => {
129
129
  L(!1);
130
- }, Z = () => {
130
+ }, te = () => {
131
131
  B(), L(!0);
132
132
  };
133
- h.useEffect(() => (g && !o && i && i(!0, !0), o && a.length > 0 && a[a.length - 1].isCompleted === !1 && C({
133
+ b.useEffect(() => (g && !o && i && i(!0, !0), o && a.length > 0 && a[a.length - 1].isCompleted === !1 && C({
134
134
  prompt: a[a.length - 1].prompt
135
- }), A && A({
135
+ }), m && m({
136
136
  action: "programmatic",
137
137
  component: "sidebar",
138
138
  feature: "answers",
@@ -145,97 +145,99 @@ function We(f) {
145
145
  }
146
146
  }), () => {
147
147
  k();
148
- }), []), h.useEffect(() => {
148
+ }), []), b.useEffect(() => {
149
149
  const n = a[a.length - 1];
150
- !g && !P.current && o && (n != null && n.isLoading) && (C(n, E, !1), P.current = !0);
150
+ !g && !M.current && o && (n != null && n.isLoading) && (C(n, E, !1), M.current = !0);
151
151
  }, [o]);
152
- const ee = () => /* @__PURE__ */ m("div", {
152
+ const oe = () => /* @__PURE__ */ h("div", {
153
153
  className: t.bcsBoxAISidebarTitlePart,
154
- children: [/* @__PURE__ */ e(he, {
154
+ children: [/* @__PURE__ */ e(Ie, {
155
155
  isAIStudioAgentSelectorEnabled: d
156
156
  }), d && /* @__PURE__ */ e("div", {
157
157
  className: t.bcsBoxAISidebarAgentSelector,
158
- children: /* @__PURE__ */ e(ae, {
158
+ children: /* @__PURE__ */ e(re, {
159
159
  disabled: r,
160
160
  fetcher: I,
161
161
  hostAppName: c,
162
162
  onAgentsListOpen: B,
163
- onSelectAgent: _,
164
- onSelectedAgentCallback: X,
165
- recordAction: A,
163
+ onSelectAgent: u,
164
+ onSelectedAgentCallback: G,
165
+ recordAction: m,
166
166
  shouldHideAgentSelectorOnLoad: !0,
167
167
  useAgentLocalStorage: !0,
168
168
  variant: "sidebar"
169
169
  })
170
170
  })]
171
171
  });
172
- return /* @__PURE__ */ m(V, {
173
- children: [/* @__PURE__ */ e(Ue, {
174
- actions: /* @__PURE__ */ m(V, {
175
- children: [ee(), /* @__PURE__ */ e(Se, {
172
+ return /* @__PURE__ */ h(z, {
173
+ children: [/* @__PURE__ */ e(We, {
174
+ actions: /* @__PURE__ */ h(z, {
175
+ children: [oe(), /* @__PURE__ */ e(Ae, {
176
176
  className: t.bcsBoxAISidebarClear,
177
177
  hasRequestInProgress: r,
178
178
  onClick: S
179
- }), /* @__PURE__ */ e($, {
180
- content: l(b.sidebarBoxAISwitchToModalView),
179
+ }), /* @__PURE__ */ e(y, {
180
+ content: l(p.sidebarBoxAISwitchToModalView),
181
181
  "data-testid": "content-answers-open-modal-tooltip",
182
182
  variant: "standard",
183
- children: /* @__PURE__ */ e(y, {
184
- "aria-label": l(b.sidebarBoxAISwitchToModalView),
183
+ children: /* @__PURE__ */ e(H, {
184
+ "aria-label": l(p.sidebarBoxAISwitchToModalView),
185
185
  className: t.bcsBoxAISidebarExpand,
186
186
  "data-target-id": "IconButton-expandBoxAISidebar",
187
- icon: oe,
188
- onClick: Z,
187
+ icon: se,
188
+ onClick: te,
189
189
  size: "small"
190
190
  })
191
- }), v && /* @__PURE__ */ e($, {
192
- content: l(b.sidebarBoxAIClose),
191
+ }), v && /* @__PURE__ */ e(y, {
192
+ content: l(p.sidebarBoxAIClose),
193
193
  "data-testid": "content-answers-close-tooltip",
194
194
  variant: "standard",
195
- children: /* @__PURE__ */ e(y, {
196
- "aria-label": l(b.sidebarBoxAIClose),
195
+ children: /* @__PURE__ */ e(H, {
196
+ "aria-label": l(p.sidebarBoxAIClose),
197
197
  className: t.bcsBoxAISidebarClose,
198
198
  "data-target-id": "IconButton-closeBoxAISidebar",
199
- icon: ne,
199
+ icon: ae,
200
200
  onClick: v,
201
201
  size: "small"
202
202
  })
203
203
  })]
204
204
  }),
205
- className: Q(t.bcsBoxAISidebar, {
205
+ className: D(t.bcsBoxAISidebar, {
206
206
  [t.withModalOpen]: w
207
207
  }),
208
- elementId: D,
208
+ elementId: J,
209
209
  sidebarView: "box-ai",
210
210
  children: /* @__PURE__ */ e("div", {
211
211
  className: t.bcsBoxAISidebarContent,
212
- children: /* @__PURE__ */ e(re, {
212
+ children: /* @__PURE__ */ e(de, {
213
213
  className: t.bcsBoxAISidebarContentAnswers,
214
214
  contentName: O,
215
- contentType: l(b.sidebarBoxAIContent),
216
- embedTheAnswerButtonConfig: z,
215
+ contentType: l(p.sidebarBoxAIContent),
216
+ embedTheAnswerButtonConfig: j,
217
217
  hostAppName: c,
218
218
  isAIStudioAgentSelectorEnabled: d,
219
219
  isFeedbackEnabled: R,
220
220
  isFeedbackFormEnabled: q,
221
221
  isStopResponseEnabled: U,
222
222
  items: T,
223
- onFeedbackFormSubmit: W,
223
+ onFeedbackFormSubmit: V,
224
224
  onUserIntentToUseAI: B,
225
- questions: u,
226
- recordAction: A,
225
+ promptValue: F,
226
+ questions: _,
227
+ recordAction: m,
228
+ setPromptValue: $,
227
229
  shouldShowLandingPage: s.shouldShowLandingPage,
228
- showLoadingIndicator: p && g,
230
+ showLoadingIndicator: A && g,
229
231
  stopQuestion: k,
230
232
  submitQuestion: C,
231
233
  variant: "sidebar",
232
- ...M
234
+ ...P
233
235
  })
234
236
  })
235
- }), /* @__PURE__ */ e(pe, {
237
+ }), /* @__PURE__ */ e(me, {
236
238
  contentName: O,
237
- contentType: l(b.sidebarBoxAIContent),
238
- extension: j,
239
+ contentType: l(p.sidebarBoxAIContent),
240
+ extension: X,
239
241
  getAIStudioAgents: I,
240
242
  hasRequestInProgress: r,
241
243
  hostAppName: c,
@@ -244,27 +246,29 @@ function We(f) {
244
246
  isFeedbackFormEnabled: q,
245
247
  isStopResponseEnabled: U,
246
248
  items: T,
247
- itemSize: J,
249
+ itemSize: Y,
248
250
  onClearAction: S,
249
- onFeedbackFormSubmit: W,
250
- onOpenChange: K,
251
- onSelectAgent: _,
251
+ onFeedbackFormSubmit: V,
252
+ onOpenChange: ee,
253
+ onSelectAgent: u,
252
254
  onUserIntentToUseAI: B,
253
255
  open: w,
254
- questions: u,
255
- recordAction: w ? A : void 0,
256
+ promptValue: F,
257
+ questions: _,
258
+ recordAction: w ? m : void 0,
259
+ setPromptValue: $,
256
260
  shouldShowLandingPage: s.shouldShowLandingPage,
257
261
  showLoadingIndicator: !1,
258
262
  stopPropagationOnEsc: !0,
259
263
  stopQuestion: k,
260
264
  submitQuestion: C,
261
265
  variant: "collapsible",
262
- ...M,
266
+ ...P,
263
267
  shouldRenderProviders: !1
264
268
  })]
265
269
  });
266
270
  }
267
- const ot = ce(We);
271
+ const st = le(Fe);
268
272
  export {
269
- ot as default
273
+ st as default
270
274
  };
@@ -21,8 +21,12 @@ export type BoxAiContentAnswersProps = Omit<ContentProps, 'isErrorMessageShown'
21
21
  onCitationClick?: ItemClickHandler;
22
22
  /** Callback function when user takes an action suggesting intent to use AI or actual interaction */
23
23
  onUserIntentToUseAI?: (userHasInteracted?: boolean) => void;
24
+ /** The current prompt value from the textarea */
25
+ promptValue?: string;
24
26
  /** Callback function to handle prompt button clicks */
25
27
  promptButtonClickHandler?: (clickHandler: (content: string) => void) => void;
28
+ /** Callback function to set the prompt value */
29
+ setPromptValue?: (value: string) => void;
26
30
  variant?: StyleVariant;
27
31
  };
28
32
  export declare const BoxAiContentAnswers: React.FC<BoxAiContentAnswersProps>;
@@ -22,16 +22,20 @@ export interface FooterProps {
22
22
  onStopQuestion?: StopQuestion;
23
23
  /** Callback when the user interacts with retry button or prompt textarea */
24
24
  onUserInteraction?: () => void;
25
+ /** The current prompt value from the textarea */
26
+ promptValue?: string;
25
27
  /** Callback function to handle logging events */
26
28
  recordAction?: (payload: Record<string, unknown>) => void;
27
29
  /** Callback when the user clicks on ask question or a suggested question */
28
30
  sendQuestion: SubmitQuestion;
29
31
  /** Callback function to handle selection of suggested question */
30
32
  setAskSuggestedQuestion: ((value: SuggestedQuestionType | null) => void) | undefined;
33
+ /** Callback function to set the prompt value */
34
+ setPromptValue?: (value: string) => void;
31
35
  /** Callback function to toggle the CTRL+SHIFT+X feature */
32
36
  toggleDebugMode?: () => void;
33
37
  /** Callback function to handle prompt button clicks */
34
38
  promptButtonClickHandler?: (clickHandler: (content: string) => void) => void;
35
39
  variant?: StyleVariant;
36
40
  }
37
- export declare const Footer: ({ askSuggestedQuestion, enableDebugMode, hasRequestInProgress, isAIStudioAgentSelectorEnabled, isDebugModeShown, isStopResponseEnabled, isStreamingEnabled, lastQuestion, onRetryQuestion, onStopQuestion, onUserInteraction, recordAction, sendQuestion, setAskSuggestedQuestion, toggleDebugMode, promptButtonClickHandler, variant, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
41
+ export declare const Footer: ({ askSuggestedQuestion, enableDebugMode, hasRequestInProgress, isAIStudioAgentSelectorEnabled, isDebugModeShown, isStopResponseEnabled, isStreamingEnabled, lastQuestion, onRetryQuestion, onStopQuestion, onUserInteraction, promptValue, recordAction, sendQuestion, setAskSuggestedQuestion, setPromptValue, toggleDebugMode, promptButtonClickHandler, variant, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -19,8 +19,15 @@ export type IntelligenceModalProps = ModalProps & Omit<BoxAiContentAnswersProps,
19
19
  isStopResponseEnabled?: boolean;
20
20
  /** Extension of the item used for QA. This is used for log purposes */
21
21
  extension?: string;
22
+ /** The current prompt value from the textarea this is an optional param.
23
+ * it was added to support case of sidebar ai component that need to share prompt state between modal and sidebar ai components
24
+ * and to avoid risk change to other components that use ref to set value of prompt textarea
25
+ * */
26
+ promptValue?: string;
22
27
  /** Callback function to handle logging events */
23
28
  recordAction?: (params: RecordActionType) => void;
29
+ /** Callback function to set the prompt value */
30
+ setPromptValue?: (value: string) => void;
24
31
  /** Child elements to be rendered inside the modal */
25
32
  children?: React.ReactElement;
26
33
  /** Flag to not render providers if parent component provides them (usually apiWrapper) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
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.89.1",
20
+ "@box/blueprint-web": "^12.89.2",
21
21
  "@box/blueprint-web-assets": "^4.75.0",
22
- "@box/box-ai-agent-selector": "^1.3.5",
23
- "@box/item-icon": "^1.3.5",
22
+ "@box/box-ai-agent-selector": "^1.3.6",
23
+ "@box/item-icon": "^1.3.6",
24
24
  "@box/storybook-utils": "^0.14.11",
25
25
  "@testing-library/react": "^15.0.6",
26
26
  "react": "^18.3.0",