@box/box-ai-content-answers 0.129.11 → 0.130.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,15 +1,21 @@
1
- let n = /* @__PURE__ */ function(e) {
1
+ let t = /* @__PURE__ */ function(e) {
2
2
  return e.GENERAL = "general", e.RATE_LIMITING = "rate_limiting", e.NO_CONTENT = "no_content", e.PRECONDITION_FAILED = "precondition_failed", e.AGENT_NOT_FOUND = "agent_not_found", e.RESPONSE_FAILED = "response_failed", e.RESPONSE_INTERRUPTED = "response_interrupted", e.RESPONSE_STOPPED = "response_stopped", e;
3
- }({}), t = /* @__PURE__ */ function(e) {
3
+ }({}), n = /* @__PURE__ */ function(e) {
4
4
  return e.LARGE_FILE = "large_file", e.GENERAL = "general", e;
5
5
  }({}), r = /* @__PURE__ */ function(e) {
6
6
  return e.NOT_STARTED = "not_started", e.IN_PROGRESS = "in_progress", e.SUCCESS = "success", e.ERROR = "error", e.CANCELLED = "cancelled", e;
7
- }({}), o = /* @__PURE__ */ function(e) {
7
+ }({}), s = /* @__PURE__ */ function(e) {
8
+ return e.CUSTOM = "suggested_question_custom", e.INTELLIGENT = "suggested_question_intelligent", e.STATIC = "suggested_question_static", e;
9
+ }({});
10
+ const o = "user_input";
11
+ let i = /* @__PURE__ */ function(e) {
8
12
  return e.DID_NOT_FOLLOW_REQUEST = "did_not_follow_request", e.INACCURATE_ANSWER = "inaccurate_answer", e.OTHER = "other", e;
9
13
  }({});
10
14
  export {
11
- n as A,
12
- t as C,
13
- o as F,
14
- r as R
15
+ t as A,
16
+ n as C,
17
+ i as F,
18
+ r as R,
19
+ s as S,
20
+ o as U
15
21
  };
package/dist/esm/index.js CHANGED
@@ -1,23 +1,25 @@
1
1
  import { BoxAiContentAnswers as r } from "./lib/box-ai-content-answers.js";
2
- import { AnswerContent as p } from "./lib/components/answer/answer-content.js";
3
- import { withApiWrapper as s } from "./lib/components/api-wrapper/api-wrapper.js";
4
- import { C as m } from "../chunks/clear-conversation-button.js";
5
- import { IntelligenceModal as f } from "./lib/components/modal/modal.js";
6
- import { IntelligenceSidebar as A } from "./lib/components/sidebar/sidebar.js";
7
- import { APP_MODE as i } from "./lib/constants.js";
8
- import { usePromptFocus as l } from "./lib/hooks/usePromptFocus.js";
9
- import { A as c, C as u, F as O, R as S } from "../chunks/types.js";
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";
10
10
  export {
11
- c as ANSWER_ERROR,
12
- i as APP_MODE,
13
- p as AnswerContent,
11
+ i as ANSWER_ERROR,
12
+ _ as APP_MODE,
13
+ s as AnswerContent,
14
14
  r as BoxAiContentAnswers,
15
- u as CONTENT_ERROR,
16
- m as ClearConversationButton,
15
+ C as CONTENT_ERROR,
16
+ n as ClearConversationButton,
17
17
  O as FeedbackIssueType,
18
- f as IntelligenceModal,
19
- A as IntelligenceSidebar,
20
- S as REQUEST_STATE,
21
- l as usePromptFocus,
22
- s as withApiWrapper
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
23
25
  };
@@ -1,33 +1,33 @@
1
- import { Text as V } from "@box/blueprint-web";
2
- import { AlertTriangle as k } from "@box/blueprint-web-assets/icons/Line";
3
- import { Gray65 as j, Size4 as E } from "@box/blueprint-web-assets/tokens/tokens";
1
+ import { Text as k } from "@box/blueprint-web";
2
+ import { AlertTriangle as j } from "@box/blueprint-web-assets/icons/Line";
3
+ import { Gray65 as z, Size4 as E } from "@box/blueprint-web-assets/tokens/tokens";
4
4
  import p from "clsx";
5
5
  import * as l from "react";
6
- import { useIntl as z } from "react-intl";
6
+ import { useIntl as W } from "react-intl";
7
7
  import { A as n } from "../../../../chunks/types.js";
8
8
  import { MediaContainer as N } from "../common/media-container.js";
9
- import { AnswerContent as W } from "./answer-content.js";
10
- import { CopyButton as q } from "./copy-button.js";
11
- import { InlineError as J } from "./inline-error.js";
12
- import { ThumbButtons as K } from "./thumb-buttons.js";
9
+ import { AnswerContent as q } from "./answer-content.js";
10
+ import { CopyButton as J } from "./copy-button.js";
11
+ import { InlineError as K } from "./inline-error.js";
13
12
  import { LoadingIndicator as Q } from "./loading-indicator.js";
14
13
  import m from "./messages.js";
15
14
  import { References as X } from "./references.js";
15
+ import { ThumbButtons as Y } from "./thumb-buttons.js";
16
16
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
17
- import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertIcon_140hd_5", $ = "_error_140hd_8", tt = "_footer_140hd_12", ot = "_copyButtonContainer_140hd_18", et = "_feedbackButtonsContainer_140hd_19", nt = "_shouldHaveMarginTop_140hd_23", st = "_shouldUseAnimation_140hd_26", rt = "_shouldAnimateHeight_140hd_30", at = "_footerButtons_140hd_34", it = "_iconAvatar_140hd_40", dt = "_buttonsVisible_140hd_56", t = {
18
- answer: Y,
19
- alertIcon: Z,
20
- error: $,
21
- footer: tt,
22
- copyButtonContainer: ot,
23
- feedbackButtonsContainer: et,
24
- shouldHaveMarginTop: nt,
25
- shouldUseAnimation: st,
26
- shouldAnimateHeight: rt,
27
- footerButtons: at,
28
- iconAvatar: it,
29
- buttonsVisible: dt
30
- }, ct = /* @__PURE__ */ new Set([n.RATE_LIMITING, n.NO_CONTENT, n.PRECONDITION_FAILED, n.GENERAL, n.AGENT_NOT_FOUND]), Ot = /* @__PURE__ */ l.memo(({
17
+ import '../../../../styles/answer.css';const Z = "_answer_140hd_1", $ = "_alertIcon_140hd_5", tt = "_error_140hd_8", ot = "_footer_140hd_12", et = "_copyButtonContainer_140hd_18", nt = "_feedbackButtonsContainer_140hd_19", st = "_shouldHaveMarginTop_140hd_23", rt = "_shouldUseAnimation_140hd_26", at = "_shouldAnimateHeight_140hd_30", it = "_footerButtons_140hd_34", dt = "_iconAvatar_140hd_40", ct = "_buttonsVisible_140hd_56", t = {
18
+ answer: Z,
19
+ alertIcon: $,
20
+ error: tt,
21
+ footer: ot,
22
+ copyButtonContainer: et,
23
+ feedbackButtonsContainer: nt,
24
+ shouldHaveMarginTop: st,
25
+ shouldUseAnimation: rt,
26
+ shouldAnimateHeight: at,
27
+ footerButtons: it,
28
+ iconAvatar: dt,
29
+ buttonsVisible: ct
30
+ }, lt = /* @__PURE__ */ new Set([n.RATE_LIMITING, n.NO_CONTENT, n.PRECONDITION_FAILED, n.GENERAL, n.AGENT_NOT_FOUND]), bt = /* @__PURE__ */ l.memo(({
31
31
  answer: s,
32
32
  citations: I,
33
33
  error: o,
@@ -46,40 +46,41 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
46
46
  onCitationClick: C,
47
47
  onFeedbackFormSubmit: v,
48
48
  onFeedbackTooltipOpenChange: M,
49
+ promptType: y,
49
50
  recordAction: d,
50
- shouldFeedbackFormIncludeFeedbackText: y,
51
- useAnimation: D = !0,
51
+ shouldFeedbackFormIncludeFeedbackText: D,
52
+ useAnimation: H = !0,
52
53
  variant: r = "modal",
53
- setAnswerFeedback: H,
54
- questionId: L
54
+ setAnswerFeedback: L,
55
+ questionId: U
55
56
  }) => {
56
- const _ = ct.has(o), h = b && !s && !o, [U, x] = l.useState(i), {
57
+ const _ = lt.has(o), h = b && !s && !o, [x, F] = l.useState(i), {
57
58
  formatMessage: c
58
- } = z();
59
+ } = W();
59
60
  l.useEffect(() => {
60
- setTimeout(() => x(i), 0);
61
+ setTimeout(() => F(i), 0);
61
62
  }, [i]);
62
- const f = () => /* @__PURE__ */ e(k, {
63
+ const f = () => /* @__PURE__ */ e(j, {
63
64
  className: t.alertIcon,
64
- color: j,
65
+ color: z,
65
66
  "data-testid": "content-answers-error-alert-icon",
66
67
  height: E,
67
68
  role: "presentation",
68
69
  width: E
69
- }), F = () => /* @__PURE__ */ a(V, {
70
+ }), G = () => /* @__PURE__ */ a(k, {
70
71
  as: "p",
71
72
  className: t.error,
72
73
  color: "textOnLightSecondary",
73
74
  "data-testid": "content-answers-error",
74
75
  variant: "caption",
75
76
  children: [o === n.RESPONSE_INTERRUPTED && c(m.responseInterruptedError), o === n.RESPONSE_FAILED && c(m.responseFailedError), o === n.RESPONSE_STOPPED && c(m.responseStoppedError), o !== n.RESPONSE_STOPPED && f()]
76
- }), G = () => o !== n.RESPONSE_STOPPED ? /* @__PURE__ */ a("div", {
77
+ }), V = () => o !== n.RESPONSE_STOPPED ? /* @__PURE__ */ a("div", {
77
78
  className: p(t.footerButtons, "footer-buttons-container", {
78
79
  [t.buttonsVisible]: u
79
80
  }),
80
81
  children: [g ? /* @__PURE__ */ e("div", {
81
82
  className: t.feedbackButtonsContainer,
82
- children: /* @__PURE__ */ e(K, {
83
+ children: /* @__PURE__ */ e(Y, {
83
84
  feedbackValue: T,
84
85
  hostAppName: A,
85
86
  isFeedbackFormEnabled: O,
@@ -87,15 +88,16 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
87
88
  items: B,
88
89
  onFeedbackFormSubmit: v,
89
90
  onFeedbackTooltipOpenChange: M,
90
- questionId: L,
91
+ promptType: y,
92
+ questionId: U,
91
93
  recordAction: d,
92
- setAnswerFeedback: H,
93
- shouldFeedbackFormIncludeFeedbackText: y,
94
+ setAnswerFeedback: L,
95
+ shouldFeedbackFormIncludeFeedbackText: D,
94
96
  variant: r
95
97
  })
96
98
  }) : null, /* @__PURE__ */ e("div", {
97
99
  className: t.copyButtonContainer,
98
- children: /* @__PURE__ */ e(q, {
100
+ children: /* @__PURE__ */ e(J, {
99
101
  answer: s,
100
102
  onAnswerCopy: P,
101
103
  recordAction: d
@@ -112,25 +114,25 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
112
114
  children: /* @__PURE__ */ a(N.Content, {
113
115
  isUsedInsideSidebar: r === "sidebar",
114
116
  variant: "answer",
115
- children: [/* @__PURE__ */ e(W, {
117
+ children: [/* @__PURE__ */ e(q, {
116
118
  answer: s,
117
119
  isMarkdownEnabled: w,
118
120
  variant: r
119
121
  }), i && /* @__PURE__ */ a("div", {
120
122
  className: p(t.footer, {
121
123
  [t.shouldHaveMarginTop]: s,
122
- [t.shouldAnimateHeight]: U,
123
- [t.shouldUseAnimation]: D
124
+ [t.shouldAnimateHeight]: x,
125
+ [t.shouldUseAnimation]: H
124
126
  }),
125
127
  "data-testid": "content-answers-answer-footer",
126
- children: [o && F(), R && !o && /* @__PURE__ */ e(X, {
128
+ children: [o && G(), R && !o && /* @__PURE__ */ e(X, {
127
129
  citations: I,
128
130
  onCitationClick: C,
129
131
  recordAction: d
130
- }), G()]
132
+ }), V()]
131
133
  })]
132
134
  })
133
- }), _ && /* @__PURE__ */ e(J, {
135
+ }), _ && /* @__PURE__ */ e(K, {
134
136
  contentType: S,
135
137
  error: o,
136
138
  recordAction: d,
@@ -139,6 +141,6 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
139
141
  });
140
142
  });
141
143
  export {
142
- Ot as Answer,
143
- Ot as default
144
+ bt as Answer,
145
+ bt as default
144
146
  };
@@ -1,28 +1,29 @@
1
- import { useNotification as v, Tooltip as T, IconButton as M } from "@box/blueprint-web";
2
- import { ThumbUp as E, ThumbDown as I } from "@box/blueprint-web-assets/icons/Fill";
3
- import { ThumbUp as S, ThumbDown as W } from "@box/blueprint-web-assets/icons/Line";
1
+ import { useNotification as E, Tooltip as T, IconButton as p } from "@box/blueprint-web";
2
+ import { ThumbUp as I, ThumbDown as S } from "@box/blueprint-web-assets/icons/Fill";
3
+ import { ThumbUp as W, ThumbDown as d } from "@box/blueprint-web-assets/icons/Line";
4
4
  import c from "react";
5
- import { useIntl as d } from "react-intl";
6
- import { FeedbackTooltip as $ } from "./feedback-tooltip.js";
5
+ import { useIntl as $ } from "react-intl";
7
6
  import { LOGGER_BASE_CONFIG as j, LOGGER_ACTION_PROGRAMMATIC as z } from "../common/constants.js";
8
- import L from "../../messages.js";
7
+ import { FeedbackTooltip as A } from "./feedback-tooltip.js";
8
+ import M from "../../messages.js";
9
+ import { focusInput as J } from "../common/focusInputUtils.js";
9
10
  import r from "./messages.js";
10
- import { focusInput as A } from "../common/focusInputUtils.js";
11
- import { jsxs as J, Fragment as K, jsx as f } from "react/jsx-runtime";
12
- import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V = {
13
- thumbDown: Q
11
+ import { jsxs as K, Fragment as Q, jsx as f } from "react/jsx-runtime";
12
+ import '../../../../styles/thumb-buttons.css';const V = "_thumbDown_1axcd_1", X = {
13
+ thumbDown: V
14
14
  }, u = {
15
15
  THUMB_UP: "positive",
16
16
  THUMB_DOWN: "negative",
17
17
  NONE: "none"
18
- }, at = ({
19
- feedbackValue: p,
18
+ }, mt = ({
19
+ feedbackValue: L,
20
20
  hostAppName: _,
21
- isFeedbackFormEnabled: w = !1,
22
- isFeedbackTooltipOpen: y = !1,
23
- items: e,
21
+ isFeedbackFormEnabled: y = !1,
22
+ isFeedbackTooltipOpen: w = !1,
23
+ items: h,
24
24
  onFeedbackFormSubmit: D,
25
25
  onFeedbackTooltipOpenChange: s,
26
+ promptType: N,
26
27
  questionId: a,
27
28
  recordAction: i,
28
29
  setAnswerFeedback: o,
@@ -31,9 +32,9 @@ import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V
31
32
  }) => {
32
33
  const {
33
34
  formatMessage: m
34
- } = d(), {
35
- addNotification: N
36
- } = v(), l = p, U = c.useMemo(() => e.filter((t) => t.status === "supported").map((t) => t.fileType), [e]), b = c.useCallback((t) => {
35
+ } = $(), {
36
+ addNotification: x
37
+ } = E(), l = L, U = c.useMemo(() => h.filter((t) => t.status === "supported").map((t) => t.fileType), [h]), b = c.useCallback((t) => {
37
38
  l !== t && (o == null || o(a, t), i == null || i({
38
39
  ...j,
39
40
  action: z,
@@ -42,61 +43,62 @@ import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V
42
43
  data: {
43
44
  feedback_value: t,
44
45
  file_types: U,
45
- feature: _
46
+ feature: _,
47
+ prompt_type: N
46
48
  }
47
- }), A());
48
- }, [_, i, l, B, U, a, o]), x = ({
49
+ }), J());
50
+ }, [_, i, l, B, U, a, o]), H = ({
49
51
  feedback: t,
50
- issueType: R
52
+ issueType: v
51
53
  }) => {
52
54
  if (s == null || s(!1, a), !D)
53
55
  return;
54
- const h = {
56
+ const e = {
55
57
  fileTypes: U,
56
58
  hostApp: _,
57
- issueType: R,
59
+ issueType: v,
58
60
  timestamp: Date.now(),
59
61
  questionId: a
60
62
  };
61
- n && (h.feedback = t, h.hasFeedback = !!t), D(h, () => {
62
- N({
63
+ n && (e.feedback = t, e.hasFeedback = !!t), D(e, () => {
64
+ x({
63
65
  sensitivity: "foreground",
64
66
  styledText: m(r.feedbackTooltipConfirmation),
65
67
  variant: "success",
66
- typeIconAriaLabel: m(L.ariaTypeSuccessIconLabel),
67
- closeButtonAriaLabel: m(L.closeButtonText)
68
+ typeIconAriaLabel: m(M.ariaTypeSuccessIconLabel),
69
+ closeButtonAriaLabel: m(M.closeButtonText)
68
70
  });
69
71
  });
70
- }, H = (t) => {
72
+ }, G = (t) => {
71
73
  t || s == null || s(!1, a);
72
- }, G = c.useCallback(() => b(u.THUMB_UP), [b]), P = c.useCallback(() => {
74
+ }, P = c.useCallback(() => b(u.THUMB_UP), [b]), R = c.useCallback(() => {
73
75
  b(u.THUMB_DOWN), s == null || s(!0, a);
74
76
  }, [b, s, a]);
75
- return /* @__PURE__ */ J(K, {
77
+ return /* @__PURE__ */ K(Q, {
76
78
  children: [/* @__PURE__ */ f(T, {
77
79
  content: m(r.thumbsUpAriaLabel),
78
- children: /* @__PURE__ */ f(M, {
80
+ children: /* @__PURE__ */ f(p, {
79
81
  "aria-label": m(r.thumbsUpAriaLabel),
80
82
  disabled: l === u.THUMB_DOWN,
81
- icon: l === u.THUMB_UP ? E : S,
82
- onClick: G,
83
+ icon: l === u.THUMB_UP ? I : W,
84
+ onClick: P,
83
85
  size: "x-small",
84
86
  "data-target-id": "IconButton-thumbsUpAriaLabel"
85
87
  })
86
- }), /* @__PURE__ */ f($, {
87
- isOpen: y,
88
- onOpenChange: H,
89
- onSubmit: x,
88
+ }), /* @__PURE__ */ f(A, {
89
+ isOpen: w,
90
+ onOpenChange: G,
91
+ onSubmit: H,
90
92
  shouldIncludeFeedbackText: n,
91
- shouldShow: w,
93
+ shouldShow: y,
92
94
  children: /* @__PURE__ */ f(T, {
93
95
  content: m(r.thumbsDownAriaLabel),
94
- children: /* @__PURE__ */ f(M, {
96
+ children: /* @__PURE__ */ f(p, {
95
97
  "aria-label": m(r.thumbsDownAriaLabel),
96
- className: V.thumbDown,
98
+ className: X.thumbDown,
97
99
  disabled: l === u.THUMB_UP,
98
- icon: l === u.THUMB_DOWN ? I : W,
99
- onClick: P,
100
+ icon: l === u.THUMB_DOWN ? S : d,
101
+ onClick: R,
100
102
  size: "x-small",
101
103
  "data-target-id": "IconButton-thumbsDownAriaLabel"
102
104
  })
@@ -105,6 +107,6 @@ import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V
105
107
  });
106
108
  };
107
109
  export {
108
- at as ThumbButtons,
109
- at as default
110
+ mt as ThumbButtons,
111
+ mt as default
110
112
  };
@@ -1,27 +1,27 @@
1
1
  import { Record as e } from "immutable";
2
- import { R as s } from "../../../../chunks/types.js";
3
- const n = e({
2
+ import { R as s, U as n } from "../../../../chunks/types.js";
3
+ const o = e({
4
4
  has_streamed_responses: !0,
5
5
  has_citations_enabled: !1
6
- }), o = e({
6
+ }), t = e({
7
7
  type: "file",
8
8
  id: null,
9
9
  version_id: null
10
- }), t = e({
10
+ }), r = e({
11
11
  suggestions: [],
12
12
  requestState: s.NOT_STARTED
13
- }), i = e({
14
- config: new n(),
13
+ }), u = e({
14
+ config: new o(),
15
15
  encodedSession: null,
16
16
  contextSession: null,
17
17
  error: null,
18
18
  isLoading: !1,
19
19
  hasRequestInProgress: !1,
20
- item: new o(),
20
+ item: new t(),
21
21
  questions: [],
22
22
  shouldShowLandingPage: !0,
23
- suggestedQuestions: new t()
24
- }), u = e({
23
+ suggestedQuestions: new r()
24
+ }), a = e({
25
25
  answer: null,
26
26
  citations: [],
27
27
  created_at: null,
@@ -30,12 +30,13 @@ const n = e({
30
30
  isLoading: !0,
31
31
  error: null,
32
32
  prompt: null,
33
- feedbackValue: "none"
33
+ feedbackValue: "none",
34
+ promptType: n
34
35
  });
35
36
  export {
36
- n as ContentAnswersConfigRecord,
37
- o as ContentAnswersItemRecord,
38
- i as ContentAnswersRecord,
39
- u as QuestionRecord,
40
- t as SuggestedQuestionsRecord
37
+ o as ContentAnswersConfigRecord,
38
+ t as ContentAnswersItemRecord,
39
+ u as ContentAnswersRecord,
40
+ a as QuestionRecord,
41
+ r as SuggestedQuestionsRecord
41
42
  };
@@ -1,13 +1,15 @@
1
- const i = (e) => e.map((t) => ({
1
+ import { S as i } from "../../../../../chunks/types.js";
2
+ const n = (e) => e.map((t) => ({
2
3
  content: t.cited_text_content,
3
4
  location: t.cited_text_location,
4
5
  title: t.cited_doc_name,
5
6
  fileId: t.cited_doc_id
6
- })), d = (e) => e.suggestedPrompts.map((t, o) => ({
7
+ })), a = (e) => e.suggestedPrompts.map((t, o) => ({
7
8
  prompt: t,
8
- id: `suggestion-${o}`
9
+ id: `suggestion-${o}`,
10
+ type: i.INTELLIGENT
9
11
  }));
10
12
  export {
11
- i as defaultFormatCitations,
12
- d as defaultFormatSuggestions
13
+ n as defaultFormatCitations,
14
+ a as defaultFormatSuggestions
13
15
  };
@@ -1,24 +1,24 @@
1
- import * as H from "react";
2
- import { BoxAiLogo as J } from "@box/blueprint-web-assets/icons/Logo";
3
- import { Text as K } from "@box/blueprint-web";
1
+ import { Text as J } from "@box/blueprint-web";
2
+ import { BoxAiLogo as K } from "@box/blueprint-web-assets/icons/Logo";
4
3
  import { Size10 as d } from "@box/blueprint-web-assets/tokens/tokens";
5
- import { useIntl as U } from "react-intl";
6
- import V from "clsx";
7
- import { Answer as X } from "../answer/answer.js";
8
- import { Question as Y } from "../question/question.js";
9
- import { SuggestedQuestions as Z } from "../suggested-questions/suggested-questions.js";
10
- import { WelcomeMessage as $ } from "../welcome-message/welcome-message.js";
11
- import { MediaContainer as L } from "../common/media-container.js";
4
+ import U from "clsx";
5
+ import * as V from "react";
6
+ import { useIntl as X } from "react-intl";
7
+ import { Answer as Y } from "../answer/answer.js";
8
+ import { MediaContainer as Z } from "../common/media-container.js";
9
+ import { Question as $ } from "../question/question.js";
10
+ import { SuggestedQuestions as L } from "../suggested-questions/suggested-questions.js";
12
11
  import P from "../welcome-message/messages.js";
12
+ import { WelcomeMessage as S } from "../welcome-message/welcome-message.js";
13
13
  import { jsx as e, jsxs as _ } from "react/jsx-runtime";
14
- import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChatText_77vqr_1", te = "_landingPage_77vqr_7", oe = "_askQuestionText_77vqr_15", ae = "_iconAvatar_77vqr_23", re = "_sidebar_77vqr_39", a = {
15
- chat: S,
16
- clearChatText: ee,
17
- landingPage: te,
18
- askQuestionText: oe,
19
- iconAvatar: ae,
20
- sidebar: re
21
- }, Te = ({
14
+ import '../../../../styles/chat.css';const ee = "_chat_77vqr_1", te = "_clearChatText_77vqr_1", oe = "_landingPage_77vqr_7", ae = "_askQuestionText_77vqr_15", re = "_iconAvatar_77vqr_23", ie = "_sidebar_77vqr_39", a = {
15
+ chat: ee,
16
+ clearChatText: te,
17
+ landingPage: oe,
18
+ askQuestionText: ae,
19
+ iconAvatar: re,
20
+ sidebar: ie
21
+ }, be = ({
22
22
  askSuggestedQuestion: f,
23
23
  contentType: n,
24
24
  hasCustomSuggestedQuestions: h,
@@ -48,33 +48,33 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
48
48
  }) => {
49
49
  const {
50
50
  formatMessage: M
51
- } = U(), [w, z] = H.useState(null), B = (r, i) => {
51
+ } = X(), [w, z] = V.useState(null), B = (r, i) => {
52
52
  z(r ? i : null);
53
53
  };
54
54
  return /* @__PURE__ */ e("div", {
55
55
  className: a.chat,
56
56
  "data-testid": "content-answers-chat",
57
57
  children: /* @__PURE__ */ _("div", {
58
- className: V({
58
+ className: U({
59
59
  [a.landingPage]: o,
60
60
  [a.sidebar]: t === "sidebar"
61
61
  }),
62
- children: [o && /* @__PURE__ */ e(L.Figure, {
62
+ children: [o && /* @__PURE__ */ e(Z.Figure, {
63
63
  variant: t,
64
64
  children: /* @__PURE__ */ e("div", {
65
65
  className: a.iconAvatar,
66
- children: /* @__PURE__ */ e(J, {
66
+ children: /* @__PURE__ */ e(K, {
67
67
  height: d,
68
68
  role: "presentation",
69
69
  width: d
70
70
  })
71
71
  })
72
- }), /* @__PURE__ */ e($, {
72
+ }), /* @__PURE__ */ e(S, {
73
73
  contentType: "",
74
74
  shouldShowLandingPage: o,
75
75
  ...p,
76
76
  variant: t
77
- }), o && l !== void 0 && m !== void 0 && /* @__PURE__ */ e(Z, {
77
+ }), o && l !== void 0 && m !== void 0 && /* @__PURE__ */ e(L, {
78
78
  askSuggestedQuestion: f,
79
79
  hasCustomSuggestedQuestions: h,
80
80
  isLoading: x,
@@ -84,7 +84,7 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
84
84
  suggestedQuestions: l,
85
85
  suggestedQuestionsRequestState: N,
86
86
  variant: t
87
- }), /* @__PURE__ */ e(K, {
87
+ }), /* @__PURE__ */ e(J, {
88
88
  as: "p",
89
89
  className: a.clearChatText,
90
90
  children: y || M(P.welcomeClearChatText, {
@@ -99,17 +99,18 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
99
99
  isLoading: W,
100
100
  error: D,
101
101
  prompt: E,
102
- feedbackValue: G
102
+ promptType: G,
103
+ feedbackValue: H
103
104
  }) => /* @__PURE__ */ _("li", {
104
- children: [/* @__PURE__ */ e(Y, {
105
+ children: [/* @__PURE__ */ e($, {
105
106
  prompt: E,
106
107
  variant: t
107
- }), /* @__PURE__ */ e(X, {
108
+ }), /* @__PURE__ */ e(Y, {
108
109
  answer: r,
109
110
  citations: i,
110
111
  contentType: n,
111
112
  error: D,
112
- feedbackValue: G,
113
+ feedbackValue: H,
113
114
  hostAppName: j,
114
115
  isCitationsEnabled: T,
115
116
  isCompleted: R,
@@ -123,6 +124,7 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
123
124
  onCitationClick: k,
124
125
  onFeedbackFormSubmit: u,
125
126
  onFeedbackTooltipOpenChange: B,
127
+ promptType: G,
126
128
  questionId: s,
127
129
  recordAction: c,
128
130
  setAnswerFeedback: I,
@@ -136,6 +138,6 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
136
138
  });
137
139
  };
138
140
  export {
139
- Te as Chat,
140
- Te as default
141
+ be as Chat,
142
+ be as default
141
143
  };
@@ -1,119 +1,127 @@
1
- import Y from "clsx";
2
- import J from "lodash/noop";
1
+ import z from "clsx";
2
+ import V from "lodash/noop";
3
3
  import * as r from "react";
4
- import { useIntl as U } from "react-intl";
5
- import { useBreakpoint as Z, Breakpoint as $, TextArea as g, Tooltip as P, Button as Q } from "@box/blueprint-web";
6
- import { ArrowUp as q } from "@box/blueprint-web-assets/icons/Fill";
7
- import { useAgents as tt } from "@box/box-ai-agent-selector";
8
- import { FooterActions as at } from "./footer-actions.js";
9
- import { s as h, S as rt } from "../../../../chunks/stopResponseButton.js";
10
- import { getAIAgentConfig as O } from "../common/agentUtils.js";
11
- import { isDebugModeTrigger as et, isEnterTrigger as ot } from "../common/keyInputUtils.js";
12
- import { TEXT_AREA as s, INPUT_TARGET_ID as st } from "./constants.js";
4
+ import { useIntl as J } from "react-intl";
5
+ import { useBreakpoint as Z, Breakpoint as $, TextArea as q, Tooltip as Q, Button as g } from "@box/blueprint-web";
6
+ import { ArrowUp as tt } from "@box/blueprint-web-assets/icons/Fill";
7
+ import { useAgents as at } from "@box/box-ai-agent-selector";
8
+ import { FooterActions as rt } from "./footer-actions.js";
9
+ import { s as _, S as et } from "../../../../chunks/stopResponseButton.js";
10
+ import { getAIAgentConfig as R } from "../common/agentUtils.js";
11
+ import { isDebugModeTrigger as ot, isEnterTrigger as it } from "../common/keyInputUtils.js";
12
+ import { TEXT_AREA as n, INPUT_TARGET_ID as nt } from "./constants.js";
13
+ import { U as st } from "../../../../chunks/types.js";
13
14
  import m from "./messages.js";
14
- import { LOGGER_BASE_CONFIG as v, LOGGER_ACTION_CLICK as it, LOGGER_ACTION_KEYPRESS as nt } from "../common/constants.js";
15
- import { jsxs as B, jsx as u } from "react/jsx-runtime";
16
- const Mt = ({
17
- askSuggestedQuestion: k,
18
- enableDebugMode: _ = !1,
19
- hasRequestInProgress: e,
20
- isAIStudioAgentSelectorEnabled: p,
15
+ import { LOGGER_BASE_CONFIG as A, LOGGER_ACTION_CLICK as lt, LOGGER_ACTION_KEYPRESS as mt } from "../common/constants.js";
16
+ import { jsxs as v, jsx as u } from "react/jsx-runtime";
17
+ const Nt = ({
18
+ askSuggestedQuestion: c,
19
+ enableDebugMode: M = !1,
20
+ hasRequestInProgress: o,
21
+ isAIStudioAgentSelectorEnabled: C,
21
22
  isDebugModeShown: b,
22
- isStopResponseEnabled: R,
23
+ isStopResponseEnabled: B,
23
24
  isStreamingEnabled: w,
24
- lastQuestion: d,
25
- onRetryQuestion: L,
25
+ lastQuestion: E,
26
+ onRetryQuestion: k,
26
27
  onStopQuestion: X,
27
- onUserInteraction: E = J,
28
- recordAction: o,
29
- sendQuestion: M,
28
+ onUserInteraction: d = V,
29
+ recordAction: i,
30
+ sendQuestion: L,
30
31
  setAskSuggestedQuestion: x,
31
- toggleDebugMode: i,
32
- variant: S = "modal"
32
+ toggleDebugMode: s,
33
+ variant: y = "modal"
33
34
  }) => {
34
- const G = S === "sidebar", n = U(), H = Z(), a = r.useRef(null), y = H <= $.Medium && !G ? s.MAX_ROWS_MOBILE : s.MAX_ROWS, [c, N] = r.useState(!0), [K, A] = r.useState(!1), {
35
- selectedAgent: C
36
- } = tt(), {
37
- answer: F,
38
- isCompleted: I
39
- } = d ?? {}, j = w && I === !1 && (R || F), T = r.useCallback(() => {
35
+ const G = y === "sidebar", l = J(), H = Z(), a = r.useRef(null), I = H <= $.Medium && !G ? n.MAX_ROWS_MOBILE : n.MAX_ROWS, [f, N] = r.useState(!0), [K, O] = r.useState(!1), {
36
+ selectedAgent: T
37
+ } = at(), {
38
+ answer: S,
39
+ isCompleted: F
40
+ } = E ?? {}, U = w && F === !1 && (B || S), h = r.useCallback(() => {
40
41
  a.current && a.current.focus();
41
- }, [a]), D = r.useCallback(() => {
42
- var l;
43
- E();
44
- let t = ((l = a.current) == null ? void 0 : l.value) ?? "";
45
- a.current && t.length > s.MAX_LENGTH && (a.current.value = t.slice(0, s.MAX_LENGTH), t = a.current.value), A(t.length >= s.MAX_LENGTH), N(t.trim().length === 0);
46
- }, [a, E]), f = r.useCallback(() => {
47
- if (T(), !e && a.current) {
48
- const t = {
49
- prompt: a.current.value
42
+ }, [a]), j = r.useCallback(() => {
43
+ var e;
44
+ d();
45
+ let t = ((e = a.current) == null ? void 0 : e.value) ?? "";
46
+ a.current && t.length > n.MAX_LENGTH && (a.current.value = t.slice(0, n.MAX_LENGTH), t = a.current.value), O(t.length >= n.MAX_LENGTH), N(t.trim().length === 0);
47
+ }, [a, d]), p = r.useCallback((t = st) => {
48
+ if (h(), !o && a.current) {
49
+ const e = {
50
+ prompt: a.current.value,
51
+ promptType: t
50
52
  };
51
- if (t.prompt && t.prompt.trim()) {
52
- const l = O(p, C);
53
- M(t, l), a.current.value = "", N(!0), A(!1);
53
+ if (e.prompt && e.prompt.trim()) {
54
+ const Y = R(C, T);
55
+ L(e, Y), a.current.value = "", N(!0), O(!1);
54
56
  }
55
- b && i && i();
57
+ b && s && s();
56
58
  }
57
- }, [C, T, e, a, p, b, M, i]), W = r.useCallback((t) => {
58
- t.preventDefault(), !e && !c && o && o({
59
- ...v,
60
- action: it,
59
+ }, [T, h, o, a, C, b, L, s]), D = r.useCallback((t) => {
60
+ t.preventDefault(), !o && !f && i && i({
61
+ ...A,
62
+ action: lt,
61
63
  target: "ask"
62
- }), f();
63
- }, [e, c, o, f]), z = r.useCallback((t) => {
64
- _ && i && et(t) && i(), ot(t) && (t.preventDefault(), !e && !c && o && o({
65
- ...v,
66
- action: nt,
64
+ }), p();
65
+ }, [o, f, i, p]), P = r.useCallback((t) => {
66
+ M && s && ot(t) && s(), it(t) && (t.preventDefault(), !o && !f && i && i({
67
+ ...A,
68
+ action: mt,
67
69
  target: "ask"
68
- }), f());
69
- }, [_, e, c, o, f, i]), V = r.useCallback((t) => {
70
- const l = O(p, C);
71
- L(t, l);
72
- }, [C, p, L]);
70
+ }), p());
71
+ }, [M, o, f, i, p, s]), W = r.useCallback((t) => {
72
+ const e = R(C, T);
73
+ k(t, e);
74
+ }, [T, C, k]);
73
75
  return r.useEffect(() => {
74
- queueMicrotask(T);
76
+ queueMicrotask(h);
75
77
  }, []), r.useEffect(() => {
76
- k && a.current && !e && x && (a.current.value = k, f(), x(null));
77
- }, [k]), /* @__PURE__ */ B("div", {
78
- children: [d && /* @__PURE__ */ u(at, {
79
- lastQuestion: d,
80
- onRetryButtonInteraction: E,
81
- onRetryQuestion: V,
82
- recordAction: o
83
- }), /* @__PURE__ */ B("div", {
84
- className: Y(h.questionInput, G && h.sidebar),
85
- children: [/* @__PURE__ */ u(g, {
78
+ if (c && a.current && !o && x) {
79
+ const {
80
+ prompt: t,
81
+ type: e
82
+ } = c;
83
+ a.current.value = t, p(e), x(null);
84
+ }
85
+ }, [c == null ? void 0 : c.id]), /* @__PURE__ */ v("div", {
86
+ children: [E && /* @__PURE__ */ u(rt, {
87
+ lastQuestion: E,
88
+ onRetryButtonInteraction: d,
89
+ onRetryQuestion: W,
90
+ recordAction: i
91
+ }), /* @__PURE__ */ v("div", {
92
+ className: z(_.questionInput, G && _.sidebar),
93
+ children: [/* @__PURE__ */ u(q, {
86
94
  ref: a,
87
- className: h.textArea,
88
- "data-target-id": st,
95
+ className: _.textArea,
96
+ "data-target-id": nt,
89
97
  "data-testid": "content-answers-question-input",
90
- error: K && n.formatMessage(m.maxCharactersReachedError, {
91
- characterLimit: s.MAX_LENGTH
98
+ error: K && l.formatMessage(m.maxCharactersReachedError, {
99
+ characterLimit: n.MAX_LENGTH
92
100
  }),
93
101
  hideLabel: !0,
94
- label: n.formatMessage(m.askQuestionPlaceholder),
95
- maxLength: s.MAX_LENGTH,
96
- maxRows: y,
97
- onChange: D,
98
- onKeyDown: z,
99
- placeholder: n.formatMessage(m.askQuestionPlaceholder)
100
- }), j ? /* @__PURE__ */ u(rt, {
101
- lastQuestion: d,
102
+ label: l.formatMessage(m.askQuestionPlaceholder),
103
+ maxLength: n.MAX_LENGTH,
104
+ maxRows: I,
105
+ onChange: j,
106
+ onKeyDown: P,
107
+ placeholder: l.formatMessage(m.askQuestionPlaceholder)
108
+ }), U ? /* @__PURE__ */ u(et, {
109
+ lastQuestion: E,
102
110
  onStopQuestion: X,
103
- recordAction: o
104
- }) : /* @__PURE__ */ u(P, {
105
- content: n.formatMessage(m.ask),
111
+ recordAction: i
112
+ }) : /* @__PURE__ */ u(Q, {
113
+ content: l.formatMessage(m.ask),
106
114
  "data-testid": "ask-tooltip",
107
115
  variant: "standard",
108
- children: /* @__PURE__ */ u(Q, {
109
- "aria-label": n.formatMessage(m.ask),
110
- className: h.inputAreaButton,
116
+ children: /* @__PURE__ */ u(g, {
117
+ "aria-label": l.formatMessage(m.ask),
118
+ className: _.inputAreaButton,
111
119
  "data-testid": "content-answers-submit-button",
112
- disabled: c || e,
113
- icon: q,
120
+ disabled: f || o,
121
+ icon: tt,
114
122
  loading: !1,
115
- loadingAriaLabel: n.formatMessage(m.askDisabledTooltip),
116
- onClick: W,
123
+ loadingAriaLabel: l.formatMessage(m.askDisabledTooltip),
124
+ onClick: D,
117
125
  size: "large",
118
126
  "data-target-id": "Button-ask"
119
127
  })
@@ -122,5 +130,5 @@ const Mt = ({
122
130
  });
123
131
  };
124
132
  export {
125
- Mt as Footer
133
+ Nt as Footer
126
134
  };
@@ -1,74 +1,79 @@
1
- import { Text as E, LoadingIndicator as R } from "@box/blueprint-web";
2
- import { AlertTriangle as N } from "@box/blueprint-web-assets/icons/Line";
3
- import { Gray65 as O, Size4 as p } from "@box/blueprint-web-assets/tokens/tokens";
4
- import _ from "clsx";
5
- import * as x from "react";
6
- import { useIntl as C } from "react-intl";
7
- import { Suggestions as G } from "./suggestions.js";
1
+ import { Text as N, LoadingIndicator as O } from "@box/blueprint-web";
2
+ import { AlertTriangle as x } from "@box/blueprint-web-assets/icons/Line";
3
+ import { Gray65 as C, Size4 as _ } from "@box/blueprint-web-assets/tokens/tokens";
4
+ import f from "clsx";
5
+ import * as G from "react";
6
+ import { useIntl as w } from "react-intl";
7
+ import { Suggestions as T } from "./suggestions.js";
8
8
  import { R as a } from "../../../../chunks/types.js";
9
- import { LOGGER_BASE_CONFIG as w } from "../common/constants.js";
10
- import d from "./messages.js";
11
- import { jsxs as T, jsx as i } from "react/jsx-runtime";
12
- import '../../../../styles/suggested-questions.css';const y = "_wrapper_1peth_1", L = "_label_1peth_1", P = "_sidebar_1peth_6", U = "_loadingIndicator_1peth_10", j = "_alertIcon_1peth_18", r = {
13
- wrapper: y,
14
- label: L,
15
- sidebar: P,
16
- loadingIndicator: U,
17
- alertIcon: j
18
- }, V = ({
19
- askSuggestedQuestion: f,
20
- hasCustomSuggestedQuestions: s,
21
- isLoading: g,
22
- onSuggestedQuestionInteraction: S,
9
+ import { LOGGER_BASE_CONFIG as y } from "../common/constants.js";
10
+ import l from "./messages.js";
11
+ import { jsxs as L, jsx as i } from "react/jsx-runtime";
12
+ import '../../../../styles/suggested-questions.css';const P = "_wrapper_1peth_1", U = "_label_1peth_1", j = "_sidebar_1peth_6", v = "_loadingIndicator_1peth_10", F = "_alertIcon_1peth_18", r = {
13
+ wrapper: P,
14
+ label: U,
15
+ sidebar: j,
16
+ loadingIndicator: v,
17
+ alertIcon: F
18
+ }, W = ({
19
+ askSuggestedQuestion: g,
20
+ hasCustomSuggestedQuestions: d,
21
+ isLoading: S,
22
+ onSuggestedQuestionInteraction: I,
23
23
  recordAction: n,
24
- setAskSuggestedQuestion: l,
25
- suggestedQuestions: I,
24
+ setAskSuggestedQuestion: e,
25
+ suggestedQuestions: b,
26
26
  suggestedQuestionsRequestState: o = a.SUCCESS,
27
- variant: c = "modal"
27
+ variant: s = "modal"
28
28
  }) => {
29
- const m = c === "sidebar", {
30
- formatMessage: e
31
- } = C(), b = x.useCallback((t) => {
32
- l && (l(t), n && t && n({
33
- ...w,
29
+ const c = s === "sidebar", {
30
+ formatMessage: t
31
+ } = w(), h = G.useCallback((m) => {
32
+ const {
33
+ prompt: p,
34
+ type: R
35
+ } = m;
36
+ e && (e(m), n && p && n({
37
+ ...y,
34
38
  target: "suggested_questions",
35
39
  data: {
36
- selectedQuestion: s ? "dynamic" : t
40
+ selectedQuestion: d ? "dynamic" : p,
41
+ type: R
37
42
  }
38
43
  }));
39
- }, [l, n, s]), h = () => o === a.IN_PROGRESS ? e(d.loadingSuggestedQuestions) : e(d.loadingSuggestedQuestionsFailed);
40
- return /* @__PURE__ */ T("div", {
41
- className: _(r.wrapper, m && r.sidebar),
42
- children: [(o === a.IN_PROGRESS || o === a.ERROR) && /* @__PURE__ */ i(E, {
44
+ }, [e, n, d]), E = () => o === a.IN_PROGRESS ? t(l.loadingSuggestedQuestions) : t(l.loadingSuggestedQuestionsFailed);
45
+ return /* @__PURE__ */ L("div", {
46
+ className: f(r.wrapper, c && r.sidebar),
47
+ children: [(o === a.IN_PROGRESS || o === a.ERROR) && /* @__PURE__ */ i(N, {
43
48
  as: "p",
44
- className: _(r.label, m && r.sidebar),
49
+ className: f(r.label, c && r.sidebar),
45
50
  color: "textOnLightSecondary",
46
- children: h()
47
- }), o === a.SUCCESS && /* @__PURE__ */ i(G, {
48
- askSuggestedQuestion: f,
49
- isLoading: g,
50
- onSuggestedQuestionClick: b,
51
- onSuggestedQuestionInteraction: S,
52
- suggestedQuestions: I,
53
- variant: c
51
+ children: E()
52
+ }), o === a.SUCCESS && /* @__PURE__ */ i(T, {
53
+ askSuggestedQuestion: g,
54
+ isLoading: S,
55
+ onSuggestedQuestionClick: h,
56
+ onSuggestedQuestionInteraction: I,
57
+ suggestedQuestions: b,
58
+ variant: s
54
59
  }), o === a.IN_PROGRESS && /* @__PURE__ */ i("div", {
55
60
  className: r.loadingIndicator,
56
- children: /* @__PURE__ */ i(R, {
57
- "aria-label": e(d.loadingSuggestedQuestions),
61
+ children: /* @__PURE__ */ i(O, {
62
+ "aria-label": t(l.loadingSuggestedQuestions),
58
63
  className: r.loadingIndicator,
59
64
  variant: "dark"
60
65
  })
61
- }), o === a.ERROR && /* @__PURE__ */ i(N, {
66
+ }), o === a.ERROR && /* @__PURE__ */ i(x, {
62
67
  className: r.alertIcon,
63
- color: O,
68
+ color: C,
64
69
  "data-testid": "content-answers-suggested-questions-failed-alert-icon",
65
- height: p,
70
+ height: _,
66
71
  role: "presentation",
67
- width: p
72
+ width: _
68
73
  })]
69
74
  });
70
75
  };
71
76
  export {
72
- V as SuggestedQuestions,
73
- V as default
77
+ W as SuggestedQuestions,
78
+ W as default
74
79
  };
@@ -1,46 +1,46 @@
1
- import { FilterChip as o } from "@box/blueprint-web";
2
- import u from "clsx";
3
- import c from "lodash/noop";
1
+ import { FilterChip as r } from "@box/blueprint-web";
2
+ import d from "clsx";
3
+ import u from "lodash/noop";
4
4
  import { jsx as t } from "react/jsx-runtime";
5
- import '../../../../styles/suggestions.css';const m = "_suggestions_1d1b9_1", w = "_suggestion_1d1b9_1", e = {
6
- suggestions: m,
7
- suggestion: w
8
- }, _ = ({
9
- askSuggestedQuestion: i,
10
- isLoading: g,
5
+ import '../../../../styles/suggestions.css';const w = "_suggestions_1d1b9_1", y = "_suggestion_1d1b9_1", n = {
6
+ suggestions: w,
7
+ suggestion: y
8
+ }, A = ({
9
+ askSuggestedQuestion: s,
10
+ isLoading: p,
11
11
  onSuggestedQuestionClick: a,
12
- onSuggestedQuestionInteraction: r = c,
12
+ onSuggestedQuestionInteraction: e = u,
13
13
  suggestedQuestions: l,
14
- variant: p = "modal"
14
+ variant: g = "modal"
15
15
  }) => {
16
- const d = (s) => {
17
- (s.key === "ArrowUp" || s.key === "ArrowDown" || s.key === "ArrowLeft" || s.key === "ArrowRight") && s.stopPropagation();
16
+ const c = s == null ? void 0 : s.prompt, m = (o) => {
17
+ (o.key === "ArrowUp" || o.key === "ArrowDown" || o.key === "ArrowLeft" || o.key === "ArrowRight") && o.stopPropagation();
18
18
  };
19
- return /* @__PURE__ */ t(o.Group, {
20
- className: u(e.suggestions, p === "sidebar" && e.sidebar),
19
+ return /* @__PURE__ */ t(r.Group, {
20
+ className: d(n.suggestions, g === "sidebar" && n.sidebar),
21
21
  "data-testid": "content-answers-suggested-questions",
22
22
  name: "Singleselect SuggestedQuestions",
23
- onKeyDown: d,
23
+ onKeyDown: m,
24
24
  type: "single",
25
- value: i,
26
- children: l.map((s) => {
27
- const n = s.label || s.prompt;
28
- return /* @__PURE__ */ t(o.ChipButton, {
29
- className: e.suggestion,
30
- "data-testid": `content-answers-${s.id}`,
31
- disabled: g,
32
- onClick: () => a(s.prompt),
33
- onFocus: r,
34
- onMouseEnter: r,
35
- value: n,
36
- children: /* @__PURE__ */ t(o.Label, {
37
- children: n
25
+ value: c,
26
+ children: l.map((o) => {
27
+ const i = o.label || o.prompt;
28
+ return /* @__PURE__ */ t(r.ChipButton, {
29
+ className: n.suggestion,
30
+ "data-testid": `content-answers-${o.id}`,
31
+ disabled: p,
32
+ onClick: () => a(o),
33
+ onFocus: e,
34
+ onMouseEnter: e,
35
+ value: i,
36
+ children: /* @__PURE__ */ t(r.Label, {
37
+ children: i
38
38
  })
39
- }, s.id);
39
+ }, o.id);
40
40
  })
41
41
  });
42
42
  };
43
43
  export {
44
- _ as Suggestions,
45
- _ as default
44
+ A as Suggestions,
45
+ A as default
46
46
  };
@@ -1,4 +1,4 @@
1
- import { ANSWER_ERROR, CitationType, FeedbackFormData, FeedbackValue, ItemClickHandler, ItemType, RecordActionType, StyleVariant } from '../../types';
1
+ import { ANSWER_ERROR, CitationType, FeedbackFormData, FeedbackValue, ItemClickHandler, ItemType, PromptType, RecordActionType, StyleVariant } from '../../types';
2
2
  import * as React from 'react';
3
3
  export interface AnswerProps {
4
4
  answer?: string;
@@ -28,6 +28,7 @@ export interface AnswerProps {
28
28
  isMarkdownEnabled?: boolean;
29
29
  /** Items for each we will show the ka */
30
30
  items?: Array<ItemType>;
31
+ promptType?: PromptType;
31
32
  /** Callback function when the user clicks on the answer copy button */
32
33
  onAnswerCopy?: (answer: string) => void;
33
34
  /** Callback function when citation button is clicked */
@@ -1,4 +1,4 @@
1
- import { FeedbackFormData, FeedbackValue, ItemType, RecordActionType, StyleVariant } from '../../types';
1
+ import { FeedbackFormData, FeedbackValue, ItemType, PromptType, RecordActionType, StyleVariant } from '../../types';
2
2
  export type ThumbButtonsProps = {
3
3
  feedbackValue?: FeedbackValue;
4
4
  hostAppName: string;
@@ -6,6 +6,7 @@ export type ThumbButtonsProps = {
6
6
  isFeedbackTooltipOpen?: boolean;
7
7
  items: ItemType[];
8
8
  onFeedbackTooltipOpenChange?: (isOpen: boolean, questionId: string) => void;
9
+ promptType?: PromptType;
9
10
  questionId: string;
10
11
  onFeedbackFormSubmit?: (data: FeedbackFormData, onSuccess: () => void) => void;
11
12
  recordAction?: (params: RecordActionType) => void;
@@ -13,5 +14,5 @@ export type ThumbButtonsProps = {
13
14
  shouldFeedbackFormIncludeFeedbackText?: boolean;
14
15
  variant: StyleVariant;
15
16
  };
16
- export declare const ThumbButtons: ({ feedbackValue, hostAppName, isFeedbackFormEnabled, isFeedbackTooltipOpen, items, onFeedbackFormSubmit, onFeedbackTooltipOpenChange, questionId, recordAction, setAnswerFeedback, shouldFeedbackFormIncludeFeedbackText, variant, }: ThumbButtonsProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const ThumbButtons: ({ feedbackValue, hostAppName, isFeedbackFormEnabled, isFeedbackTooltipOpen, items, onFeedbackFormSubmit, onFeedbackTooltipOpenChange, promptType, questionId, recordAction, setAnswerFeedback, shouldFeedbackFormIncludeFeedbackText, variant, }: ThumbButtonsProps) => import("react/jsx-runtime").JSX.Element;
17
18
  export default ThumbButtons;
@@ -1,7 +1,7 @@
1
- import { QuestionType, RetryQuestion, StopQuestion, StyleVariant, SubmitQuestion } from '../../types';
1
+ import { SuggestedQuestionType, QuestionType, RetryQuestion, StopQuestion, StyleVariant, SubmitQuestion } from '../../types';
2
2
  export interface FooterProps {
3
3
  /** Selected suggested question */
4
- askSuggestedQuestion: string | undefined;
4
+ askSuggestedQuestion: SuggestedQuestionType | undefined;
5
5
  /** Whether to allow CTRL+SHIFT+X feature or not */
6
6
  enableDebugMode?: boolean;
7
7
  /** Whether to indicate if there is a request in progress like an answer being fetched or streamed */
@@ -27,7 +27,7 @@ export interface FooterProps {
27
27
  /** Callback when the user clicks on ask question or a suggested question */
28
28
  sendQuestion: SubmitQuestion;
29
29
  /** Callback function to handle selection of suggested question */
30
- setAskSuggestedQuestion: ((value: string | null) => void) | undefined;
30
+ setAskSuggestedQuestion: ((value: SuggestedQuestionType | null) => void) | undefined;
31
31
  /** Callback function to toggle the CTRL+SHIFT+X feature */
32
32
  toggleDebugMode?: () => void;
33
33
  variant?: StyleVariant;
@@ -1,7 +1,7 @@
1
1
  import { REQUEST_STATE, StyleVariant, SuggestedQuestionType } from '../../types';
2
2
  export type SuggestedQuestionsProps = {
3
3
  /** Selected suggested question. DEPRECATE - Not longer needed */
4
- askSuggestedQuestion: string | undefined;
4
+ askSuggestedQuestion: SuggestedQuestionType | undefined;
5
5
  /** Flag to indicate if the host application has custom suggested questions */
6
6
  hasCustomSuggestedQuestions?: boolean;
7
7
  /** Whether to indicate if there is a request in progress like an answer being fetched or streamed so we can disable the buttons */
@@ -11,7 +11,7 @@ export type SuggestedQuestionsProps = {
11
11
  /** Callback function to handle logging events */
12
12
  recordAction?: (payload: Record<string, unknown>) => void;
13
13
  /** Callback function to handle selection of suggested question */
14
- setAskSuggestedQuestion: (value: string | null) => void;
14
+ setAskSuggestedQuestion: (value: SuggestedQuestionType | null) => void;
15
15
  /** Suggested Questions list */
16
16
  suggestedQuestions: SuggestedQuestionType[];
17
17
  /** Object to indicate if there is a request in progress to fetch suggested questions and handle their state */
@@ -1,11 +1,11 @@
1
1
  import { StyleVariant, SuggestedQuestionType } from '../../types';
2
2
  export type SuggestionsProps = {
3
3
  /** Selected suggested question. DEPRECATE - Not longer needed */
4
- askSuggestedQuestion: string | undefined;
4
+ askSuggestedQuestion: SuggestedQuestionType | undefined;
5
5
  /** Whether to indicate if there is a request in progress like an answer being fetched or streamed so we can disable the buttons */
6
6
  isLoading?: boolean;
7
7
  /** Callback function to handle selection of suggested question */
8
- onSuggestedQuestionClick: (value: string | null) => void;
8
+ onSuggestedQuestionClick: (value: SuggestedQuestionType | null) => void;
9
9
  /** Callback when the user interacts with suggested question */
10
10
  onSuggestedQuestionInteraction?: () => void;
11
11
  /** Suggested Questions list */
@@ -22,6 +22,13 @@ export declare enum REQUEST_STATE {
22
22
  ERROR = "error",
23
23
  CANCELLED = "cancelled"
24
24
  }
25
+ export declare enum SUGGESTED_QUESTION_PROMPT_TYPE {
26
+ CUSTOM = "suggested_question_custom",
27
+ INTELLIGENT = "suggested_question_intelligent",
28
+ STATIC = "suggested_question_static"
29
+ }
30
+ export declare const USER_INPUT_PROMPT_TYPE = "user_input";
31
+ export type PromptType = SUGGESTED_QUESTION_PROMPT_TYPE | typeof USER_INPUT_PROMPT_TYPE;
25
32
  export type StyleVariant = 'modal' | 'sidebar';
26
33
  export type RetryQuestion = (question: QuestionType, aiAgent?: unknown | undefined) => void;
27
34
  export type SendErrorLog = ({ eventType, message, origin, sendTrace }: EventLogOptions) => void;
@@ -101,9 +108,9 @@ export type ChatProps = WelcomeMessageProps & {
101
108
  /** Suggested Questions Request state */
102
109
  suggestedQuestionsRequestState?: REQUEST_STATE;
103
110
  /** Selected suggested question */
104
- askSuggestedQuestion: string | undefined;
111
+ askSuggestedQuestion: SuggestedQuestionType | undefined;
105
112
  /** Callback function to handle selection of suggested question */
106
- setAskSuggestedQuestion: ((value: string | null) => void) | undefined;
113
+ setAskSuggestedQuestion: ((value: SuggestedQuestionType | null) => void) | undefined;
107
114
  /** Callback function to handle answer thumb feedback click */
108
115
  setAnswerFeedback: ((questionId: string, feedbackValue: FeedbackValue) => void) | undefined;
109
116
  /** Whether to indicate if there is a request in progress like an answer being fetched or streamed */
@@ -166,6 +173,7 @@ export type RecordActionType = {
166
173
  file_types: string[];
167
174
  has_feedback: boolean;
168
175
  issue_type: FeedbackIssueType | '';
176
+ prompt_type?: string;
169
177
  question_id: string;
170
178
  };
171
179
  component: string;
@@ -193,6 +201,7 @@ export type QuestionType = {
193
201
  created_at?: string;
194
202
  type?: 'question';
195
203
  feedbackValue?: FeedbackValue;
204
+ promptType?: PromptType;
196
205
  };
197
206
  export type ItemType = {
198
207
  id: string;
@@ -214,6 +223,7 @@ export type SuggestedQuestionType = {
214
223
  label?: string;
215
224
  prompt: string;
216
225
  id: string;
226
+ type?: SUGGESTED_QUESTION_PROMPT_TYPE;
217
227
  };
218
228
  export type CitationResponseRecordType = string | number;
219
229
  export type CitationResponse = Record<string, CitationResponseRecordType>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.129.11",
3
+ "version": "0.130.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.35.0",