@box/box-ai-content-answers 0.138.4 → 0.139.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.
package/dist/esm/index.js CHANGED
@@ -1,25 +1,27 @@
1
1
  import { BoxAiContentAnswers as r } from "./lib/box-ai-content-answers.js";
2
2
  import { AnswerContent as s } from "./lib/components/answer/answer-content.js";
3
- import { withApiWrapper as E } from "./lib/components/api-wrapper/api-wrapper.js";
4
- import { C as n } from "../chunks/clear-conversation-button.js";
5
- import { IntelligenceModal as R } from "./lib/components/modal/modal.js";
6
- import { IntelligenceSidebar as x } from "./lib/components/sidebar/sidebar.js";
7
- import { APP_MODE as _ } from "./lib/constants.js";
8
- import { usePromptFocus as S } from "./lib/hooks/usePromptFocus.js";
9
- import { A as i, C, F as O, R as l, S as U, U as I } from "../chunks/types.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";
10
11
  export {
11
- i as ANSWER_ERROR,
12
- _ as APP_MODE,
12
+ O as ANSWER_ERROR,
13
+ S as APP_MODE,
13
14
  s as AnswerContent,
14
15
  r as BoxAiContentAnswers,
15
- C as CONTENT_ERROR,
16
- n as ClearConversationButton,
17
- O as FeedbackIssueType,
18
- R as IntelligenceModal,
19
- x as IntelligenceSidebar,
20
- l as REQUEST_STATE,
21
- U as SUGGESTED_QUESTION_PROMPT_TYPE,
22
- I as USER_INPUT_PROMPT_TYPE,
23
- S as usePromptFocus,
24
- E as withApiWrapper
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
25
27
  };
@@ -2,7 +2,7 @@ import g from "clsx";
2
2
  import Q from "lodash/noop";
3
3
  import * as r from "react";
4
4
  import { useIntl as tt } from "react-intl";
5
- import { useBreakpoint as at, Breakpoint as rt, TextArea as et, FilterChip as E, Tooltip as ot, Button as nt } from "@box/blueprint-web";
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
6
  import { ArrowUp as it } from "@box/blueprint-web-assets/icons/Fill";
7
7
  import { BubbleStar as st } from "@box/blueprint-web-assets/icons/Medium";
8
8
  import { useAgents as lt } from "@box/box-ai-agent-selector";
@@ -14,19 +14,19 @@ import { s as c, S as ft } from "../../../../chunks/stopResponseButton.js";
14
14
  import { U as dt } from "../../../../chunks/types.js";
15
15
  import s from "./messages.js";
16
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 T, jsx as l } from "react/jsx-runtime";
17
+ import { jsxs as _, jsx as l } from "react/jsx-runtime";
18
18
  const Xt = ({
19
19
  askSuggestedQuestion: u,
20
20
  enableDebugMode: B = !1,
21
21
  hasRequestInProgress: o,
22
- isAIStudioAgentSelectorEnabled: b,
22
+ isAIStudioAgentSelectorEnabled: h,
23
23
  isDebugModeShown: N,
24
24
  isStopResponseEnabled: P,
25
25
  isStreamingEnabled: H,
26
- lastQuestion: h,
26
+ lastQuestion: C,
27
27
  onRetryQuestion: G,
28
28
  onStopQuestion: S,
29
- onUserInteraction: _ = Q,
29
+ onUserInteraction: L = Q,
30
30
  recordAction: n,
31
31
  sendQuestion: v,
32
32
  setAskSuggestedQuestion: x,
@@ -35,62 +35,62 @@ const Xt = ({
35
35
  variant: F = "modal"
36
36
  }) => {
37
37
  const y = F === "sidebar", i = tt(), K = at(), a = r.useRef(null), U = K <= rt.Medium && !y ? m.MAX_ROWS_MOBILE : m.MAX_ROWS, [f, A] = r.useState(!0), [W, R] = r.useState(!1), {
38
- selectedAgent: C
38
+ selectedAgent: E
39
39
  } = lt(), {
40
40
  answer: j,
41
41
  isCompleted: D
42
- } = h ?? {}, Y = H && D === !1 && (P || j), L = r.useCallback(() => {
42
+ } = C ?? {}, Y = H && D === !1 && (P || j), d = r.useCallback(() => {
43
43
  a.current && a.current.focus();
44
44
  }, [a]), M = r.useCallback(() => {
45
45
  var e;
46
- _();
46
+ L();
47
47
  let t = ((e = a.current) == null ? void 0 : e.value) ?? "";
48
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, _]), d = r.useCallback((t = dt) => {
50
- if (L(), !o && a.current) {
49
+ }, [a, L]), b = r.useCallback((t = dt) => {
50
+ if (d(), !o && a.current) {
51
51
  const e = {
52
52
  prompt: a.current.value,
53
53
  promptType: t
54
54
  };
55
55
  if (e.prompt && e.prompt.trim()) {
56
- const q = X(b, C);
56
+ const q = X(h, E);
57
57
  v(e, q), a.current.value = "", A(!0), R(!1);
58
58
  }
59
59
  N && p && p();
60
60
  }
61
- }, [C, L, o, a, b, N, v, p]), V = r.useCallback((t) => {
61
+ }, [E, d, o, a, h, N, v, p]), V = r.useCallback((t) => {
62
62
  t.preventDefault(), !o && !f && n && n({
63
63
  ...I,
64
64
  action: bt,
65
65
  target: "ask"
66
- }), d();
67
- }, [o, f, n, d]), J = r.useCallback((t) => {
66
+ }), b();
67
+ }, [o, f, n, b]), J = r.useCallback((t) => {
68
68
  B && p && mt(t) && p(), ct(t) && (t.preventDefault(), !o && !f && n && n({
69
69
  ...I,
70
70
  action: ht,
71
71
  target: "ask"
72
- }), d());
73
- }, [B, o, f, n, d, p]), Z = r.useCallback((t) => {
74
- const e = X(b, C);
72
+ }), b());
73
+ }, [B, o, f, n, b, p]), Z = r.useCallback((t) => {
74
+ const e = X(h, E);
75
75
  G(t, e);
76
- }, [C, b, G]);
76
+ }, [E, h, G]);
77
77
  r.useEffect(() => {
78
- queueMicrotask(L);
78
+ queueMicrotask(d);
79
79
  }, []), r.useEffect(() => {
80
80
  if (u && a.current && !o && x) {
81
81
  const {
82
82
  prompt: t,
83
83
  type: e
84
84
  } = u;
85
- a.current.value = t, d(e), x(null);
85
+ a.current.value = t, b(e), x(null);
86
86
  }
87
87
  }, [u == null ? void 0 : u.id]);
88
88
  const $ = r.useCallback((t) => {
89
- a.current && (a.current.value = t, M());
90
- }, [M]), k = !!O, z = () => /* @__PURE__ */ l(E.Group, {
89
+ a.current && (a.current.value = t, M(), d());
90
+ }, [M, d]), k = !!O, z = () => /* @__PURE__ */ l(T.Group, {
91
91
  name: "prompt-library",
92
92
  type: "single",
93
- children: /* @__PURE__ */ T(E.ChipButton, {
93
+ children: /* @__PURE__ */ _(T.ChipButton, {
94
94
  "aria-label": i.formatMessage(s.openPromptLibraryBtn),
95
95
  className: c.promptButton,
96
96
  "data-testid": "open-prompt-library-button",
@@ -98,14 +98,14 @@ const Xt = ({
98
98
  O($);
99
99
  },
100
100
  value: "add-prompt",
101
- children: [/* @__PURE__ */ l(E.Icon, {
101
+ children: [/* @__PURE__ */ l(T.Icon, {
102
102
  icon: st
103
- }), /* @__PURE__ */ l(E.Label, {
103
+ }), /* @__PURE__ */ l(T.Label, {
104
104
  children: i.formatMessage(s.promptsBtn)
105
105
  })]
106
106
  })
107
107
  }), w = (t) => Y ? /* @__PURE__ */ l(ft, {
108
- lastQuestion: h,
108
+ lastQuestion: C,
109
109
  onStopQuestion: S,
110
110
  recordAction: n,
111
111
  size: t
@@ -126,13 +126,13 @@ const Xt = ({
126
126
  "data-target-id": "Button-ask"
127
127
  })
128
128
  });
129
- return /* @__PURE__ */ T("div", {
130
- children: [h && /* @__PURE__ */ l(ut, {
131
- lastQuestion: h,
132
- onRetryButtonInteraction: _,
129
+ return /* @__PURE__ */ _("div", {
130
+ children: [C && /* @__PURE__ */ l(ut, {
131
+ lastQuestion: C,
132
+ onRetryButtonInteraction: L,
133
133
  onRetryQuestion: Z,
134
134
  recordAction: n
135
- }), /* @__PURE__ */ T("div", {
135
+ }), /* @__PURE__ */ _("div", {
136
136
  className: g(c.questionInput, y && c.sidebar, !k && c.questionInputWithOutPromptLibrary),
137
137
  children: [/* @__PURE__ */ l(et, {
138
138
  ref: a,
@@ -149,7 +149,7 @@ const Xt = ({
149
149
  onChange: M,
150
150
  onKeyDown: J,
151
151
  placeholder: i.formatMessage(s.askQuestionPlaceholder)
152
- }), k && /* @__PURE__ */ T("div", {
152
+ }), k && /* @__PURE__ */ _("div", {
153
153
  className: c.actionContainer,
154
154
  children: [z(), w("small")]
155
155
  }), !k && w("large")]
@@ -1,5 +1,6 @@
1
1
  export * from './lib/box-ai-content-answers';
2
2
  export * from './lib/components/answer/answer-content';
3
+ export * from './lib/components/answer/references';
3
4
  export * from './lib/components/api-wrapper/api-wrapper';
4
5
  export * from './lib/components/api-wrapper/types';
5
6
  export * from './lib/components/modal/clear-conversation-button';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.138.4",
3
+ "version": "0.139.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.56.1",