@box/box-ai-content-answers 0.103.0 → 0.105.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 (64) hide show
  1. package/esm/lib/box-ai-content-answers.js +79 -74
  2. package/esm/lib/components/answer/inline-error.js +57 -69
  3. package/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +128 -119
  4. package/esm/lib/components/chat/chat.js +63 -60
  5. package/esm/lib/components/footer/footer-actions.js +26 -22
  6. package/esm/lib/components/footer/footer.js +74 -70
  7. package/esm/lib/components/suggested-questions/suggested-questions.js +32 -30
  8. package/esm/lib/components/suggested-questions/suggestions.js +31 -27
  9. package/i18n/bn-IN.js +2 -2
  10. package/i18n/bn-IN.properties +2 -2
  11. package/i18n/da-DK.js +2 -2
  12. package/i18n/da-DK.properties +2 -2
  13. package/i18n/de-DE.js +2 -2
  14. package/i18n/de-DE.properties +2 -2
  15. package/i18n/en-AU.js +2 -2
  16. package/i18n/en-AU.properties +2 -2
  17. package/i18n/en-GB.js +2 -2
  18. package/i18n/en-GB.properties +2 -2
  19. package/i18n/es-419.js +2 -2
  20. package/i18n/es-419.properties +2 -2
  21. package/i18n/es-ES.js +2 -2
  22. package/i18n/es-ES.properties +2 -2
  23. package/i18n/fi-FI.js +2 -2
  24. package/i18n/fi-FI.properties +2 -2
  25. package/i18n/fr-CA.js +2 -2
  26. package/i18n/fr-CA.properties +2 -2
  27. package/i18n/fr-FR.js +2 -2
  28. package/i18n/fr-FR.properties +2 -2
  29. package/i18n/hi-IN.js +2 -2
  30. package/i18n/hi-IN.properties +2 -2
  31. package/i18n/it-IT.js +2 -2
  32. package/i18n/it-IT.properties +2 -2
  33. package/i18n/ja-JP.js +2 -2
  34. package/i18n/ja-JP.properties +2 -2
  35. package/i18n/ko-KR.js +2 -2
  36. package/i18n/ko-KR.properties +2 -2
  37. package/i18n/nb-NO.js +2 -2
  38. package/i18n/nb-NO.properties +2 -2
  39. package/i18n/nl-NL.js +2 -2
  40. package/i18n/nl-NL.properties +2 -2
  41. package/i18n/pl-PL.js +2 -2
  42. package/i18n/pl-PL.properties +2 -2
  43. package/i18n/pt-BR.js +2 -2
  44. package/i18n/pt-BR.properties +2 -2
  45. package/i18n/ru-RU.js +2 -2
  46. package/i18n/ru-RU.properties +2 -2
  47. package/i18n/sv-SE.js +2 -2
  48. package/i18n/sv-SE.properties +2 -2
  49. package/i18n/tr-TR.js +2 -2
  50. package/i18n/tr-TR.properties +2 -2
  51. package/i18n/zh-CN.js +2 -2
  52. package/i18n/zh-CN.properties +2 -2
  53. package/i18n/zh-TW.js +2 -2
  54. package/i18n/zh-TW.properties +2 -2
  55. package/package.json +3 -3
  56. package/types/lib/box-ai-content-answers.d.ts +6 -4
  57. package/types/lib/components/api-wrapper/hooks/useContentAnswers.d.ts +1 -1
  58. package/types/lib/components/api-wrapper/types.d.ts +1 -0
  59. package/types/lib/components/chat/chat.d.ts +1 -1
  60. package/types/lib/components/footer/footer-actions.d.ts +2 -1
  61. package/types/lib/components/footer/footer.d.ts +3 -1
  62. package/types/lib/components/suggested-questions/suggested-questions.d.ts +3 -1
  63. package/types/lib/components/suggested-questions/suggestions.d.ts +3 -1
  64. package/types/lib/types.d.ts +4 -0
@@ -1,97 +1,102 @@
1
- import w from "clsx";
2
- import * as s from "react";
3
- import { AgentEditor as B } from "./components/agents/agent-editor.js";
4
- import { Content as G } from "./components/content/content.js";
5
- import { Footer as I } from "./components/footer/footer.js";
6
- import { C as L } from "../../chunks/types.js";
7
- import { jsx as n, jsxs as H } from "react/jsx-runtime";
8
- import '../../styles/box-ai-content-answers.css';const J = "_container_xgwyz_1", K = "_contentAnswers_xgwyz_8", U = "_sidebar_xgwyz_19", d = {
9
- container: J,
10
- contentAnswers: K,
11
- sidebar: U
12
- }, v = ({
13
- className: _,
14
- contentType: p,
15
- contentName: b,
1
+ import p from "clsx";
2
+ import * as n from "react";
3
+ import { AgentEditor as L } from "./components/agents/agent-editor.js";
4
+ import { Content as T } from "./components/content/content.js";
5
+ import { Footer as H } from "./components/footer/footer.js";
6
+ import { C as J } from "../../chunks/types.js";
7
+ import { jsx as s, jsxs as K } from "react/jsx-runtime";
8
+ import '../../styles/box-ai-content-answers.css';const U = "_container_xgwyz_1", V = "_contentAnswers_xgwyz_8", W = "_sidebar_xgwyz_19", a = {
9
+ container: U,
10
+ contentAnswers: V,
11
+ sidebar: W
12
+ }, q = ({
13
+ className: S,
14
+ contentType: b,
15
+ contentName: x,
16
16
  error: e,
17
- hasCustomSuggestedQuestions: S,
18
- hasRequestInProgress: l,
19
- isAgentSelectorEnabled: x,
20
- isAIStudioAgentSelectorEnabled: E,
21
- isDebugModeEnabled: h,
22
- isStopResponseEnabled: M,
17
+ hasCustomSuggestedQuestions: E,
18
+ hasRequestInProgress: d,
19
+ isAgentSelectorEnabled: h,
20
+ isAIStudioAgentSelectorEnabled: Q,
21
+ isDebugModeEnabled: M,
22
+ isStopResponseEnabled: R,
23
23
  isStreamingEnabled: c,
24
24
  questions: r,
25
- recordAction: u,
26
- retryQuestion: Q,
27
- showLoadingIndicator: a,
28
- stopQuestion: R,
29
- submitQuestion: y,
30
- suggestedQuestions: z,
31
- useAnimation: C,
32
- onAgentEditorToggle: D,
33
- variant: o = "modal",
34
- hostAppName: F,
35
- ...N
25
+ recordAction: l,
26
+ retryQuestion: y,
27
+ showLoadingIndicator: u,
28
+ stopQuestion: z,
29
+ submitQuestion: C,
30
+ suggestedQuestions: D,
31
+ useAnimation: F,
32
+ onAgentEditorToggle: N,
33
+ onUserIntentToUseAI: m,
34
+ variant: t = "modal",
35
+ hostAppName: j,
36
+ ...k
36
37
  }) => {
37
- const [m, g] = s.useState(null), [A, j] = s.useState(e != null), [t, f] = s.useState(!1), k = e === L.LARGE_FILE, O = (!A || k) && !a, i = (T) => {
38
- u && u({
39
- ...T,
40
- component: o
38
+ const [g, f] = n.useState(null), [A, I] = n.useState(e != null), [o, w] = n.useState(!1), O = e === J.LARGE_FILE, B = (!A || O) && !u, i = (G) => {
39
+ l && l({
40
+ ...G,
41
+ component: t
41
42
  });
43
+ }, _ = () => {
44
+ m && m();
42
45
  };
43
- return s.useEffect(() => {
44
- j(e != null);
45
- }, [e]), /* @__PURE__ */ n("div", {
46
- className: w(_, d.container),
47
- children: /* @__PURE__ */ H("div", {
48
- className: w(d.contentAnswers, o === "sidebar" && d.sidebar),
49
- children: [!t && /* @__PURE__ */ n(G, {
50
- ...N,
51
- askSuggestedQuestion: m,
52
- contentName: b,
53
- contentType: p,
46
+ return n.useEffect(() => {
47
+ I(e != null);
48
+ }, [e]), /* @__PURE__ */ s("div", {
49
+ className: p(S, a.container),
50
+ children: /* @__PURE__ */ K("div", {
51
+ className: p(a.contentAnswers, t === "sidebar" && a.sidebar),
52
+ children: [!o && /* @__PURE__ */ s(T, {
53
+ ...k,
54
+ askSuggestedQuestion: g,
55
+ contentName: x,
56
+ contentType: b,
54
57
  error: e,
55
- hasCustomSuggestedQuestions: S,
56
- hasRequestInProgress: l,
57
- hostAppName: F,
58
+ hasCustomSuggestedQuestions: E,
59
+ hasRequestInProgress: d,
60
+ hostAppName: j,
58
61
  isErrorMessageShown: A,
59
62
  isStreamingEnabled: c,
63
+ onSuggestedQuestionInteraction: _,
60
64
  questions: r,
61
65
  recordAction: i,
62
- setAskSuggestedQuestion: g,
63
- showLoadingIndicator: a,
64
- suggestedQuestions: z,
65
- useAnimation: c && C,
66
- variant: o
67
- }), t && /* @__PURE__ */ n(B, {
68
- onAgentEditorToggle: D,
66
+ setAskSuggestedQuestion: f,
67
+ showLoadingIndicator: u,
68
+ suggestedQuestions: D,
69
+ useAnimation: c && F,
70
+ variant: t
71
+ }), o && /* @__PURE__ */ s(L, {
72
+ onAgentEditorToggle: N,
69
73
  recordAction: i,
70
- setIsDebugModeShown: f
71
- }), O && /* @__PURE__ */ n(I, {
72
- askSuggestedQuestion: m,
73
- enableDebugMode: h,
74
- hasRequestInProgress: l,
75
- isAgentSelectorEnabled: x,
76
- isAIStudioAgentSelectorEnabled: E,
77
- isDebugModeShown: t,
78
- isStopResponseEnabled: M,
74
+ setIsDebugModeShown: w
75
+ }), B && /* @__PURE__ */ s(H, {
76
+ askSuggestedQuestion: g,
77
+ enableDebugMode: M,
78
+ hasRequestInProgress: d,
79
+ isAgentSelectorEnabled: h,
80
+ isAIStudioAgentSelectorEnabled: Q,
81
+ isDebugModeShown: o,
82
+ isStopResponseEnabled: R,
79
83
  isStreamingEnabled: c,
80
84
  lastQuestion: r[r.length - 1],
81
- onRetryQuestion: Q,
82
- onStopQuestion: R,
85
+ onRetryQuestion: y,
86
+ onStopQuestion: z,
87
+ onUserInteraction: _,
83
88
  recordAction: i,
84
- sendQuestion: y,
85
- setAskSuggestedQuestion: g,
89
+ sendQuestion: C,
90
+ setAskSuggestedQuestion: f,
86
91
  toggleDebugMode: () => {
87
- f(!t);
92
+ w(!o);
88
93
  },
89
- variant: o
94
+ variant: t
90
95
  })]
91
96
  })
92
97
  });
93
98
  };
94
99
  export {
95
- v as BoxAiContentAnswers,
96
- v as default
100
+ q as BoxAiContentAnswers,
101
+ q as default
97
102
  };
@@ -1,87 +1,75 @@
1
- import { useBreakpoint as N, Breakpoint as h, Text as u } from "@box/blueprint-web";
2
- import { AlertTriangle as x } from "@box/blueprint-web-assets/icons/Line";
3
- import { BoxAiLogo as g } from "@box/blueprint-web-assets/icons/Logo";
4
- import { Size5 as l, Size6 as S } from "@box/blueprint-web-assets/tokens/tokens";
5
- import * as E from "react";
6
- import { useIntl as T } from "react-intl";
7
- import { A as t } from "../../../../chunks/types.js";
8
- import { LOGGER_BASE_CONFIG as A } from "../common/constants.js";
9
- import { MediaContainer as c } from "../common/media-container.js";
10
- import i from "./messages.js";
11
- import { jsx as r, jsxs as _ } from "react/jsx-runtime";
12
- import '../../../../styles/inline-error.css';const I = "_inlineError_ft07o_1", v = "_text_ft07o_4", O = "_icon_ft07o_14", R = "_iconAvatar_ft07o_18", n = {
13
- inlineError: I,
14
- text: v,
15
- icon: O,
16
- iconAvatar: R
17
- }, U = ({
18
- error: o,
19
- contentType: d,
20
- variant: a = "modal",
21
- recordAction: s
1
+ import { Text as _ } from "@box/blueprint-web";
2
+ import { AlertTriangle as N } from "@box/blueprint-web-assets/icons/Line";
3
+ import { Size5 as c } from "@box/blueprint-web-assets/tokens/tokens";
4
+ import * as m from "react";
5
+ import { useIntl as p } from "react-intl";
6
+ import { A as i } from "../../../../chunks/types.js";
7
+ import { LOGGER_BASE_CONFIG as u } from "../common/constants.js";
8
+ import { MediaContainer as d } from "../common/media-container.js";
9
+ import e from "./messages.js";
10
+ import { jsx as t, jsxs as x } from "react/jsx-runtime";
11
+ import '../../../../styles/inline-error.css';const T = "_inlineError_ft07o_1", h = "_text_ft07o_4", A = "_icon_ft07o_14", I = "_iconAvatar_ft07o_18", s = {
12
+ inlineError: T,
13
+ text: h,
14
+ icon: A,
15
+ iconAvatar: I
16
+ }, L = ({
17
+ error: n,
18
+ contentType: a,
19
+ variant: l = "modal",
20
+ recordAction: o
22
21
  }) => {
23
- const m = a === "sidebar", {
24
- formatMessage: e
25
- } = T();
26
- E.useEffect(() => {
27
- s && s({
28
- ...A,
22
+ const E = l === "sidebar", {
23
+ formatMessage: r
24
+ } = p();
25
+ m.useEffect(() => {
26
+ o && o({
27
+ ...u,
29
28
  target: "inlineError"
30
29
  });
31
- }, [s]);
32
- const p = E.useCallback(() => {
33
- switch (o) {
34
- case t.RATE_LIMITING:
35
- return e(i.inlineRateLimitingErrorText);
36
- case t.NO_CONTENT:
37
- return e(i.inlineNoContentErrorText);
38
- case t.PRECONDITION_FAILED:
39
- return e(i.inlinePreconditionFailedErrorText, {
40
- type: d
30
+ }, [o]);
31
+ const f = m.useCallback(() => {
32
+ switch (n) {
33
+ case i.RATE_LIMITING:
34
+ return r(e.inlineRateLimitingErrorText);
35
+ case i.NO_CONTENT:
36
+ return r(e.inlineNoContentErrorText);
37
+ case i.PRECONDITION_FAILED:
38
+ return r(e.inlinePreconditionFailedErrorText, {
39
+ type: a
41
40
  });
42
- case t.AGENT_NOT_FOUND:
43
- return e(i.inlineAgentNotFoundErrorText);
41
+ case i.AGENT_NOT_FOUND:
42
+ return r(e.inlineAgentNotFoundErrorText);
44
43
  default:
45
- return e(i.inlineErrorText);
44
+ return r(e.inlineErrorText);
46
45
  }
47
- }, [d, o, e]), f = N() === h.Small ? l : S;
48
- return /* @__PURE__ */ r("div", {
49
- className: n.inlineError,
46
+ }, [a, n, r]);
47
+ return /* @__PURE__ */ t("div", {
48
+ className: s.inlineError,
50
49
  "data-testid": "content-answers-inline-error",
51
- children: /* @__PURE__ */ _(c, {
52
- variant: a,
53
- children: [a === "modal" && /* @__PURE__ */ r(c.Figure, {
54
- isUsedInsideSidebar: m,
55
- variant: "center-aligned",
56
- children: /* @__PURE__ */ r("div", {
57
- className: n.iconAvatar,
58
- children: /* @__PURE__ */ r(g, {
59
- height: f,
60
- role: "presentation",
61
- width: f
62
- })
63
- })
64
- }), /* @__PURE__ */ _(c.Content, {
65
- isUsedInsideSidebar: m,
50
+ children: /* @__PURE__ */ t(d, {
51
+ variant: l,
52
+ children: /* @__PURE__ */ x(d.Content, {
53
+ isUsedInsideSidebar: E,
66
54
  shouldAddCard: !1,
67
55
  variant: "error",
68
- children: [/* @__PURE__ */ r("div", {
69
- className: n.icon,
70
- children: /* @__PURE__ */ r(x, {
71
- height: l,
56
+ children: [/* @__PURE__ */ t("div", {
57
+ className: s.icon,
58
+ children: /* @__PURE__ */ t(N, {
59
+ height: c,
72
60
  role: "presentation",
73
- width: l
61
+ width: c
74
62
  })
75
- }), /* @__PURE__ */ r(u, {
63
+ }), /* @__PURE__ */ t(_, {
76
64
  as: "p",
77
- className: n.text,
78
- children: o && p()
65
+ className: s.text,
66
+ children: n && f()
79
67
  })]
80
- })]
68
+ })
81
69
  })
82
70
  });
83
71
  };
84
72
  export {
85
- U as InlineError,
86
- U as default
73
+ L as InlineError,
74
+ L as default
87
75
  };