@box/box-ai-content-answers 0.64.2 → 0.65.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,43 +1,44 @@
1
1
  import "../../styles/box-ai-content-answers.css";
2
- import k from "clsx";
2
+ import C from "clsx";
3
3
  import * as s from "react";
4
- import { AgentEditor as C } from "./components/agents/agent-editor.js";
5
- import { Content as F } from "./components/content/content.js";
6
- import { Footer as N } from "./components/footer/footer.js";
7
- import { jsx as n, jsxs as y } from "react/jsx-runtime";
8
- const B = "_container_hi5vt_1", R = "_contentAnswers_hi5vt_5", w = {
9
- container: B,
10
- contentAnswers: R
11
- }, U = ({
4
+ import { AgentEditor as F } from "./components/agents/agent-editor.js";
5
+ import { Content as N } from "./components/content/content.js";
6
+ import { Footer as y } from "./components/footer/footer.js";
7
+ import { jsx as n, jsxs as B } from "react/jsx-runtime";
8
+ const R = "_container_hi5vt_1", z = "_contentAnswers_hi5vt_5", w = {
9
+ container: R,
10
+ contentAnswers: z
11
+ }, V = ({
12
12
  className: S,
13
13
  contentType: u,
14
14
  error: t,
15
15
  hasRequestInProgress: c,
16
16
  isAgentSelectorEnabled: h,
17
- isDebugModeEnabled: A,
18
- isStopResponseEnabled: M,
17
+ isAIStudioAgentSelectorEnabled: A,
18
+ isDebugModeEnabled: M,
19
+ isStopResponseEnabled: Q,
19
20
  isStreamingEnabled: o,
20
21
  userInfo: l,
21
22
  questions: i,
22
23
  recordAction: r,
23
- retryQuestion: Q,
24
+ retryQuestion: _,
24
25
  showLoadingIndicator: a,
25
- stopQuestion: _,
26
- submitQuestion: x,
27
- suggestedQuestions: b,
28
- useAnimation: v,
29
- onAgentEditorToggle: D,
30
- ...E
26
+ stopQuestion: x,
27
+ submitQuestion: b,
28
+ suggestedQuestions: v,
29
+ useAnimation: D,
30
+ onAgentEditorToggle: E,
31
+ ...j
31
32
  }) => {
32
- const [m, g] = s.useState(null), [f, d] = s.useState(t != null), [e, p] = s.useState(!1), j = !f && !a;
33
+ const [m, g] = s.useState(null), [f, d] = s.useState(t != null), [e, p] = s.useState(!1), k = !f && !a;
33
34
  return s.useEffect(() => {
34
35
  d(t != null);
35
36
  }, [t]), /* @__PURE__ */ n("div", {
36
- className: k(S, w.container),
37
- children: /* @__PURE__ */ y("div", {
37
+ className: C(S, w.container),
38
+ children: /* @__PURE__ */ B("div", {
38
39
  className: w.contentAnswers,
39
- children: [!e && /* @__PURE__ */ n(F, {
40
- ...E,
40
+ children: [!e && /* @__PURE__ */ n(N, {
41
+ ...j,
41
42
  askSuggestedQuestion: m,
42
43
  contentType: u,
43
44
  error: t,
@@ -49,27 +50,28 @@ const B = "_container_hi5vt_1", R = "_contentAnswers_hi5vt_5", w = {
49
50
  setAskSuggestedQuestion: g,
50
51
  setIsErrorMessageShown: d,
51
52
  showLoadingIndicator: a,
52
- suggestedQuestions: b,
53
- useAnimation: o && v,
53
+ suggestedQuestions: v,
54
+ useAnimation: o && D,
54
55
  userInfo: l
55
- }), e && /* @__PURE__ */ n(C, {
56
- onAgentEditorToggle: D,
56
+ }), e && /* @__PURE__ */ n(F, {
57
+ onAgentEditorToggle: E,
57
58
  recordAction: r,
58
59
  setIsDebugModeShown: p
59
- }), j && /* @__PURE__ */ n(N, {
60
+ }), k && /* @__PURE__ */ n(y, {
60
61
  askSuggestedQuestion: m,
61
62
  contentType: u,
62
- enableDebugMode: A,
63
+ enableDebugMode: M,
63
64
  hasRequestInProgress: c,
64
65
  isAgentSelectorEnabled: h,
66
+ isAIStudioAgentSelectorEnabled: A,
65
67
  isDebugModeShown: e,
66
- isStopResponseEnabled: M,
68
+ isStopResponseEnabled: Q,
67
69
  isStreamingEnabled: o,
68
70
  lastQuestion: i[i.length - 1],
69
- onRetryQuestion: Q,
70
- onStopQuestion: _,
71
+ onRetryQuestion: _,
72
+ onStopQuestion: x,
71
73
  recordAction: r,
72
- sendQuestion: x,
74
+ sendQuestion: b,
73
75
  setAskSuggestedQuestion: g,
74
76
  toggleDebugMode: () => {
75
77
  p(!e);
@@ -80,6 +82,6 @@ const B = "_container_hi5vt_1", R = "_contentAnswers_hi5vt_5", w = {
80
82
  });
81
83
  };
82
84
  export {
83
- U as BoxAiContentAnswers,
84
- U as default
85
+ V as BoxAiContentAnswers,
86
+ V as default
85
87
  };
@@ -1,4 +1,4 @@
1
- const o = (e) => ({
1
+ const i = (e) => ({
2
2
  ask: {
3
3
  type: "ai_agent_ask",
4
4
  longText: {
@@ -15,15 +15,17 @@ const o = (e) => ({
15
15
  }
16
16
  }
17
17
  }), t = (e, _ = null, n = !1) => ({
18
+ id: _,
18
19
  name: e,
19
- config: _ ? o(_) : null,
20
+ config: _ ? i(_) : null,
20
21
  isDefault: n,
22
+ isEnterpriseDefault: n,
21
23
  isSelected: n
22
- }), a = [t("Box (default)", null, !0), t("Box (gpt-3.5-turbo)", "azure__openai__gpt_3_5_turbo_16k"), t("Box (gpt-4o)", "openai__gpt_4o_2024_05_13"), t("Box (gemini 1.5 flash", "google__gemini_1_5_flash_001"), t("Box (gemini 1.5 pro)", "google__gemini_1_5_pro_001"), t("Box (claude 3 sonnet)", "aws__claude_3_sonnet"), t("Box (claude 3.5 sonnet)", "aws__claude_3_5_sonnet"), t("Box (claude 3 haiku)", "aws__claude_3_haiku"), t("Box (titan text lite)", "aws__titan_text_lite"), t("Box (titan text express)", "aws__titan_text_express")], i = {
24
+ }), a = [t("Box (default)", null, !0), t("Box (gpt-3.5-turbo)", "azure__openai__gpt_3_5_turbo_16k"), t("Box (gpt-4o)", "openai__gpt_4o_2024_05_13"), t("Box (gemini 1.5 flash", "google__gemini_1_5_flash_001"), t("Box (gemini 1.5 pro)", "google__gemini_1_5_pro_001"), t("Box (claude 3 sonnet)", "aws__claude_3_sonnet"), t("Box (claude 3.5 sonnet)", "aws__claude_3_5_sonnet"), t("Box (claude 3 haiku)", "aws__claude_3_haiku"), t("Box (titan text lite)", "aws__titan_text_lite"), t("Box (titan text express)", "aws__titan_text_express")], o = {
23
25
  agents: a,
24
26
  selectedAgent: a.find((e) => e.isSelected)
25
27
  };
26
28
  export {
27
29
  a as agentList,
28
- i as agentState
30
+ o as agentState
29
31
  };
@@ -1,104 +1,109 @@
1
- import { useReducer as F, useEffect as G } from "react";
2
- import { R as d } from "../../../../chunks/types.js";
3
- import { useContentAnswers as H } from "./hooks/useContentAnswers.js";
4
- import { ContentAnswersRecord as I, ContentAnswersItemRecord as J } from "./records.js";
5
- import K from "./reducer.js";
6
- import { jsx as M } from "react/jsx-runtime";
7
- const te = ({
8
- WrappedComponent: a,
1
+ import { useReducer as I, useEffect as J } from "react";
2
+ import { R as a } from "../../../../chunks/types.js";
3
+ import { useContentAnswers as K } from "./hooks/useContentAnswers.js";
4
+ import { ContentAnswersRecord as M, ContentAnswersItemRecord as V } from "./records.js";
5
+ import W from "./reducer.js";
6
+ import { jsx as X } from "react/jsx-runtime";
7
+ const ne = ({
8
+ WrappedComponent: d,
9
9
  createSessionRequest: f,
10
10
  getAgentConfig: m,
11
- fetchTimeout: g,
12
- formatCitations: S,
13
- getAnswer: A,
14
- getAnswerStreaming: p,
11
+ getAIStudioAgents: g,
12
+ fetchTimeout: S,
13
+ formatCitations: A,
14
+ getAnswer: p,
15
+ getAnswerStreaming: C,
15
16
  getSuggestedQuestions: t,
16
17
  hostAppName: R,
17
- isAgentSelectorEnabled: C,
18
+ isAgentSelectorEnabled: w,
19
+ isAIStudioAgentSelectorEnabled: l,
18
20
  isCitationsEnabled: n,
19
- isDebugModeEnabled: l,
20
- isMarkdownEnabled: w,
21
+ isDebugModeEnabled: Q,
22
+ isMarkdownEnabled: T,
21
23
  isOpen: s,
22
- isResetChatEnabled: Q,
23
- isStopResponseEnabled: T,
24
+ isResetChatEnabled: q,
25
+ isStopResponseEnabled: E,
24
26
  isStreamingEnabled: r,
25
27
  itemID: o,
26
28
  onCloseModal: h,
27
- suggestedQuestions: q,
28
- warningNotice: E,
29
- warningNoticeAriaLabel: j
29
+ shouldRenderProviders: j = !1,
30
+ suggestedQuestions: U,
31
+ warningNotice: _,
32
+ warningNoticeAriaLabel: v
30
33
  }) => {
31
- const [c, v] = F(K, new I({
32
- item: new J({
34
+ const [c, x] = I(W, new M({
35
+ item: new V({
33
36
  id: o
34
37
  })
35
38
  })), {
36
- clearConversation: U,
37
- createSession: _,
39
+ clearConversation: y,
40
+ createSession: L,
38
41
  fetchAgentConfig: u,
39
42
  fetchSuggestedQuestions: i,
40
- retryQuestion: x,
41
- sendQuestion: P,
42
- stopQuestion: y
43
- } = H({
43
+ retryQuestion: N,
44
+ sendQuestion: O,
45
+ stopQuestion: P
46
+ } = K({
44
47
  contentAnswers: c,
45
48
  createSessionRequest: f,
46
- dispatchStateUpdate: v,
47
- fetchTimeout: g,
48
- formatCitations: S,
49
+ dispatchStateUpdate: x,
50
+ fetchTimeout: S,
51
+ formatCitations: A,
49
52
  getAgentConfig: m,
50
- getAnswerStreaming: p,
51
- getAnswer: A,
53
+ getAnswerStreaming: C,
54
+ getAnswer: p,
52
55
  getSuggestedQuestions: t,
53
56
  isCitationsEnabled: n,
54
- isStopResponseEnabled: T,
57
+ isStopResponseEnabled: E,
55
58
  isStreamingEnabled: r,
56
59
  itemID: o
57
60
  }), {
58
- encodedSession: L,
59
- error: N,
60
- isLoading: O,
61
- hasRequestInProgress: b = !1,
62
- questions: k,
61
+ encodedSession: b,
62
+ error: k,
63
+ isLoading: z,
64
+ hasRequestInProgress: B = !1,
65
+ questions: D,
63
66
  suggestedQuestions: e
64
67
  } = c;
65
- G(() => {
66
- s && e.requestState === d.NOT_STARTED && i();
68
+ J(() => {
69
+ s && e.requestState === a.NOT_STARTED && i();
67
70
  }, [s, i, e.requestState]);
68
- const z = {
69
- createSession: _,
70
- encodedSession: L,
71
- error: N,
71
+ const F = {
72
+ createSession: L,
73
+ encodedSession: b,
74
+ error: k,
75
+ getAIStudioAgents: g,
72
76
  hostAppName: R,
73
- hasRequestInProgress: b,
74
- isAgentSelectorEnabled: C,
77
+ hasRequestInProgress: B,
78
+ isAgentSelectorEnabled: w,
79
+ isAIStudioAgentSelectorEnabled: l,
75
80
  isCitationsEnabled: n,
76
- isDebugModeEnabled: l,
77
- isMarkdownEnabled: w,
78
- isLoading: O,
81
+ isDebugModeEnabled: Q,
82
+ isMarkdownEnabled: T,
83
+ isLoading: z,
79
84
  isOpen: s,
80
- isResetChatEnabled: Q,
85
+ isResetChatEnabled: q,
81
86
  isStreamingEnabled: r,
82
87
  itemID: o,
83
- onClearAction: U,
88
+ onClearAction: y,
84
89
  onCloseModal: h,
85
90
  onSelectAgent: u,
86
91
  onAgentEditorToggle: u,
87
- questions: k,
88
- retryQuestion: x,
89
- sendQuestion: P,
90
- shouldRenderProviders: !1,
91
- stopQuestion: y,
92
- suggestedQuestionsRequestState: t ? e.requestState : d.SUCCESS,
93
- suggestedQuestions: t ? e.suggestions : q,
94
- warningNotice: E,
95
- warningNoticeAriaLabel: j
96
- }, B = Object.fromEntries(Object.entries(z).filter(([V, D]) => D !== void 0));
97
- return /* @__PURE__ */ M(a, {
98
- ...B
92
+ questions: D,
93
+ retryQuestion: N,
94
+ sendQuestion: O,
95
+ shouldRenderProviders: j,
96
+ stopQuestion: P,
97
+ suggestedQuestionsRequestState: t ? e.requestState : a.SUCCESS,
98
+ suggestedQuestions: t ? e.suggestions : U,
99
+ warningNotice: _,
100
+ warningNoticeAriaLabel: v
101
+ }, G = Object.fromEntries(Object.entries(F).filter(([Y, H]) => H !== void 0));
102
+ return /* @__PURE__ */ X(d, {
103
+ ...G
99
104
  });
100
105
  };
101
106
  export {
102
- te as ContentAnswersComponent,
103
- te as default
107
+ ne as ContentAnswersComponent,
108
+ ne as default
104
109
  };
@@ -0,0 +1,9 @@
1
+ const t = (f, g, o, n) => {
2
+ let i;
3
+ return f && (i = g.config), o && (i = n ? {
4
+ id: n.id
5
+ } : void 0), i;
6
+ };
7
+ export {
8
+ t as getAIAgentConfig
9
+ };
@@ -1,126 +1,136 @@
1
1
  import "../../../../styles/footer.css";
2
2
  import * as r from "react";
3
- import { useIntl as j } from "react-intl";
4
- import { useBreakpoint as U, Breakpoint as W, Avatar as z, TextArea as D, Button as Y } from "@box/blueprint-web";
5
- import { ArrowUp as $ } from "@box/blueprint-web-assets/icons/Line";
6
- import { useAgents as J } from "../../contexts/AgentsContext.js";
7
- import { FooterActions as Q } from "./footer-actions.js";
8
- import V from "../../messages.js";
9
- import { isDebugModeTrigger as Z, isEnterTrigger as q } from "../common/keyInputUtils.js";
10
- import { TEXT_AREA as n } from "./constants.js";
11
- import m from "./messages.js";
12
- import { LOGGER_BASE_CONFIG as N, LOGGER_ACTION_CLICK as g, LOGGER_ACTION_KEYPRESS as P } from "../common/constants.js";
13
- import { jsxs as O, jsx as u } from "react/jsx-runtime";
14
- const tt = "_questionInput_1pdo1_1", at = "_avatar_1pdo1_11", rt = "_submitButton_1pdo1_14", et = "_textArea_1pdo1_17", ot = "_submitButtonTooltip_1pdo1_26", d = {
15
- questionInput: tt,
16
- avatar: at,
17
- submitButton: rt,
18
- textArea: et,
19
- submitButtonTooltip: ot
20
- }, bt = ({
21
- askSuggestedQuestion: v,
22
- contentType: C,
23
- enableDebugMode: E = !1,
3
+ import { useIntl as z } from "react-intl";
4
+ import { useBreakpoint as D, Breakpoint as Y, Avatar as J, TextArea as Q, Button as S } from "@box/blueprint-web";
5
+ import { ArrowUp as V } from "@box/blueprint-web-assets/icons/Line";
6
+ import { useAgents as Z } from "@box/box-ai-agent-selector";
7
+ import { useAgents as g } from "../../contexts/AgentsContext.js";
8
+ import { FooterActions as q } from "./footer-actions.js";
9
+ import P from "../../messages.js";
10
+ import { getAIAgentConfig as X } from "../common/agentUtils.js";
11
+ import { isDebugModeTrigger as tt, isEnterTrigger as at } from "../common/keyInputUtils.js";
12
+ import { TEXT_AREA as i } from "./constants.js";
13
+ import u from "./messages.js";
14
+ import { LOGGER_BASE_CONFIG as w, LOGGER_ACTION_CLICK as rt, LOGGER_ACTION_KEYPRESS as et } from "../common/constants.js";
15
+ import { jsxs as H, jsx as p } from "react/jsx-runtime";
16
+ const ot = "_questionInput_1pdo1_1", st = "_avatar_1pdo1_11", it = "_submitButton_1pdo1_14", nt = "_textArea_1pdo1_17", mt = "_submitButtonTooltip_1pdo1_26", A = {
17
+ questionInput: ot,
18
+ avatar: st,
19
+ submitButton: it,
20
+ textArea: nt,
21
+ submitButtonTooltip: mt
22
+ }, kt = ({
23
+ askSuggestedQuestion: h,
24
+ contentType: T,
25
+ enableDebugMode: b = !1,
24
26
  hasRequestInProgress: e,
25
27
  isAgentSelectorEnabled: f,
26
- isDebugModeShown: h,
27
- isStopResponseEnabled: X,
28
- isStreamingEnabled: w,
29
- lastQuestion: x,
30
- onRetryQuestion: T,
31
- onStopQuestion: H,
28
+ isAIStudioAgentSelectorEnabled: _,
29
+ isDebugModeShown: k,
30
+ isStopResponseEnabled: R,
31
+ isStreamingEnabled: y,
32
+ lastQuestion: L,
33
+ onRetryQuestion: E,
34
+ onStopQuestion: I,
32
35
  recordAction: o,
33
- sendQuestion: k,
34
- setAskSuggestedQuestion: A,
35
- toggleDebugMode: s,
36
- user: L
36
+ sendQuestion: M,
37
+ setAskSuggestedQuestion: B,
38
+ toggleDebugMode: n,
39
+ user: G
37
40
  }) => {
38
- const i = j(), I = U(), a = /* @__PURE__ */ r.createRef(), p = I <= W.Medium, [c, M] = r.useState(!0), [R, B] = r.useState(!1), {
39
- selectedAgent: _
40
- } = J(), b = r.useCallback(() => {
41
+ const s = z(), K = D(), a = /* @__PURE__ */ r.createRef(), v = K <= Y.Medium, [c, N] = r.useState(!0), [F, O] = r.useState(!1), {
42
+ selectedAgent: d
43
+ } = g(), {
44
+ selectedAgent: C
45
+ } = Z(), x = r.useCallback(() => {
41
46
  a.current && a.current.focus();
42
- }, [a]), y = r.useCallback(() => {
43
- var G;
44
- let t = ((G = a.current) == null ? void 0 : G.value) ?? "";
45
- a.current && t.length > n.MAX_LENGTH && (a.current.value = t.slice(0, n.MAX_LENGTH), t = a.current.value), B(t.length >= n.MAX_LENGTH), M(t.trim().length === 0);
47
+ }, [a]), j = r.useCallback(() => {
48
+ var m;
49
+ let t = ((m = a.current) == null ? void 0 : m.value) ?? "";
50
+ a.current && t.length > i.MAX_LENGTH && (a.current.value = t.slice(0, i.MAX_LENGTH), t = a.current.value), O(t.length >= i.MAX_LENGTH), N(t.trim().length === 0);
46
51
  }, [a]), l = r.useCallback(() => {
47
- if (b(), !e && a.current) {
52
+ if (x(), !e && a.current) {
48
53
  const t = {
49
54
  prompt: a.current.value
50
55
  };
51
- t.prompt && t.prompt.trim() && (k(t, f ? _.config : void 0), a.current.value = "", M(!0), B(!1)), h && s && s();
56
+ if (t.prompt && t.prompt.trim()) {
57
+ const m = X(f, d, _, C);
58
+ M(t, m), a.current.value = "", N(!0), O(!1);
59
+ }
60
+ k && n && n();
52
61
  }
53
- }, [b, e, a, f, h, _.config, k, s]), K = r.useCallback((t) => {
62
+ }, [C, x, e, a, _, f, k, d, M, n]), U = r.useCallback((t) => {
54
63
  t.preventDefault(), !e && !c && o && o({
55
- ...N,
56
- action: g,
64
+ ...w,
65
+ action: rt,
57
66
  target: "ask"
58
67
  }), l();
59
- }, [e, c, o, l]), S = r.useCallback((t) => {
60
- E && s && Z(t) && s(), q(t) && (t.preventDefault(), !e && !c && o && o({
61
- ...N,
62
- action: P,
68
+ }, [e, c, o, l]), W = r.useCallback((t) => {
69
+ b && n && tt(t) && n(), at(t) && (t.preventDefault(), !e && !c && o && o({
70
+ ...w,
71
+ action: et,
63
72
  target: "ask"
64
73
  }), l());
65
- }, [E, e, c, o, l, s]), F = r.useCallback((t) => {
66
- T(t, f ? _.config : void 0);
67
- }, [f, T, _.config]);
74
+ }, [b, e, c, o, l, n]), $ = r.useCallback((t) => {
75
+ const m = X(f, d, _, C);
76
+ E(t, m);
77
+ }, [C, _, f, E, d]);
68
78
  return r.useEffect(() => {
69
- setTimeout(b, 0);
79
+ setTimeout(x, 0);
70
80
  }, []), r.useEffect(() => {
71
- v && a.current && !e && A && (a.current.value = v, l(), A(null));
72
- }, [v]), /* @__PURE__ */ O("div", {
73
- children: [x && /* @__PURE__ */ u(Q, {
74
- isStopResponseEnabled: X,
75
- isStreamingEnabled: w,
76
- lastQuestion: x,
77
- onRetryQuestion: F,
78
- onStopQuestion: H,
81
+ h && a.current && !e && B && (a.current.value = h, l(), B(null));
82
+ }, [h]), /* @__PURE__ */ H("div", {
83
+ children: [L && /* @__PURE__ */ p(q, {
84
+ isStopResponseEnabled: R,
85
+ isStreamingEnabled: y,
86
+ lastQuestion: L,
87
+ onRetryQuestion: $,
88
+ onStopQuestion: I,
79
89
  recordAction: o
80
- }), /* @__PURE__ */ O("div", {
81
- className: d.questionInput,
82
- children: [!p && /* @__PURE__ */ u("div", {
83
- className: d.avatar,
90
+ }), /* @__PURE__ */ H("div", {
91
+ className: A.questionInput,
92
+ children: [!v && /* @__PURE__ */ p("div", {
93
+ className: A.avatar,
84
94
  "data-testid": "content-answers-question-input-avatar",
85
- children: /* @__PURE__ */ u(z, {
86
- alt: i.formatMessage(V.userAvatar),
95
+ children: /* @__PURE__ */ p(J, {
96
+ alt: s.formatMessage(P.userAvatar),
87
97
  colorIndex: 0,
88
- src: L.avatarURL,
89
- text: L.name.charAt(0)
98
+ src: G.avatarURL,
99
+ text: G.name.charAt(0)
90
100
  })
91
- }), /* @__PURE__ */ u(D, {
101
+ }), /* @__PURE__ */ p(Q, {
92
102
  ref: a,
93
- className: d.textArea,
103
+ className: A.textArea,
94
104
  "data-testid": "content-answers-question-input",
95
- error: R && i.formatMessage(m.maxCharactersReachedError, {
96
- characterLimit: n.MAX_LENGTH
105
+ error: F && s.formatMessage(u.maxCharactersReachedError, {
106
+ characterLimit: i.MAX_LENGTH
97
107
  }),
98
108
  hideLabel: !0,
99
- label: i.formatMessage(m.askQuestionPlaceholder, {
100
- type: C
109
+ label: s.formatMessage(u.askQuestionPlaceholder, {
110
+ type: T
101
111
  }),
102
- maxLength: n.MAX_LENGTH,
103
- maxRows: p ? n.MAX_ROWS_MOBILE : n.MAX_ROWS,
104
- onChange: y,
105
- onKeyDown: S,
106
- placeholder: i.formatMessage(m.askQuestionPlaceholder, {
107
- type: C
112
+ maxLength: i.MAX_LENGTH,
113
+ maxRows: v ? i.MAX_ROWS_MOBILE : i.MAX_ROWS,
114
+ onChange: j,
115
+ onKeyDown: W,
116
+ placeholder: s.formatMessage(u.askQuestionPlaceholder, {
117
+ type: T
108
118
  })
109
- }), /* @__PURE__ */ u(Y, {
110
- "aria-label": i.formatMessage(m.ask),
111
- className: d.submitButton,
119
+ }), /* @__PURE__ */ p(S, {
120
+ "aria-label": s.formatMessage(u.ask),
121
+ className: A.submitButton,
112
122
  "data-testid": "content-answers-submit-button",
113
123
  disabled: c || e,
114
- icon: p ? $ : void 0,
124
+ icon: v ? V : void 0,
115
125
  loading: e,
116
- loadingAriaLabel: i.formatMessage(m.askDisabledTooltip),
117
- onClick: K,
126
+ loadingAriaLabel: s.formatMessage(u.askDisabledTooltip),
127
+ onClick: U,
118
128
  size: "large",
119
- children: p ? void 0 : i.formatMessage(m.ask)
129
+ children: v ? void 0 : s.formatMessage(u.ask)
120
130
  })]
121
131
  })]
122
132
  });
123
133
  };
124
134
  export {
125
- bt as Footer
135
+ kt as Footer
126
136
  };
@@ -1,128 +1,145 @@
1
1
  import "../../../../styles/modal.css";
2
- import { useBreakpoint as G, Breakpoint as H, Modal as a, Text as P, Tooltip as E, IconButton as S } from "@box/blueprint-web";
3
- import { Trash as y } from "@box/blueprint-web-assets/icons/Line";
4
- import { BoxAiLogo as R } from "@box/blueprint-web-assets/icons/Logo";
5
- import { Size8 as C } from "@box/blueprint-web-assets/tokens/tokens";
2
+ import { useBreakpoint as G, Breakpoint as z, Modal as a, Text as R, Tooltip as j, IconButton as E } from "@box/blueprint-web";
3
+ import { Trash as F } from "@box/blueprint-web-assets/icons/Line";
4
+ import { BoxAiLogo as K } from "@box/blueprint-web-assets/icons/Logo";
5
+ import { Size8 as A } from "@box/blueprint-web-assets/tokens/tokens";
6
+ import { BoxAiAgentSelectorWithApi as W, AgentsProvider as $ } from "@box/box-ai-agent-selector";
6
7
  import u from "react";
7
- import { useIntl as j } from "react-intl";
8
- import { BoxAiContentAnswers as F } from "../../box-ai-content-answers.js";
9
- import { AgentsProvider as K } from "../../contexts/AgentsContext.js";
10
- import { AgentSelector as q } from "../agents/agent-selector.js";
11
- import { LOGGER_BASE_CONFIG as g, LOGGER_ACTION_CLICK as D } from "../common/constants.js";
12
- import J from "./hooks/useStopPropagationOnEsc.js";
13
- import l from "./messages.js";
14
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
15
- const Q = "_BoxAIIconColor_e9yaz_1", U = "_modalHeader_e9yaz_5", V = "_contentAnswersModal_e9yaz_10", W = "_boxAiContentAnswers_e9yaz_17", X = "_clearButton_e9yaz_25", Y = "_contentAnswerModal_e9yaz_1", o = {
16
- BoxAIIconColor: Q,
17
- modalHeader: U,
18
- contentAnswersModal: V,
19
- boxAiContentAnswers: W,
20
- clearButton: X,
21
- "modal-close-button": "_modal-close-button_e9yaz_29",
22
- contentAnswerModal: Y
23
- }, _e = ({
8
+ import { useIntl as q } from "react-intl";
9
+ import { BoxAiContentAnswers as D } from "../../box-ai-content-answers.js";
10
+ import { AgentsProvider as J } from "../../contexts/AgentsContext.js";
11
+ import { AgentSelector as Q } from "../agents/agent-selector.js";
12
+ import { LOGGER_BASE_CONFIG as h, LOGGER_ACTION_CLICK as U } from "../common/constants.js";
13
+ import V from "./hooks/useStopPropagationOnEsc.js";
14
+ import i from "./messages.js";
15
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
16
+ const X = "_BoxAIIconColor_1ed3r_1", Y = "_modalHeader_1ed3r_5", Z = "_contentAnswersModal_1ed3r_10", y = "_boxAiContentAnswers_1ed3r_17", ee = "_clearButton_1ed3r_25", te = "_contentAnswerModal_1ed3r_1", oe = "_modalHeaderContainer_1ed3r_54", ne = "_agentSelectorTrigger_1ed3r_62", re = "_agentSelectorContent_1ed3r_73", t = {
17
+ BoxAIIconColor: X,
18
+ modalHeader: Y,
19
+ contentAnswersModal: Z,
20
+ boxAiContentAnswers: y,
21
+ clearButton: ee,
22
+ "modal-close-button": "_modal-close-button_1ed3r_29",
23
+ contentAnswerModal: te,
24
+ modalHeaderContainer: oe,
25
+ agentSelectorTrigger: ne,
26
+ agentSelectorContent: re
27
+ }, we = ({
24
28
  children: M,
29
+ getAIStudioAgents: w,
25
30
  hostAppName: c,
26
31
  isAgentSelectorEnabled: m,
27
- isDebugModeEnabled: w,
28
- isResetChatEnabled: b,
29
- isStopResponseEnabled: h = !1,
30
- itemSize: d,
31
- extension: f,
32
- onClearAction: _,
33
- onSelectAgent: x,
34
- recordAction: r,
35
- shouldRenderProviders: B = !0,
36
- stopPropagationOnEsc: I,
37
- ...v
32
+ isAIStudioAgentSelectorEnabled: s,
33
+ isDebugModeEnabled: x,
34
+ isResetChatEnabled: B,
35
+ isStopResponseEnabled: b = !1,
36
+ itemSize: g,
37
+ extension: _,
38
+ onClearAction: C,
39
+ onSelectAgent: v,
40
+ recordAction: o,
41
+ shouldRenderProviders: I = !0,
42
+ stopPropagationOnEsc: T,
43
+ ...H
38
44
  }) => {
39
45
  const {
40
- open: A,
41
- defaultOpen: z,
46
+ open: f,
47
+ defaultOpen: N,
42
48
  onOpenChange: L,
43
- modal: N,
44
- ...O
45
- } = v, s = j(), k = G() <= H.Medium;
46
- J(I, A);
47
- const t = u.useCallback((n) => {
48
- r && (n.data ?? (n.data = {}), n.data.hostAppName = c, r(n));
49
- }, [c, r]);
49
+ modal: O,
50
+ ...S
51
+ } = H, l = q(), k = G() <= z.Medium;
52
+ V(T, f);
53
+ const n = u.useCallback((r) => {
54
+ o && (r.data ?? (r.data = {}), r.data.hostAppName = c, o(r));
55
+ }, [c, o]);
50
56
  u.useEffect(() => {
51
- t({
52
- ...g,
57
+ n({
58
+ ...h,
53
59
  target: "loaded",
54
60
  data: {
55
- fileSize: d,
56
- fileType: f
61
+ fileSize: g,
62
+ fileType: _
57
63
  }
58
64
  });
59
- }, [t, f, d, r]);
60
- const T = () => {
61
- _ && (_(), t({
62
- ...g,
63
- action: D,
65
+ }, [n, _, g, o]);
66
+ const P = () => {
67
+ C && (C(), n({
68
+ ...h,
69
+ action: U,
64
70
  target: "clearChat"
65
71
  }));
66
- }, p = /* @__PURE__ */ i(a, {
67
- defaultOpen: z,
68
- modal: N,
72
+ }, p = /* @__PURE__ */ d(a, {
73
+ defaultOpen: N,
74
+ modal: O,
69
75
  onOpenChange: L,
70
- open: A,
76
+ open: f,
71
77
  children: [/* @__PURE__ */ e(a.Trigger, {
72
78
  children: M
73
- }), /* @__PURE__ */ i(a.Content, {
74
- className: o.contentAnswersModal,
79
+ }), /* @__PURE__ */ d(a.Content, {
80
+ className: t.contentAnswersModal,
75
81
  "data-testid": "content-answers-modal",
76
82
  size: "xlarge",
77
83
  children: [/* @__PURE__ */ e(a.Header, {
78
- children: /* @__PURE__ */ i("div", {
79
- className: o.modalHeader,
80
- children: [!k && /* @__PURE__ */ e(R, {
81
- className: o.BoxAIIconColor,
84
+ className: t.modalHeaderContainer,
85
+ children: /* @__PURE__ */ d("div", {
86
+ className: t.modalHeader,
87
+ children: [!k && /* @__PURE__ */ e(K, {
88
+ className: t.BoxAIIconColor,
82
89
  "data-testid": "content-answers-icon-color",
83
- height: C,
84
- width: C
85
- }), /* @__PURE__ */ e(P, {
90
+ height: A,
91
+ width: A
92
+ }), /* @__PURE__ */ e(R, {
86
93
  as: "span",
87
94
  variant: "titleMedium",
88
- children: s.formatMessage(l.contentAnswersTitle)
89
- }), m && /* @__PURE__ */ e(q, {
90
- onSelectAgent: x,
91
- recordAction: t
95
+ children: l.formatMessage(i.contentAnswersTitle)
96
+ }), !s && m && /* @__PURE__ */ e(Q, {
97
+ onSelectAgent: v,
98
+ recordAction: n
99
+ }), s && /* @__PURE__ */ e(W, {
100
+ contentClassName: t.agentSelectorContent,
101
+ fetcher: w,
102
+ hostAppName: c,
103
+ recordAction: o,
104
+ shouldHideAgentSelectorOnLoad: !0,
105
+ triggerChipClassName: t.agentSelectorTrigger
92
106
  })]
93
107
  })
94
- }), b && /* @__PURE__ */ e(E, {
95
- content: s.formatMessage(l.clearConversationLabel),
108
+ }), B && /* @__PURE__ */ e(j, {
109
+ content: l.formatMessage(i.clearConversationLabel),
96
110
  "data-testid": "clear-conversation-tooltip",
97
111
  side: "top",
98
112
  variant: "standard",
99
- children: /* @__PURE__ */ e(S, {
100
- "aria-label": s.formatMessage(l.clearConversationLabel),
101
- className: o.clearButton,
113
+ children: /* @__PURE__ */ e(E, {
114
+ "aria-label": l.formatMessage(i.clearConversationLabel),
115
+ className: t.clearButton,
102
116
  "data-testid": "clear-conversation-button",
103
- icon: y,
104
- onClick: T,
117
+ icon: F,
118
+ onClick: P,
105
119
  size: "small"
106
120
  })
107
121
  }), /* @__PURE__ */ e(a.Close, {
108
- "aria-label": s.formatMessage(l.closeModalAriaLabel),
109
- className: o["modal-close-button"],
122
+ "aria-label": l.formatMessage(i.closeModalAriaLabel),
123
+ className: t["modal-close-button"],
110
124
  size: "small"
111
- }), /* @__PURE__ */ e(F, {
112
- className: o.boxAiContentAnswers,
113
- isAgentSelectorEnabled: m,
114
- isDebugModeEnabled: w,
115
- isStopResponseEnabled: h,
116
- recordAction: t,
117
- ...O
125
+ }), /* @__PURE__ */ e(D, {
126
+ className: t.boxAiContentAnswers,
127
+ isAgentSelectorEnabled: !s && m,
128
+ isAIStudioAgentSelectorEnabled: s,
129
+ isDebugModeEnabled: x,
130
+ isStopResponseEnabled: b,
131
+ recordAction: n,
132
+ ...S
118
133
  })]
119
134
  })]
120
135
  });
121
- return B ? /* @__PURE__ */ e(K, {
122
- children: p
136
+ return I ? /* @__PURE__ */ e($, {
137
+ children: /* @__PURE__ */ e(J, {
138
+ children: p
139
+ })
123
140
  }) : p;
124
141
  };
125
142
  export {
126
- _e as IntelligenceModal,
127
- _e as default
143
+ we as IntelligenceModal,
144
+ we as default
128
145
  };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.64.2",
3
+ "version": "0.65.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.16.0",
7
+ "@box/box-ai-agent-selector": "^0.15.2",
7
8
  "highlight.js": "^11.9.0",
8
9
  "immutable": "^4.0.0",
9
10
  "lodash": "^4.17.15",
@@ -13,8 +14,9 @@
13
14
  "remarkable": "^2.0.1"
14
15
  },
15
16
  "devDependencies": {
16
- "@box/blueprint-web": "^8.5.2",
17
- "@box/blueprint-web-assets": "^4.28.0",
17
+ "@box/blueprint-web": "^8.5.3",
18
+ "@box/blueprint-web-assets": "^4.29.0",
19
+ "@box/box-ai-agent-selector": "^0.15.2",
18
20
  "@box/storybook-utils": "^0.7.0",
19
21
  "@testing-library/react": "^15.0.6",
20
22
  "react": "^18.3.0",
@@ -52,5 +54,5 @@
52
54
  "**/*.css"
53
55
  ],
54
56
  "license": "SEE LICENSE IN LICENSE",
55
- "gitHead": "6aca748ad995a1a02df2af9feacf9806e53544de"
57
+ "gitHead": "31e23f5c37c183d2237deeab90eb3bc5c2b360e2"
56
58
  }
package/styles/modal.css CHANGED
@@ -1 +1 @@
1
- ._BoxAIIconColor_e9yaz_1{margin-right:.75rem}._modalHeader_e9yaz_5{display:flex;align-items:center}._contentAnswersModal_e9yaz_10{display:flex;flex-basis:0;width:100%;height:100%;max-height:43.875rem}._contentAnswersModal_e9yaz_10 ._boxAiContentAnswers_e9yaz_17{display:flex;flex-direction:column;flex-grow:1;max-height:43.875rem;overflow:hidden;box-shadow:0 -1px 8px #0000000d,0 -1px #e8e8e8}._contentAnswersModal_e9yaz_10 ._clearButton_e9yaz_25{position:absolute;right:60px}._contentAnswersModal_e9yaz_10 ._modal-close-button_e9yaz_29,._contentAnswersModal_e9yaz_10 ._clearButton_e9yaz_25{top:1.25rem}@media (max-width: 374px){._contentAnswersModal_e9yaz_10,#_contentAnswerModal_e9yaz_1{flex-basis:100%;max-height:unset}._contentAnswersModal_e9yaz_10 ._boxAiContentAnswers_e9yaz_17,#_contentAnswerModal_e9yaz_1 ._boxAiContentAnswers_e9yaz_17{display:flex;flex-flow:column;max-height:unset}._contentAnswersModal_e9yaz_10 ._modal-close-button_e9yaz_29,._contentAnswersModal_e9yaz_10 ._clearButton_e9yaz_25,#_contentAnswerModal_e9yaz_1 ._modal-close-button_e9yaz_29,#_contentAnswerModal_e9yaz_1 ._clearButton_e9yaz_25{top:1rem}}
1
+ ._BoxAIIconColor_1ed3r_1{margin-right:.75rem}._modalHeader_1ed3r_5{display:flex;align-items:center}._contentAnswersModal_1ed3r_10{display:flex;flex-basis:0;width:100%;height:100%;max-height:43.875rem}._contentAnswersModal_1ed3r_10 ._boxAiContentAnswers_1ed3r_17{display:flex;flex-direction:column;flex-grow:1;max-height:43.875rem;overflow:hidden;box-shadow:0 -1px 8px #0000000d,0 -1px #e8e8e8}._contentAnswersModal_1ed3r_10 ._clearButton_1ed3r_25{position:absolute;right:60px}._contentAnswersModal_1ed3r_10 ._modal-close-button_1ed3r_29,._contentAnswersModal_1ed3r_10 ._clearButton_1ed3r_25{top:1.25rem}@media (max-width: 374px){._contentAnswersModal_1ed3r_10,#_contentAnswerModal_1ed3r_1{flex-basis:100%;max-height:unset}._contentAnswersModal_1ed3r_10 ._boxAiContentAnswers_1ed3r_17,#_contentAnswerModal_1ed3r_1 ._boxAiContentAnswers_1ed3r_17{display:flex;flex-flow:column;max-height:unset}._contentAnswersModal_1ed3r_10 ._modal-close-button_1ed3r_29,._contentAnswersModal_1ed3r_10 ._clearButton_1ed3r_25,#_contentAnswerModal_1ed3r_1 ._modal-close-button_1ed3r_29,#_contentAnswerModal_1ed3r_1 ._clearButton_1ed3r_25{top:1rem}}@media (max-width: 540px){._contentAnswersModal_1ed3r_10 div:has(._modalHeaderContainer_1ed3r_54){width:100%;box-sizing:border-box}._contentAnswersModal_1ed3r_10 ._modalHeaderContainer_1ed3r_54 ._modalHeader_1ed3r_5{flex-direction:column;align-items:start}._contentAnswersModal_1ed3r_10 ._modalHeaderContainer_1ed3r_54 ._modalHeader_1ed3r_5 ._agentSelectorTrigger_1ed3r_62{margin-inline-start:0;margin-block-start:var(--space-8);width:100%;flex:1}._contentAnswersModal_1ed3r_10 ._modalHeaderContainer_1ed3r_54 ._modalHeader_1ed3r_5 ._agentSelectorTrigger_1ed3r_62 button{width:100%;max-width:100%}}._agentSelectorContent_1ed3r_73{max-height:15rem}
@@ -2,5 +2,5 @@ import { type ApiWrapperProps } from './types';
2
2
  export type ContentAnswersComponentProps = ApiWrapperProps & {
3
3
  WrappedComponent: React.ComponentType<ApiWrapperProps>;
4
4
  };
5
- export declare const ContentAnswersComponent: ({ WrappedComponent, createSessionRequest, getAgentConfig, fetchTimeout, formatCitations, getAnswer, getAnswerStreaming, getSuggestedQuestions, hostAppName, isAgentSelectorEnabled, isCitationsEnabled, isDebugModeEnabled, isMarkdownEnabled, isOpen, isResetChatEnabled, isStopResponseEnabled, isStreamingEnabled, itemID, onCloseModal, suggestedQuestions, warningNotice, warningNoticeAriaLabel, }: ContentAnswersComponentProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const ContentAnswersComponent: ({ WrappedComponent, createSessionRequest, getAgentConfig, getAIStudioAgents, fetchTimeout, formatCitations, getAnswer, getAnswerStreaming, getSuggestedQuestions, hostAppName, isAgentSelectorEnabled, isAIStudioAgentSelectorEnabled, isCitationsEnabled, isDebugModeEnabled, isMarkdownEnabled, isOpen, isResetChatEnabled, isStopResponseEnabled, isStreamingEnabled, itemID, onCloseModal, shouldRenderProviders, suggestedQuestions, warningNotice, warningNoticeAriaLabel, }: ContentAnswersComponentProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default ContentAnswersComponent;
@@ -1,3 +1,4 @@
1
+ import { type AgentListResponse } from '@box/box-ai-agent-selector';
1
2
  import { type AgentType, type CitationResponse, type CitationType, type CONTENT_ERROR, type QuestionType, type REQUEST_STATE, type RetryQuestion, type StopQuestion, type SubmitQuestion, type SuggestedQuestionsResponse, type SuggestedQuestionType } from '../../types';
2
3
  import { type ContentAnswersRecordType } from './records';
3
4
  export type CreateSessionResponse = {
@@ -54,11 +55,18 @@ export type ApiWrapperProps = {
54
55
  fetchTimeout?: StreamResponseTimeout;
55
56
  formatCitations?: (citations: Array<CitationResponse>) => Array<CitationType>;
56
57
  getAgentConfig?: agentFetcherType;
58
+ getAIStudioAgents?(): Promise<AgentListResponse>;
57
59
  getAnswer?: fetcherType;
58
60
  getAnswerStreaming?: fetcherStreamingType;
59
61
  getSuggestedQuestions?: SuggestedQuestionFetcherType;
60
62
  hostAppName?: string;
63
+ /**
64
+ * Flag to enable or disable the agent selector
65
+ * Prefer passing isAIStudioAgentSelectorEnabled and getAIStudioAgents instead since this prop will be removed soon
66
+ * @deprecated
67
+ */
61
68
  isAgentSelectorEnabled?: boolean;
69
+ isAIStudioAgentSelectorEnabled?: boolean;
62
70
  isDebugModeEnabled?: boolean;
63
71
  isResetChatEnabled?: boolean;
64
72
  isStopResponseEnabled?: boolean;
@@ -69,6 +77,7 @@ export type ApiWrapperProps = {
69
77
  isStreamingEnabled?: boolean;
70
78
  itemID?: string;
71
79
  onCloseModal?: () => void;
80
+ shouldRenderProviders?: boolean;
72
81
  suggestedQuestionsRequestState?: REQUEST_STATE;
73
82
  suggestedQuestions?: SuggestedQuestionType[];
74
83
  warningNotice?: string;
@@ -0,0 +1 @@
1
+ export declare const getAIAgentConfig: (isAgentSelectorEnabled: any, selectedAgent: any, isAIStudioAgentSelectorEnabled: any, aiStudioSelectedAgent: any) => any;
@@ -1,10 +1,7 @@
1
+ import { type RecordActionType } from '../../types';
1
2
  export declare const LOGGER_COMPONENT = "modal";
2
3
  export declare const LOGGER_FEATURE = "answers";
3
4
  export declare const LOGGER_ACTION_PROGRAMMATIC = "programmatic";
4
5
  export declare const LOGGER_ACTION_CLICK = "click";
5
6
  export declare const LOGGER_ACTION_KEYPRESS = "keypress";
6
- export declare const LOGGER_BASE_CONFIG: {
7
- action: string;
8
- component: string;
9
- feature: string;
10
- };
7
+ export declare const LOGGER_BASE_CONFIG: RecordActionType;
@@ -8,8 +8,14 @@ export interface FooterProps {
8
8
  enableDebugMode?: boolean;
9
9
  /** Whether to indicate if there is a request in progress like an answer being fetched or streamed */
10
10
  hasRequestInProgress: boolean;
11
- /** Whether to show the agent selector or not */
11
+ /**
12
+ * Flag to enable or disable the agent selector
13
+ * Prefer passing isAIStudioAgentSelectorEnabled instead since this prop will be removed soon
14
+ * @deprecated
15
+ */
12
16
  isAgentSelectorEnabled?: boolean;
17
+ /** Whether to show the AI studio agent selector or not */
18
+ isAIStudioAgentSelectorEnabled?: boolean;
13
19
  /** Flag to indicate if the CTRL+SHIFT+X is currently shown */
14
20
  isDebugModeShown?: boolean;
15
21
  /** Whether to give user a possibility to stop the response before any answer is generated */
@@ -33,4 +39,4 @@ export interface FooterProps {
33
39
  /** User information consisting on their name and an optional avatar */
34
40
  user: UserInfoType;
35
41
  }
36
- export declare const Footer: ({ askSuggestedQuestion, contentType, enableDebugMode, hasRequestInProgress, isAgentSelectorEnabled, isDebugModeShown, isStopResponseEnabled, isStreamingEnabled, lastQuestion, onRetryQuestion, onStopQuestion, recordAction, sendQuestion, setAskSuggestedQuestion, toggleDebugMode, user, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
42
+ export declare const Footer: ({ askSuggestedQuestion, contentType, enableDebugMode, hasRequestInProgress, isAgentSelectorEnabled, isAIStudioAgentSelectorEnabled, isDebugModeShown, isStopResponseEnabled, isStreamingEnabled, lastQuestion, onRetryQuestion, onStopQuestion, recordAction, sendQuestion, setAskSuggestedQuestion, toggleDebugMode, user, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,23 @@
1
1
  import { type ModalProps } from '@box/blueprint-web';
2
+ import { type AgentListResponse } from '@box/box-ai-agent-selector';
2
3
  import React from 'react';
3
4
  import { type BoxAiContentAnswersProps } from '../../box-ai-content-answers';
4
5
  import { type AgentType, type RecordActionType } from '../../types';
5
6
  export type IntelligenceModalProps = ModalProps & BoxAiContentAnswersProps & {
7
+ /** API callback to send to AI Studio Agent Selector */
8
+ getAIStudioAgents?(): Promise<AgentListResponse>;
6
9
  /** Name of the host application */
7
10
  hostAppName?: string;
8
11
  /** Size of the item used for QA. This is used for log purposes */
9
12
  itemSize?: string;
10
- /** Flag to enable or disable the agent selector */
13
+ /**
14
+ * Flag to enable or disable the agent selector
15
+ * Prefer passing isAIStudioAgentSelectorEnabled and getAIStudioAgents instead since this prop will be removed soon
16
+ * @deprecated
17
+ */
11
18
  isAgentSelectorEnabled?: boolean;
19
+ /** Flag to enable or disable the AI studio agent selector */
20
+ isAIStudioAgentSelectorEnabled?: boolean;
12
21
  /** Flag to enable or disable the debug mode via CTRL+SHIFT+X */
13
22
  isDebugModeEnabled?: boolean;
14
23
  /** Flag to enable or disable the reset chat button */
@@ -1,3 +1,4 @@
1
+ import { type LOGGER_ACTION_CLICK, type LOGGER_ACTION_KEYPRESS, type LOGGER_ACTION_PROGRAMMATIC } from './components/common/constants';
1
2
  export declare enum ANSWER_ERROR {
2
3
  GENERAL = "general",
3
4
  RATE_LIMITING = "rate_limiting",
@@ -41,8 +42,14 @@ export type ChatProps = WelcomeMessageProps & {
41
42
  isCitationsEnabled?: boolean;
42
43
  /** Whether if the answers supports markdown or not */
43
44
  isMarkdownEnabled?: boolean;
44
- /** Whether to show the agent selector or not */
45
+ /**
46
+ * Flag to enable or disable the agent selector
47
+ * Prefer passing isAIStudioAgentSelectorEnabled instead since this prop will be removed soon
48
+ * @deprecated
49
+ */
45
50
  isAgentSelectorEnabled?: boolean;
51
+ /** Whether to show the AI studio agent selector or not */
52
+ isAIStudioAgentSelectorEnabled?: boolean;
46
53
  /** Whether to allow CTRL+SHIFT+X feature or not */
47
54
  isDebugModeEnabled?: boolean;
48
55
  /** Whether to give user a possibility to stop the response before any answer is generated */
@@ -82,6 +89,7 @@ export type ContentProps = Omit<ChatProps, 'handleScrollToBottom'> & {
82
89
  setIsErrorMessageShown: ((value: boolean) => void) | null;
83
90
  };
84
91
  export type AgentType = {
92
+ id: string;
85
93
  config: object;
86
94
  description?: string;
87
95
  isDefault?: boolean;
@@ -93,11 +101,18 @@ export type AgentState = {
93
101
  selectedAgent: AgentType;
94
102
  };
95
103
  export type RecordActionType = {
96
- action: string;
97
- data?: any;
104
+ action: typeof LOGGER_ACTION_CLICK | typeof LOGGER_ACTION_PROGRAMMATIC | typeof LOGGER_ACTION_KEYPRESS;
105
+ data?: {
106
+ hostAppName?: string;
107
+ agentSelected?: string;
108
+ index?: number;
109
+ count?: number;
110
+ errorType?: string;
111
+ selectedQuestion?: string;
112
+ };
98
113
  component: string;
99
114
  feature: string;
100
- target: string;
115
+ target?: string;
101
116
  };
102
117
  export type QuestionType = {
103
118
  answer?: string;