@box/box-ai-content-answers 0.58.6 → 0.60.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.
Files changed (58) hide show
  1. package/esm/lib/box-ai-content-answers.js +33 -31
  2. package/esm/lib/components/api-wrapper/content-answers-component.js +47 -45
  3. package/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +109 -100
  4. package/esm/lib/components/footer/footer-actions.js +19 -18
  5. package/esm/lib/components/footer/footer.js +42 -40
  6. package/esm/lib/components/modal/modal.js +49 -47
  7. package/i18n/bn-IN.js +1 -1
  8. package/i18n/bn-IN.properties +1 -1
  9. package/i18n/da-DK.js +1 -1
  10. package/i18n/da-DK.properties +1 -1
  11. package/i18n/de-DE.js +1 -1
  12. package/i18n/de-DE.properties +1 -1
  13. package/i18n/en-x-pseudo.js +50 -50
  14. package/i18n/en-x-pseudo.properties +50 -50
  15. package/i18n/es-419.js +1 -1
  16. package/i18n/es-419.properties +1 -1
  17. package/i18n/es-ES.js +1 -1
  18. package/i18n/es-ES.properties +1 -1
  19. package/i18n/fi-FI.js +1 -1
  20. package/i18n/fi-FI.properties +1 -1
  21. package/i18n/fr-CA.js +1 -1
  22. package/i18n/fr-CA.properties +1 -1
  23. package/i18n/fr-FR.js +1 -1
  24. package/i18n/fr-FR.properties +1 -1
  25. package/i18n/hi-IN.js +1 -1
  26. package/i18n/hi-IN.properties +1 -1
  27. package/i18n/it-IT.js +1 -1
  28. package/i18n/it-IT.properties +1 -1
  29. package/i18n/ja-JP.js +2 -2
  30. package/i18n/ja-JP.properties +2 -2
  31. package/i18n/ko-KR.js +1 -1
  32. package/i18n/ko-KR.properties +1 -1
  33. package/i18n/nb-NO.js +1 -1
  34. package/i18n/nb-NO.properties +1 -1
  35. package/i18n/nl-NL.js +1 -1
  36. package/i18n/nl-NL.properties +1 -1
  37. package/i18n/pl-PL.js +1 -1
  38. package/i18n/pl-PL.properties +1 -1
  39. package/i18n/pt-BR.js +1 -1
  40. package/i18n/pt-BR.properties +1 -1
  41. package/i18n/ru-RU.js +1 -1
  42. package/i18n/ru-RU.properties +1 -1
  43. package/i18n/sv-SE.js +1 -1
  44. package/i18n/sv-SE.properties +1 -1
  45. package/i18n/tr-TR.js +1 -1
  46. package/i18n/tr-TR.properties +1 -1
  47. package/i18n/zh-CN.js +1 -1
  48. package/i18n/zh-CN.properties +1 -1
  49. package/i18n/zh-TW.js +1 -1
  50. package/i18n/zh-TW.properties +1 -1
  51. package/package.json +3 -3
  52. package/types/lib/components/api-wrapper/content-answers-component.d.ts +1 -1
  53. package/types/lib/components/api-wrapper/hooks/useContentAnswers.d.ts +1 -1
  54. package/types/lib/components/api-wrapper/types.d.ts +1 -0
  55. package/types/lib/components/footer/footer-actions.d.ts +2 -1
  56. package/types/lib/components/footer/footer.d.ts +3 -1
  57. package/types/lib/components/modal/modal.d.ts +1 -0
  58. package/types/lib/types.d.ts +2 -0
@@ -1,42 +1,43 @@
1
1
  import "../../styles/box-ai-content-answers.css";
2
- import j from "clsx";
2
+ import k from "clsx";
3
3
  import * as s from "react";
4
- import { AgentEditor as k } from "./components/agents/agent-editor.js";
5
- import { Content as C } from "./components/content/content.js";
6
- import { Footer as F } from "./components/footer/footer.js";
7
- import { jsx as n, jsxs as N } from "react/jsx-runtime";
8
- const y = "_container_hi5vt_1", B = "_contentAnswers_hi5vt_5", w = {
9
- container: y,
10
- contentAnswers: B
11
- }, O = ({
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 = ({
12
12
  className: S,
13
13
  contentType: u,
14
14
  error: t,
15
15
  hasRequestInProgress: c,
16
16
  isAgentSelectorEnabled: h,
17
17
  isDebugModeEnabled: A,
18
+ isStopResponseEnabled: M,
18
19
  isStreamingEnabled: o,
19
20
  userInfo: l,
20
21
  questions: i,
21
22
  recordAction: r,
22
- retryQuestion: M,
23
+ retryQuestion: Q,
23
24
  showLoadingIndicator: a,
24
- stopQuestion: Q,
25
- submitQuestion: _,
26
- suggestedQuestions: x,
27
- useAnimation: b,
28
- onAgentEditorToggle: v,
29
- ...D
25
+ stopQuestion: _,
26
+ submitQuestion: x,
27
+ suggestedQuestions: b,
28
+ useAnimation: v,
29
+ onAgentEditorToggle: D,
30
+ ...E
30
31
  }) => {
31
- const [m, g] = s.useState(null), [f, d] = s.useState(t != null), [e, p] = s.useState(!1), E = !f && !a;
32
+ const [m, g] = s.useState(null), [f, d] = s.useState(t != null), [e, p] = s.useState(!1), j = !f && !a;
32
33
  return s.useEffect(() => {
33
34
  d(t != null);
34
35
  }, [t]), /* @__PURE__ */ n("div", {
35
- className: j(S, w.container),
36
- children: /* @__PURE__ */ N("div", {
36
+ className: k(S, w.container),
37
+ children: /* @__PURE__ */ y("div", {
37
38
  className: w.contentAnswers,
38
- children: [!e && /* @__PURE__ */ n(C, {
39
- ...D,
39
+ children: [!e && /* @__PURE__ */ n(F, {
40
+ ...E,
40
41
  askSuggestedQuestion: m,
41
42
  contentType: u,
42
43
  error: t,
@@ -48,26 +49,27 @@ const y = "_container_hi5vt_1", B = "_contentAnswers_hi5vt_5", w = {
48
49
  setAskSuggestedQuestion: g,
49
50
  setIsErrorMessageShown: d,
50
51
  showLoadingIndicator: a,
51
- suggestedQuestions: x,
52
- useAnimation: o && b,
52
+ suggestedQuestions: b,
53
+ useAnimation: o && v,
53
54
  userInfo: l
54
- }), e && /* @__PURE__ */ n(k, {
55
- onAgentEditorToggle: v,
55
+ }), e && /* @__PURE__ */ n(C, {
56
+ onAgentEditorToggle: D,
56
57
  recordAction: r,
57
58
  setIsDebugModeShown: p
58
- }), E && /* @__PURE__ */ n(F, {
59
+ }), j && /* @__PURE__ */ n(N, {
59
60
  askSuggestedQuestion: m,
60
61
  contentType: u,
61
62
  enableDebugMode: A,
62
63
  hasRequestInProgress: c,
63
64
  isAgentSelectorEnabled: h,
64
65
  isDebugModeShown: e,
66
+ isStopResponseEnabled: M,
65
67
  isStreamingEnabled: o,
66
68
  lastQuestion: i[i.length - 1],
67
- onRetryQuestion: M,
68
- onStopQuestion: Q,
69
+ onRetryQuestion: Q,
70
+ onStopQuestion: _,
69
71
  recordAction: r,
70
- sendQuestion: _,
72
+ sendQuestion: x,
71
73
  setAskSuggestedQuestion: g,
72
74
  toggleDebugMode: () => {
73
75
  p(!e);
@@ -78,6 +80,6 @@ const y = "_container_hi5vt_1", B = "_contentAnswers_hi5vt_5", w = {
78
80
  });
79
81
  };
80
82
  export {
81
- O as BoxAiContentAnswers,
82
- O as default
83
+ U as BoxAiContentAnswers,
84
+ U as default
83
85
  };
@@ -1,10 +1,10 @@
1
- import { useReducer as D, useEffect as F } from "react";
1
+ import { useReducer as F, useEffect as G } from "react";
2
2
  import { R as d } from "../../../../chunks/types.js";
3
- import { useContentAnswers as G } from "./hooks/useContentAnswers.js";
4
- import { ContentAnswersRecord as H, ContentAnswersItemRecord as I } from "./records.js";
5
- import J from "./reducer.js";
6
- import { jsx as K } from "react/jsx-runtime";
7
- const ee = ({
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
8
  WrappedComponent: a,
9
9
  createSessionRequest: f,
10
10
  getAgentConfig: m,
@@ -20,29 +20,30 @@ const ee = ({
20
20
  isMarkdownEnabled: w,
21
21
  isOpen: s,
22
22
  isResetChatEnabled: Q,
23
+ isStopResponseEnabled: T,
23
24
  isStreamingEnabled: r,
24
25
  itemID: o,
25
- onCloseModal: T,
26
- suggestedQuestions: h,
27
- warningNotice: q,
28
- warningNoticeAriaLabel: E
26
+ onCloseModal: h,
27
+ suggestedQuestions: q,
28
+ warningNotice: E,
29
+ warningNoticeAriaLabel: j
29
30
  }) => {
30
- const [c, j] = D(J, new H({
31
- item: new I({
31
+ const [c, v] = F(K, new I({
32
+ item: new J({
32
33
  id: o
33
34
  })
34
35
  })), {
35
- clearConversation: v,
36
- createSession: U,
36
+ clearConversation: U,
37
+ createSession: _,
37
38
  fetchAgentConfig: u,
38
39
  fetchSuggestedQuestions: i,
39
- retryQuestion: _,
40
- sendQuestion: x,
41
- stopQuestion: P
42
- } = G({
40
+ retryQuestion: x,
41
+ sendQuestion: P,
42
+ stopQuestion: y
43
+ } = H({
43
44
  contentAnswers: c,
44
45
  createSessionRequest: f,
45
- dispatchStateUpdate: j,
46
+ dispatchStateUpdate: v,
46
47
  fetchTimeout: g,
47
48
  formatCitations: S,
48
49
  getAgentConfig: m,
@@ -50,53 +51,54 @@ const ee = ({
50
51
  getAnswer: A,
51
52
  getSuggestedQuestions: t,
52
53
  isCitationsEnabled: n,
54
+ isStopResponseEnabled: T,
53
55
  isStreamingEnabled: r,
54
56
  itemID: o
55
57
  }), {
56
- encodedSession: y,
57
- error: L,
58
- isLoading: N,
59
- hasRequestInProgress: O = !1,
60
- questions: b,
58
+ encodedSession: L,
59
+ error: N,
60
+ isLoading: O,
61
+ hasRequestInProgress: b = !1,
62
+ questions: k,
61
63
  suggestedQuestions: e
62
64
  } = c;
63
- F(() => {
65
+ G(() => {
64
66
  s && e.requestState === d.NOT_STARTED && i();
65
67
  }, [s, i, e.requestState]);
66
- const k = {
67
- createSession: U,
68
- encodedSession: y,
69
- error: L,
68
+ const z = {
69
+ createSession: _,
70
+ encodedSession: L,
71
+ error: N,
70
72
  hostAppName: R,
71
- hasRequestInProgress: O,
73
+ hasRequestInProgress: b,
72
74
  isAgentSelectorEnabled: C,
73
75
  isCitationsEnabled: n,
74
76
  isDebugModeEnabled: l,
75
77
  isMarkdownEnabled: w,
76
- isLoading: N,
78
+ isLoading: O,
77
79
  isOpen: s,
78
80
  isResetChatEnabled: Q,
79
81
  isStreamingEnabled: r,
80
82
  itemID: o,
81
- onClearAction: v,
82
- onCloseModal: T,
83
+ onClearAction: U,
84
+ onCloseModal: h,
83
85
  onSelectAgent: u,
84
86
  onAgentEditorToggle: u,
85
- questions: b,
86
- retryQuestion: _,
87
- sendQuestion: x,
87
+ questions: k,
88
+ retryQuestion: x,
89
+ sendQuestion: P,
88
90
  shouldRenderProviders: !1,
89
- stopQuestion: P,
91
+ stopQuestion: y,
90
92
  suggestedQuestionsRequestState: t ? e.requestState : d.SUCCESS,
91
- suggestedQuestions: t ? e.suggestions : h,
92
- warningNotice: q,
93
- warningNoticeAriaLabel: E
94
- }, z = Object.fromEntries(Object.entries(k).filter(([M, B]) => B !== void 0));
95
- return /* @__PURE__ */ K(a, {
96
- ...z
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
97
99
  });
98
100
  };
99
101
  export {
100
- ee as ContentAnswersComponent,
101
- ee as default
102
+ te as ContentAnswersComponent,
103
+ te as default
102
104
  };
@@ -1,32 +1,33 @@
1
- import K from "lodash/camelCase";
2
- import t, { useCallback as X } from "react";
3
- import { useAgentsDispatch as Y } from "../../../contexts/AgentsContext.js";
4
- import { A as m, C as z, R as F } from "../../../../../chunks/types.js";
5
- import { SET_NEW_ITEM as B, UPDATE_QUESTION as Z, SET_MODAL_ERROR as h, SET_MODAL_SUCCESS as w, SET_IS_LOADING as U, CLEAR_CONVERSATION_HISTORY as ss, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as q, SET_SUGGESTED_QUESTIONS as es } from "../actions.js";
6
- import { QuestionRecord as os } from "../records.js";
7
- import { defaultFormatSuggestions as ts, defaultFormatCitations as ns } from "../utils/format.js";
8
- import { getAnswerRequest as as } from "../utils/request.js";
9
- import p from "../utils/stream.js";
1
+ import X from "lodash/camelCase";
2
+ import t, { useCallback as Y } from "react";
3
+ import { useAgentsDispatch as z } from "../../../contexts/AgentsContext.js";
4
+ import { A as T, C as B, R as F } from "../../../../../chunks/types.js";
5
+ import { SET_NEW_ITEM as Z, UPDATE_QUESTION as h, SET_MODAL_ERROR as w, SET_MODAL_SUCCESS as U, SET_IS_LOADING as ss, CLEAR_CONVERSATION_HISTORY as es, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as q, SET_SUGGESTED_QUESTIONS as os } from "../actions.js";
6
+ import { QuestionRecord as ts } from "../records.js";
7
+ import { defaultFormatSuggestions as as, defaultFormatCitations as ns } from "../utils/format.js";
8
+ import { getAnswerRequest as rs } from "../utils/request.js";
9
+ import Q from "../utils/stream.js";
10
10
  const is = /Too Many Requests/i;
11
- function Os({
12
- contentAnswers: a,
13
- createSessionRequest: Q,
11
+ function Ss({
12
+ contentAnswers: r,
13
+ createSessionRequest: p,
14
14
  dispatchStateUpdate: o,
15
15
  fetchTimeout: O,
16
- getAgentConfig: y,
16
+ getAgentConfig: S,
17
17
  getAnswerStreaming: k,
18
- getAnswer: G,
19
- getSuggestedQuestions: N,
18
+ getAnswer: A,
19
+ getSuggestedQuestions: d,
20
20
  isCitationsEnabled: us,
21
- isStreamingEnabled: T,
21
+ isStopResponseEnabled: G,
22
+ isStreamingEnabled: m,
22
23
  itemID: u,
23
24
  formatCitations: I = ns
24
25
  }) {
25
- const P = t.useRef(null), A = Y(), g = X((s) => Array.isArray(s) ? I(s) : null, [I]);
26
+ const j = t.useRef(null), g = z(), P = Y((s) => Array.isArray(s) ? I(s) : null, [I]);
26
27
  t.useEffect(
27
28
  (s) => {
28
- u && u !== a.item.id && o({
29
- type: B,
29
+ u && u !== r.item.id && o({
30
+ type: Z,
30
31
  itemID: u,
31
32
  fileVersionID: s
32
33
  });
@@ -34,121 +35,129 @@ function Os({
34
35
  // eslint-disable-next-line react-hooks/exhaustive-deps
35
36
  [u]
36
37
  );
37
- const R = t.useCallback((s, e) => {
38
+ const E = t.useCallback((s, e) => {
38
39
  o({
39
- type: Z,
40
+ type: h,
40
41
  newQuestion: s,
41
42
  session: e
42
- }), P.current = s;
43
+ }), j.current = s;
43
44
  }, [o]), M = t.useCallback((s) => {
44
45
  o({
45
- type: h,
46
+ type: w,
46
47
  error: s
47
48
  });
48
- }, [o]), S = t.useCallback((s, e, i) => {
49
+ }, [o]), N = t.useCallback((s, e, a) => {
49
50
  const {
50
- answer: r,
51
+ answer: i,
51
52
  error: l,
52
53
  citations: n = [],
53
- createdAt: E = null,
54
- encodedSession: f = void 0,
54
+ createdAt: f = null,
55
+ encodedSession: C = void 0,
55
56
  contextSession: c = void 0
56
- } = s, _ = e.set("citations", g(n)).merge({
57
- answer: r,
57
+ } = s, R = e.set("citations", P(n)).merge({
58
+ answer: i,
58
59
  error: l,
59
- created_at: E,
60
+ created_at: f,
60
61
  isLoading: !1,
61
- isCompleted: i
62
+ isCompleted: a
62
63
  });
63
- let C;
64
- f && (C = {
65
- encodedSession: f
66
- }), c && (C = {
64
+ let _;
65
+ C && (_ = {
66
+ encodedSession: C
67
+ }), c && (_ = {
67
68
  contextSession: c
68
- }), R(_, C);
69
- }, [R, g]), d = t.useCallback(
69
+ }), E(R, _);
70
+ }, [E, P]), y = t.useCallback(
70
71
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
72
  (s, e) => {
72
- var c, _, C;
73
- const i = (s == null ? void 0 : s.message) || "", r = ((c = s == null ? void 0 : s.response) == null ? void 0 : c.status) === 429 || is.test(i), l = ((_ = s == null ? void 0 : s.response) == null ? void 0 : _.status) === 204, n = ((C = s == null ? void 0 : s.response) == null ? void 0 : C.status) === 412, E = l ? m.NO_CONTENT : r ? m.RATE_LIMITING : n ? m.PRECONDITION_FAILED : m.GENERAL, f = e.merge({
74
- error: E,
73
+ var c, R, _;
74
+ const a = (s == null ? void 0 : s.message) || "", i = ((c = s == null ? void 0 : s.response) == null ? void 0 : c.status) === 429 || is.test(a), l = ((R = s == null ? void 0 : s.response) == null ? void 0 : R.status) === 204, n = ((_ = s == null ? void 0 : s.response) == null ? void 0 : _.status) === 412, f = l ? T.NO_CONTENT : i ? T.RATE_LIMITING : n ? T.PRECONDITION_FAILED : T.GENERAL, C = e.merge({
75
+ error: f,
75
76
  isLoading: !1,
76
77
  isCompleted: !0
77
78
  });
78
- R(f, void 0);
79
+ E(C, void 0);
79
80
  },
80
- [R]
81
+ [E]
81
82
  ), b = t.useCallback(async (s, e) => {
82
83
  try {
83
- const i = {
84
+ const a = {
84
85
  prompt: s.prompt,
85
86
  aiAgent: e || void 0
86
- }, r = `content-answers-${s.id}`;
87
+ }, i = `content-answers-${s.id}`;
87
88
  let l;
88
- T && (l = p.createAbortRequest(r));
89
- const n = await as(i, T, r, u, a, G, k, l, O);
90
- T ? n.ok && n.status === 200 ? p.receiveStreamedResponse(r, n, (E) => {
89
+ m && (l = Q.createAbortRequest(i));
90
+ const n = await rs(a, m, i, u, r, A, k, l, O);
91
+ m ? n.ok && n.status === 200 ? Q.receiveStreamedResponse(i, n, (f) => {
91
92
  const {
92
- data: f,
93
+ data: C,
93
94
  error: c,
94
- citations: _,
95
- contextSession: C,
96
- isCompleted: H,
97
- createdAt: J
98
- } = E;
99
- S({
95
+ citations: R,
96
+ contextSession: _,
97
+ isCompleted: J,
98
+ createdAt: K
99
+ } = f;
100
+ N({
100
101
  ...{
101
- answer: f,
102
- citations: _,
102
+ answer: C,
103
+ citations: R,
103
104
  error: c,
104
- contextSession: C,
105
- createdAt: J
105
+ contextSession: _,
106
+ createdAt: K
106
107
  }
107
- }, s, H);
108
- }, void 0, O) : d({
108
+ }, s, J);
109
+ }, void 0, O) : y({
109
110
  response: n
110
- }, s) : (Object.entries(n).forEach(([E, f]) => {
111
- const c = K(E);
112
- delete n[E], n[c] = f;
113
- }), S(n, s, !0));
114
- } catch (i) {
115
- d(i, s);
111
+ }, s) : (Object.entries(n).forEach(([f, C]) => {
112
+ const c = X(f);
113
+ delete n[f], n[c] = C;
114
+ }), N(n, s, !0));
115
+ } catch (a) {
116
+ if (G && a instanceof Error && a.name === "AbortError") {
117
+ const i = s.set("error", []).merge({
118
+ error: T.RESPONSE_STOPPED,
119
+ isLoading: !1,
120
+ isCompleted: !0
121
+ });
122
+ E(i);
123
+ } else
124
+ y(a, s);
116
125
  }
117
- }, [T, u, a, G, k, O, S, d]), L = t.useCallback((s, e, i = !0) => {
118
- const r = (a == null ? void 0 : a.questions) || [];
119
- i && (s.id = `${r.length}`);
120
- const l = new os(s);
121
- return R(l), b(l, e), l;
122
- }, [a == null ? void 0 : a.questions, b, R]), v = t.useCallback((s) => {
126
+ }, [m, u, r, A, k, O, N, y, G]), L = t.useCallback((s, e, a = !0) => {
127
+ const i = (r == null ? void 0 : r.questions) || [];
128
+ a && (s.id = `${i.length}`);
129
+ const l = new ts(s);
130
+ return E(l), b(l, e), l;
131
+ }, [r == null ? void 0 : r.questions, b, E]), v = t.useCallback((s) => {
123
132
  const {
124
133
  encoded_session: e,
125
134
  metadata: {
126
- is_large_file: i
135
+ is_large_file: a
127
136
  } = {
128
137
  is_large_file: !1
129
138
  }
130
139
  } = s;
131
140
  o({
132
- type: w,
141
+ type: U,
133
142
  encodedSession: e,
134
- isLargeFile: i
143
+ isLargeFile: a
135
144
  });
136
- }, [o]), j = t.useCallback(async () => {
145
+ }, [o]), x = t.useCallback(async () => {
137
146
  try {
138
147
  o({
139
- type: U,
148
+ type: ss,
140
149
  isLoading: !0
141
150
  });
142
- const s = await Q({
143
- items: [a.item]
151
+ const s = await p({
152
+ items: [r.item]
144
153
  }, u);
145
154
  v(s);
146
155
  } catch {
147
- M(z.GENERAL);
156
+ M(B.GENERAL);
148
157
  }
149
- }, [o, Q, a.item, u, v, M]), x = t.useCallback(() => {
158
+ }, [o, p, r.item, u, v, M]), D = t.useCallback(() => {
150
159
  o({
151
- type: ss
160
+ type: es
152
161
  });
153
162
  }, [o]), $ = t.useCallback(async (s, e) => {
154
163
  L({
@@ -158,29 +167,29 @@ function Os({
158
167
  isCompleted: !1,
159
168
  error: null
160
169
  }, e, !1);
161
- }, [L]), D = t.useCallback((s) => {
162
- p.abortRequest(`content-answers-${s.id}`, !0);
163
- }, []), V = t.useCallback(async (s) => {
164
- if (y)
170
+ }, [L]), V = t.useCallback((s) => {
171
+ Q.abortRequest(`content-answers-${s.id}`, !0);
172
+ }, []), W = t.useCallback(async (s) => {
173
+ if (S)
165
174
  try {
166
- const e = await y(s);
167
- A({
175
+ const e = await S(s);
176
+ g({
168
177
  type: "OVERRIDE_AGENT_CONFIG",
169
178
  agentName: s.name,
170
179
  agentConfig: e
171
180
  });
172
181
  } catch {
173
182
  }
174
- }, [A, y]), W = t.useCallback(async () => {
175
- if (N) {
183
+ }, [g, S]), H = t.useCallback(async () => {
184
+ if (d) {
176
185
  o({
177
186
  type: q,
178
187
  requestState: F.IN_PROGRESS
179
188
  });
180
189
  try {
181
- const s = ts(await N(u));
190
+ const s = as(await d(u));
182
191
  o({
183
- type: es,
192
+ type: os,
184
193
  suggestedQuestions: s
185
194
  });
186
195
  } catch {
@@ -190,19 +199,19 @@ function Os({
190
199
  });
191
200
  }
192
201
  }
193
- }, [o, N, u]);
202
+ }, [o, d, u]);
194
203
  return {
195
- clearConversation: x,
196
- createSession: j,
197
- fetchAgentConfig: V,
198
- fetchSuggestedQuestions: W,
204
+ clearConversation: D,
205
+ createSession: x,
206
+ fetchAgentConfig: W,
207
+ fetchSuggestedQuestions: H,
199
208
  retryQuestion: $,
200
209
  sendQuestion: L,
201
210
  sendQuestionAnswerRequest: b,
202
- stopQuestion: D,
203
- updateQuestionInState: R
211
+ stopQuestion: V,
212
+ updateQuestionInState: E
204
213
  };
205
214
  }
206
215
  export {
207
- Os as useContentAnswers
216
+ Ss as useContentAnswers
208
217
  };
@@ -1,50 +1,51 @@
1
1
  import "../../../../styles/footer-actions.css";
2
2
  import { Button as l } from "@box/blueprint-web";
3
- import { useRef as N, useCallback as p, useEffect as O } from "react";
4
- import { useIntl as w } from "react-intl";
3
+ import { useRef as O, useCallback as p, useEffect as w } from "react";
4
+ import { useIntl as y } from "react-intl";
5
5
  import { A as m } from "../../../../chunks/types.js";
6
6
  import { LOGGER_BASE_CONFIG as u, LOGGER_ACTION_CLICK as R } from "../common/constants.js";
7
7
  import d from "./messages.js";
8
- import { jsxs as y, jsx as E } from "react/jsx-runtime";
9
- const g = "_footerActions_poeou_1", k = "_footerActionButton_poeou_11", a = {
10
- footerActions: g,
11
- footerActionButton: k
12
- }, j = ({
13
- isStreamingEnabled: _ = !1,
8
+ import { jsxs as g, jsx as E } from "react/jsx-runtime";
9
+ const k = "_footerActions_poeou_1", v = "_footerActionButton_poeou_11", a = {
10
+ footerActions: k,
11
+ footerActionButton: v
12
+ }, z = ({
13
+ isStopResponseEnabled: _ = !1,
14
+ isStreamingEnabled: B = !1,
14
15
  lastQuestion: o,
15
16
  onRetryQuestion: s,
16
17
  onStopQuestion: c,
17
18
  recordAction: t
18
19
  }) => {
19
20
  const {
20
- answer: B,
21
+ answer: S,
21
22
  error: n,
22
- isCompleted: S
23
- } = o, e = s && n && n !== m.RESPONSE_STOPPED && n !== m.RESPONSE_INTERRUPTED, i = _ && !S && B, h = i || e, r = N(null), {
23
+ isCompleted: h
24
+ } = o, e = s && n && n !== m.RESPONSE_STOPPED && n !== m.RESPONSE_INTERRUPTED, i = B && !h && (_ || S), A = i || e, r = O(null), {
24
25
  formatMessage: f
25
- } = w(), A = p(() => {
26
+ } = y(), C = p(() => {
26
27
  t && t({
27
28
  ...u,
28
29
  action: R,
29
30
  target: "stopResponse"
30
31
  }), c(o);
31
- }, [o, c, t]), C = p(() => {
32
+ }, [o, c, t]), N = p(() => {
32
33
  t && t({
33
34
  ...u,
34
35
  action: R,
35
36
  target: "retryResponse"
36
37
  }), s(o);
37
38
  }, [o, s, t]);
38
- return O(() => {
39
+ return w(() => {
39
40
  e && r.current && r.current.focus();
40
- }, [e]), h ? /* @__PURE__ */ y("div", {
41
+ }, [e]), A ? /* @__PURE__ */ g("div", {
41
42
  className: a.footerActions,
42
43
  "data-testid": "content-answers-modal-footer-actions",
43
44
  children: [i && /* @__PURE__ */ E(l, {
44
45
  "aria-live": "polite",
45
46
  className: a.footerActionButton,
46
47
  "data-testid": "content-answers-stop-response-button",
47
- onClick: A,
48
+ onClick: C,
48
49
  size: "large",
49
50
  variant: "secondary",
50
51
  children: f(d.stopResponse)
@@ -53,7 +54,7 @@ const g = "_footerActions_poeou_1", k = "_footerActionButton_poeou_11", a = {
53
54
  "aria-live": "polite",
54
55
  className: a.footerActionButton,
55
56
  "data-testid": "content-answers-retry-response-button",
56
- onClick: C,
57
+ onClick: N,
57
58
  size: "large",
58
59
  variant: "secondary",
59
60
  children: f(d.retryResponse)
@@ -61,5 +62,5 @@ const g = "_footerActions_poeou_1", k = "_footerActionButton_poeou_11", a = {
61
62
  }) : null;
62
63
  };
63
64
  export {
64
- j as FooterActions
65
+ z as FooterActions
65
66
  };