@box/box-ai-content-answers 0.118.0 → 0.119.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 (76) hide show
  1. package/dist/esm/lib/box-ai-content-answers.js +74 -81
  2. package/dist/esm/lib/components/api-wrapper/api-wrapper.js +1 -1
  3. package/dist/esm/lib/components/api-wrapper/content-answers-component.js +89 -91
  4. package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +109 -116
  5. package/dist/esm/lib/components/common/agentUtils.js +6 -6
  6. package/dist/esm/lib/components/footer/footer.js +88 -92
  7. package/dist/esm/lib/components/modal/modal.js +118 -115
  8. package/dist/i18n/bn-IN.js +0 -2
  9. package/dist/i18n/bn-IN.properties +0 -4
  10. package/dist/i18n/da-DK.js +0 -2
  11. package/dist/i18n/da-DK.properties +0 -4
  12. package/dist/i18n/de-DE.js +0 -2
  13. package/dist/i18n/de-DE.properties +0 -4
  14. package/dist/i18n/en-AU.js +0 -2
  15. package/dist/i18n/en-AU.properties +1 -4
  16. package/dist/i18n/en-CA.js +0 -2
  17. package/dist/i18n/en-CA.properties +0 -4
  18. package/dist/i18n/en-GB.js +0 -2
  19. package/dist/i18n/en-GB.properties +2 -4
  20. package/dist/i18n/en-US.js +0 -2
  21. package/dist/i18n/en-US.properties +0 -4
  22. package/dist/i18n/en-x-pseudo.js +1 -3
  23. package/dist/i18n/en-x-pseudo.properties +1 -5
  24. package/dist/i18n/es-419.js +0 -2
  25. package/dist/i18n/es-419.properties +0 -4
  26. package/dist/i18n/es-ES.js +0 -2
  27. package/dist/i18n/es-ES.properties +0 -4
  28. package/dist/i18n/fi-FI.js +0 -2
  29. package/dist/i18n/fi-FI.properties +0 -4
  30. package/dist/i18n/fr-CA.js +0 -2
  31. package/dist/i18n/fr-CA.properties +0 -4
  32. package/dist/i18n/fr-FR.js +0 -2
  33. package/dist/i18n/fr-FR.properties +0 -4
  34. package/dist/i18n/hi-IN.js +0 -2
  35. package/dist/i18n/hi-IN.properties +0 -4
  36. package/dist/i18n/it-IT.js +0 -2
  37. package/dist/i18n/it-IT.properties +0 -4
  38. package/dist/i18n/ja-JP.js +0 -2
  39. package/dist/i18n/ja-JP.properties +0 -4
  40. package/dist/i18n/ko-KR.js +0 -2
  41. package/dist/i18n/ko-KR.properties +0 -4
  42. package/dist/i18n/nb-NO.js +0 -2
  43. package/dist/i18n/nb-NO.properties +0 -4
  44. package/dist/i18n/nl-NL.js +0 -2
  45. package/dist/i18n/nl-NL.properties +0 -4
  46. package/dist/i18n/pl-PL.js +0 -2
  47. package/dist/i18n/pl-PL.properties +0 -4
  48. package/dist/i18n/pt-BR.js +0 -2
  49. package/dist/i18n/pt-BR.properties +0 -4
  50. package/dist/i18n/ru-RU.js +0 -2
  51. package/dist/i18n/ru-RU.properties +0 -4
  52. package/dist/i18n/sv-SE.js +0 -2
  53. package/dist/i18n/sv-SE.properties +0 -4
  54. package/dist/i18n/tr-TR.js +0 -2
  55. package/dist/i18n/tr-TR.properties +0 -4
  56. package/dist/i18n/zh-CN.js +0 -2
  57. package/dist/i18n/zh-CN.properties +0 -4
  58. package/dist/i18n/zh-TW.js +0 -2
  59. package/dist/i18n/zh-TW.properties +0 -4
  60. package/dist/types/lib/components/api-wrapper/hooks/useContentAnswers.d.ts +3 -2
  61. package/dist/types/lib/components/common/agentUtils.d.ts +1 -1
  62. package/dist/types/lib/components/footer/footer.d.ts +1 -7
  63. package/dist/types/lib/components/modal/modal.d.ts +0 -6
  64. package/package.json +4 -4
  65. package/dist/esm/lib/components/agents/agent-editor.js +0 -55
  66. package/dist/esm/lib/components/agents/agent-selector.js +0 -84
  67. package/dist/esm/lib/components/agents/messages.js +0 -14
  68. package/dist/esm/lib/contexts/AgentsContext.js +0 -59
  69. package/dist/i18n/json/src/lib/components/agents/messages.json +0 -1
  70. package/dist/styles/agent-editor.css +0 -1
  71. package/dist/styles/agent-selector.css +0 -1
  72. package/dist/types/lib/components/agents/agent-editor.d.ts +0 -8
  73. package/dist/types/lib/components/agents/agent-selector.d.ts +0 -6
  74. package/dist/types/lib/components/agents/messages.d.ts +0 -13
  75. package/dist/types/lib/components/agents/stories/shared.d.ts +0 -12
  76. package/dist/types/lib/contexts/AgentsContext.d.ts +0 -15
@@ -1,99 +1,92 @@
1
- import _ from "clsx";
2
- import * as n from "react";
3
- import { AgentEditor as K } from "./components/agents/agent-editor.js";
4
- import { C as V } from "../../chunks/types.js";
5
- import { jsx as i, jsxs as W } from "react/jsx-runtime";
6
- import { Content as X } from "./components/content/content.js";
7
- import { Footer as Y } from "./components/footer/footer.js";
8
- import '../../styles/box-ai-content-answers.css';const Z = "_container_1p5tb_1", $ = "_contentAnswers_1p5tb_8", v = "_sidebar_1p5tb_19", d = {
9
- container: Z,
10
- contentAnswers: $,
11
- sidebar: v
12
- }, te = ({
13
- className: h,
14
- contentType: Q,
15
- contentName: A,
1
+ import p from "clsx";
2
+ import * as s from "react";
3
+ import { C as H } from "../../chunks/types.js";
4
+ import { jsx as u, jsxs as J } from "react/jsx-runtime";
5
+ import { Content as K } from "./components/content/content.js";
6
+ import { Footer as V } from "./components/footer/footer.js";
7
+ import '../../styles/box-ai-content-answers.css';const W = "_container_1p5tb_1", X = "_contentAnswers_1p5tb_8", Y = "_sidebar_1p5tb_19", a = {
8
+ container: W,
9
+ contentAnswers: X,
10
+ sidebar: Y
11
+ }, I = ({
12
+ className: _,
13
+ contentType: h,
14
+ contentName: Q,
16
15
  error: t,
17
16
  hasCustomSuggestedQuestions: w,
18
- hasRequestInProgress: l,
19
- isAgentSelectorEnabled: E,
20
- isAIStudioAgentSelectorEnabled: M,
21
- isDebugModeEnabled: R,
22
- isStopResponseEnabled: x,
23
- isStreamingEnabled: c,
24
- questions: r,
25
- recordAction: g,
26
- retryQuestion: C,
27
- showLoadingIndicator: m,
28
- stopQuestion: F,
29
- submitQuestion: D,
30
- suggestedQuestions: N,
31
- useAnimation: k,
32
- onAgentEditorToggle: j,
17
+ hasRequestInProgress: d,
18
+ isAIStudioAgentSelectorEnabled: A,
19
+ isDebugModeEnabled: E,
20
+ isStopResponseEnabled: M,
21
+ isStreamingEnabled: n,
22
+ questions: i,
23
+ recordAction: l,
24
+ retryQuestion: R,
25
+ showLoadingIndicator: g,
26
+ stopQuestion: x,
27
+ submitQuestion: C,
28
+ suggestedQuestions: F,
29
+ useAnimation: D,
30
+ onAgentEditorToggle: Z,
33
31
  onUserIntentToUseAI: e,
34
32
  variant: o = "modal",
35
- hostAppName: y,
36
- ...O
33
+ hostAppName: N,
34
+ ...k
37
35
  }) => {
38
- const [f, p] = n.useState(null), [S, z] = n.useState(t != null), [s, b] = n.useState(!1), B = t === V.LARGE_FILE, G = (!S || B) && !m, u = (a) => {
39
- g && g({
40
- ...a,
36
+ const [f, m] = s.useState(null), [S, j] = s.useState(t != null), [c, y] = s.useState(!1), O = t === H.LARGE_FILE, z = (!S || O) && !g, b = (r) => {
37
+ l && l({
38
+ ...r,
41
39
  component: o
42
40
  });
43
- }, L = () => {
41
+ }, B = () => {
44
42
  e && e(!1);
45
- }, H = (a) => {
46
- p(a), e && e(!0);
47
- }, J = () => {
43
+ }, G = (r) => {
44
+ m(r), e && e(!0);
45
+ }, L = () => {
48
46
  e && e(!0);
49
47
  };
50
- return n.useEffect(() => {
51
- z(t != null);
52
- }, [t]), /* @__PURE__ */ i("div", {
53
- className: _(h, d.container),
54
- children: /* @__PURE__ */ W("div", {
55
- className: _(d.contentAnswers, o === "sidebar" && d.sidebar),
56
- children: [!s && /* @__PURE__ */ i(X, {
57
- ...O,
48
+ return s.useEffect(() => {
49
+ j(t != null);
50
+ }, [t]), /* @__PURE__ */ u("div", {
51
+ className: p(_, a.container),
52
+ children: /* @__PURE__ */ J("div", {
53
+ className: p(a.contentAnswers, o === "sidebar" && a.sidebar),
54
+ children: [!c && /* @__PURE__ */ u(K, {
55
+ ...k,
58
56
  askSuggestedQuestion: f,
59
- contentName: A,
60
- contentType: Q,
57
+ contentName: Q,
58
+ contentType: h,
61
59
  error: t,
62
60
  hasCustomSuggestedQuestions: w,
63
- hasRequestInProgress: l,
64
- hostAppName: y,
61
+ hasRequestInProgress: d,
62
+ hostAppName: N,
65
63
  isErrorMessageShown: S,
66
- isStreamingEnabled: c,
67
- onSuggestedQuestionInteraction: L,
68
- questions: r,
69
- recordAction: u,
70
- setAskSuggestedQuestion: H,
71
- showLoadingIndicator: m,
72
- suggestedQuestions: N,
73
- useAnimation: c && k,
64
+ isStreamingEnabled: n,
65
+ onSuggestedQuestionInteraction: B,
66
+ questions: i,
67
+ recordAction: b,
68
+ setAskSuggestedQuestion: G,
69
+ showLoadingIndicator: g,
70
+ suggestedQuestions: F,
71
+ useAnimation: n && D,
74
72
  variant: o
75
- }), s && /* @__PURE__ */ i(K, {
76
- onAgentEditorToggle: j,
77
- recordAction: u,
78
- setIsDebugModeShown: b
79
- }), G && /* @__PURE__ */ i(Y, {
73
+ }), z && /* @__PURE__ */ u(V, {
80
74
  askSuggestedQuestion: f,
81
- enableDebugMode: R,
82
- hasRequestInProgress: l,
83
- isAgentSelectorEnabled: E,
84
- isAIStudioAgentSelectorEnabled: M,
85
- isDebugModeShown: s,
86
- isStopResponseEnabled: x,
87
- isStreamingEnabled: c,
88
- lastQuestion: r[r.length - 1],
89
- onRetryQuestion: C,
90
- onStopQuestion: F,
91
- onUserInteraction: J,
92
- recordAction: u,
93
- sendQuestion: D,
94
- setAskSuggestedQuestion: p,
75
+ enableDebugMode: E,
76
+ hasRequestInProgress: d,
77
+ isAIStudioAgentSelectorEnabled: A,
78
+ isDebugModeShown: c,
79
+ isStopResponseEnabled: M,
80
+ isStreamingEnabled: n,
81
+ lastQuestion: i[i.length - 1],
82
+ onRetryQuestion: R,
83
+ onStopQuestion: x,
84
+ onUserInteraction: L,
85
+ recordAction: b,
86
+ sendQuestion: C,
87
+ setAskSuggestedQuestion: m,
95
88
  toggleDebugMode: () => {
96
- b(!s);
89
+ y(!c);
97
90
  },
98
91
  variant: o
99
92
  })]
@@ -101,6 +94,6 @@ import '../../styles/box-ai-content-answers.css';const Z = "_container_1p5tb_1",
101
94
  });
102
95
  };
103
96
  export {
104
- te as BoxAiContentAnswers,
105
- te as default
97
+ I as BoxAiContentAnswers,
98
+ I as default
106
99
  };
@@ -1,4 +1,4 @@
1
- import { AgentsProvider as e } from "../../contexts/AgentsContext.js";
1
+ import { AgentsProvider as e } from "@box/box-ai-agent-selector";
2
2
  import { ContentAnswersComponent as n } from "./content-answers-component.js";
3
3
  import { jsx as r } from "react/jsx-runtime";
4
4
  const s = (t) => (o) => /* @__PURE__ */ r(e, {
@@ -1,10 +1,10 @@
1
- import { useReducer as ie, useEffect as re } from "react";
1
+ import { useReducer as oe, useEffect as ie } from "react";
2
2
  import { R as m } from "../../../../chunks/types.js";
3
- import { useContentAnswers as de } from "./hooks/useContentAnswers.js";
4
- import { ContentAnswersRecord as ae, ContentAnswersItemRecord as ge } from "./records.js";
3
+ import { useContentAnswers as re } from "./hooks/useContentAnswers.js";
4
+ import { ContentAnswersRecord as de, ContentAnswersItemRecord as ae } from "./records.js";
5
5
  import ue from "./reducer.js";
6
- import { jsx as ce } from "react/jsx-runtime";
7
- const we = (t) => {
6
+ import { jsx as ge } from "react/jsx-runtime";
7
+ const pe = (t) => {
8
8
  const {
9
9
  WrappedComponent: f,
10
10
  cachedSuggestedQuestions: r = [],
@@ -13,127 +13,125 @@ const we = (t) => {
13
13
  formatCitations: C,
14
14
  getAIStudioAgents: p,
15
15
  getAgentConfig: w,
16
- getAnswer: E,
17
- getAnswerStreaming: Q,
16
+ getAnswer: Q,
17
+ getAnswerStreaming: E,
18
18
  getSuggestedQuestions: s,
19
- hostAppName: b,
20
- isAIStudioAgentSelectorEnabled: R,
21
- isAgentSelectorEnabled: q,
19
+ hostAppName: R,
20
+ isAIStudioAgentSelectorEnabled: b,
22
21
  isCitationsEnabled: d,
23
- isDebugModeEnabled: T,
24
- isMarkdownEnabled: I,
22
+ isDebugModeEnabled: q,
23
+ isMarkdownEnabled: T,
25
24
  isOpen: n,
26
- isResetChatEnabled: L,
27
- isStopResponseEnabled: P,
25
+ isResetChatEnabled: I,
26
+ isStopResponseEnabled: L,
28
27
  isStreamingEnabled: a,
29
28
  itemID: o,
30
- items: g,
31
- onCitationClick: k,
32
- onCloseModal: D,
33
- onItemClick: N,
34
- onSuggestedQuestionsFetched: O,
35
- parentItem: j,
36
- restoredQuestions: v = [],
37
- restoredSession: M = null,
38
- restoredShouldShowLandingPage: U = !0,
39
- sendErrorLog: _,
40
- shouldRenderProviders: x = !0,
41
- suggestedQuestions: F,
42
- warningNotice: y,
43
- warningNoticeAriaLabel: W
44
- } = t, [u, z] = ie(ue, new ae({
45
- item: new ge({
29
+ items: u,
30
+ onCitationClick: P,
31
+ onCloseModal: k,
32
+ onItemClick: D,
33
+ onSuggestedQuestionsFetched: N,
34
+ parentItem: O,
35
+ restoredQuestions: j = [],
36
+ restoredSession: v = null,
37
+ restoredShouldShowLandingPage: M = !0,
38
+ sendErrorLog: U,
39
+ shouldRenderProviders: _ = !0,
40
+ suggestedQuestions: x,
41
+ warningNotice: F,
42
+ warningNoticeAriaLabel: y
43
+ } = t, [g, W] = oe(ue, new de({
44
+ item: new ae({
46
45
  id: o
47
46
  }),
48
- questions: v,
49
- encodedSession: M,
50
- shouldShowLandingPage: U
47
+ questions: j,
48
+ encodedSession: v,
49
+ shouldShowLandingPage: M
51
50
  })), {
52
- clearConversation: B,
53
- createSession: G,
51
+ clearConversation: z,
52
+ createSession: B,
54
53
  fetchAgentConfig: c,
55
54
  fetchSuggestedQuestions: S,
56
- retryQuestion: H,
57
- sendQuestion: J,
58
- setAnswerFeedback: K,
59
- stopQuestion: V
60
- } = de({
61
- contentAnswers: u,
55
+ retryQuestion: G,
56
+ sendQuestion: H,
57
+ setAnswerFeedback: J,
58
+ stopQuestion: K
59
+ } = re({
60
+ contentAnswers: g,
62
61
  createSessionRequest: A,
63
- dispatchStateUpdate: z,
62
+ dispatchStateUpdate: W,
64
63
  fetchTimeout: h,
65
64
  formatCitations: C,
66
65
  getAgentConfig: w,
67
- getAnswerStreaming: Q,
68
- getAnswer: E,
66
+ getAnswerStreaming: E,
67
+ getAnswer: Q,
69
68
  getSuggestedQuestions: s,
70
69
  isCitationsEnabled: d,
71
- isStopResponseEnabled: P,
70
+ isStopResponseEnabled: L,
72
71
  isStreamingEnabled: a,
73
72
  itemID: o,
74
- items: g,
75
- onSuggestedQuestionsFetched: O,
76
- sendErrorLog: _,
73
+ items: u,
74
+ onSuggestedQuestionsFetched: N,
75
+ sendErrorLog: U,
77
76
  ...t
78
77
  }), {
79
- encodedSession: X,
80
- error: Y,
81
- isLoading: Z,
82
- hasRequestInProgress: $ = !1,
83
- questions: ee,
84
- shouldShowLandingPage: te,
78
+ encodedSession: V,
79
+ error: X,
80
+ isLoading: Y,
81
+ hasRequestInProgress: Z = !1,
82
+ questions: $,
83
+ shouldShowLandingPage: ee,
85
84
  suggestedQuestions: e
86
- } = u;
87
- re(() => {
85
+ } = g;
86
+ ie(() => {
88
87
  n && e.requestState === m.NOT_STARTED && S();
89
88
  }, [n, S, e.requestState]);
90
- const se = r.length > 0;
91
- let i = F, l = m.SUCCESS;
92
- se ? i = r : s && (i = e.suggestions, l = e.requestState);
93
- const ne = Object.fromEntries(Object.entries({
94
- createSession: G,
95
- encodedSession: X,
96
- error: Y,
89
+ const te = r.length > 0;
90
+ let i = x, l = m.SUCCESS;
91
+ te ? i = r : s && (i = e.suggestions, l = e.requestState);
92
+ const se = Object.fromEntries(Object.entries({
93
+ createSession: B,
94
+ encodedSession: V,
95
+ error: X,
97
96
  getAIStudioAgents: p,
98
- hostAppName: b,
97
+ hostAppName: R,
99
98
  hasCustomSuggestedQuestions: !!s,
100
- hasRequestInProgress: $,
101
- isAgentSelectorEnabled: q,
102
- isAIStudioAgentSelectorEnabled: R,
99
+ hasRequestInProgress: Z,
100
+ isAIStudioAgentSelectorEnabled: b,
103
101
  isCitationsEnabled: d,
104
- isDebugModeEnabled: T,
105
- isMarkdownEnabled: I,
106
- isLoading: Z,
102
+ isDebugModeEnabled: q,
103
+ isMarkdownEnabled: T,
104
+ isLoading: Y,
107
105
  isOpen: n,
108
- isResetChatEnabled: L,
106
+ isResetChatEnabled: I,
109
107
  isStreamingEnabled: a,
110
108
  itemID: o,
111
- items: g,
112
- onClearAction: B,
113
- onCloseModal: D,
114
- onCitationClick: k,
115
- onItemClick: N,
109
+ items: u,
110
+ onClearAction: z,
111
+ onCloseModal: k,
112
+ onCitationClick: P,
113
+ onItemClick: D,
116
114
  onSelectAgent: c,
117
115
  onAgentEditorToggle: c,
118
- parentItem: j,
119
- questions: ee,
120
- retryQuestion: H,
121
- sendQuestion: J,
122
- setAnswerFeedback: K,
123
- shouldRenderProviders: x,
124
- shouldShowLandingPage: te,
125
- stopQuestion: V,
116
+ parentItem: O,
117
+ questions: $,
118
+ retryQuestion: G,
119
+ sendQuestion: H,
120
+ setAnswerFeedback: J,
121
+ shouldRenderProviders: _,
122
+ shouldShowLandingPage: ee,
123
+ stopQuestion: K,
126
124
  suggestedQuestionsRequestState: l,
127
125
  suggestedQuestions: i,
128
- warningNotice: y,
129
- warningNoticeAriaLabel: W
130
- }).filter(([le, oe]) => oe !== void 0));
131
- return /* @__PURE__ */ ce(f, {
126
+ warningNotice: F,
127
+ warningNoticeAriaLabel: y
128
+ }).filter(([Se, ne]) => ne !== void 0));
129
+ return /* @__PURE__ */ ge(f, {
132
130
  ...t,
133
- ...ne
131
+ ...se
134
132
  });
135
133
  };
136
134
  export {
137
- we as ContentAnswersComponent,
138
- we as default
135
+ pe as ContentAnswersComponent,
136
+ pe as default
139
137
  };