@box/box-ai-content-answers 0.65.2 → 0.66.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 (39) hide show
  1. package/esm/lib/box-ai-content-answers.js +63 -60
  2. package/esm/lib/components/agents/agent-editor.js +9 -9
  3. package/esm/lib/components/answer/answer-content.js +19 -17
  4. package/esm/lib/components/answer/answer.js +90 -81
  5. package/esm/lib/components/answer/inline-error.js +45 -41
  6. package/esm/lib/components/answer/loading-element.js +32 -26
  7. package/esm/lib/components/chat/chat.js +61 -56
  8. package/esm/lib/components/common/media-container.js +40 -35
  9. package/esm/lib/components/content/content.js +43 -41
  10. package/esm/lib/components/footer/footer.js +55 -54
  11. package/esm/lib/components/question/question.js +34 -27
  12. package/esm/lib/components/suggested-questions/suggested-questions.js +58 -54
  13. package/esm/lib/components/suggested-questions/suggestions.js +18 -15
  14. package/esm/lib/components/welcome-message/welcome-message.js +45 -39
  15. package/package.json +2 -2
  16. package/styles/agent-editor.css +1 -1
  17. package/styles/answer-content.css +1 -1
  18. package/styles/box-ai-content-answers.css +1 -1
  19. package/styles/content.css +1 -1
  20. package/styles/media-container.css +1 -1
  21. package/styles/question.css +1 -1
  22. package/styles/suggested-questions.css +1 -1
  23. package/styles/suggestions.css +1 -1
  24. package/styles/welcome-message.css +1 -1
  25. package/types/lib/box-ai-content-answers.d.ts +1 -0
  26. package/types/lib/components/answer/answer-content.d.ts +2 -1
  27. package/types/lib/components/answer/answer.d.ts +1 -0
  28. package/types/lib/components/answer/inline-error.d.ts +2 -1
  29. package/types/lib/components/answer/loading-element.d.ts +4 -1
  30. package/types/lib/components/chat/chat.d.ts +1 -1
  31. package/types/lib/components/common/media-container.d.ts +3 -0
  32. package/types/lib/components/content/content.d.ts +1 -1
  33. package/types/lib/components/footer/footer.d.ts +2 -1
  34. package/types/lib/components/question/question.d.ts +2 -1
  35. package/types/lib/components/suggested-questions/suggested-questions.d.ts +2 -1
  36. package/types/lib/components/suggested-questions/suggestions.d.ts +2 -1
  37. package/types/lib/components/welcome-message/welcome-message.d.ts +1 -1
  38. package/types/lib/stories/shared.d.ts +1 -0
  39. package/types/lib/types.d.ts +3 -0
@@ -3,85 +3,88 @@ import C from "clsx";
3
3
  import * as s from "react";
4
4
  import { AgentEditor as F } from "./components/agents/agent-editor.js";
5
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 = ({
6
+ import { Footer as B } from "./components/footer/footer.js";
7
+ import { jsx as o, jsxs as R } from "react/jsx-runtime";
8
+ const z = "_container_9vygi_1", G = "_contentAnswers_9vygi_8", A = {
9
+ container: z,
10
+ contentAnswers: G
11
+ }, X = ({
12
12
  className: S,
13
- contentType: u,
13
+ contentType: l,
14
14
  error: t,
15
- hasRequestInProgress: c,
16
- isAgentSelectorEnabled: h,
17
- isAIStudioAgentSelectorEnabled: A,
18
- isDebugModeEnabled: M,
19
- isStopResponseEnabled: Q,
20
- isStreamingEnabled: o,
21
- userInfo: l,
22
- questions: i,
23
- recordAction: r,
24
- retryQuestion: _,
25
- showLoadingIndicator: a,
26
- stopQuestion: x,
27
- submitQuestion: b,
28
- suggestedQuestions: v,
29
- useAnimation: D,
15
+ hasRequestInProgress: r,
16
+ isAgentSelectorEnabled: M,
17
+ isAIStudioAgentSelectorEnabled: Q,
18
+ isDebugModeEnabled: _,
19
+ isSidebarOpen: c = !1,
20
+ isStopResponseEnabled: h,
21
+ isStreamingEnabled: n,
22
+ userInfo: a,
23
+ questions: u,
24
+ recordAction: i,
25
+ retryQuestion: x,
26
+ showLoadingIndicator: m,
27
+ stopQuestion: v,
28
+ submitQuestion: D,
29
+ suggestedQuestions: b,
30
+ useAnimation: y,
30
31
  onAgentEditorToggle: E,
31
32
  ...j
32
33
  }) => {
33
- const [m, g] = s.useState(null), [f, d] = s.useState(t != null), [e, p] = s.useState(!1), k = !f && !a;
34
+ const [g, f] = s.useState(null), [w, d] = s.useState(t != null), [e, p] = s.useState(!1), k = !w && !m;
34
35
  return s.useEffect(() => {
35
36
  d(t != null);
36
- }, [t]), /* @__PURE__ */ n("div", {
37
- className: C(S, w.container),
38
- children: /* @__PURE__ */ B("div", {
39
- className: w.contentAnswers,
40
- children: [!e && /* @__PURE__ */ n(N, {
37
+ }, [t]), /* @__PURE__ */ o("div", {
38
+ className: C(S, A.container),
39
+ children: /* @__PURE__ */ R("div", {
40
+ className: A.contentAnswers,
41
+ children: [!e && /* @__PURE__ */ o(N, {
41
42
  ...j,
42
- askSuggestedQuestion: m,
43
- contentType: u,
43
+ askSuggestedQuestion: g,
44
+ contentType: l,
44
45
  error: t,
45
- hasRequestInProgress: c,
46
- isErrorMessageShown: f,
47
- isStreamingEnabled: o,
48
- questions: i,
49
- recordAction: r,
50
- setAskSuggestedQuestion: g,
46
+ hasRequestInProgress: r,
47
+ isErrorMessageShown: w,
48
+ isSidebarOpen: c,
49
+ isStreamingEnabled: n,
50
+ questions: u,
51
+ recordAction: i,
52
+ setAskSuggestedQuestion: f,
51
53
  setIsErrorMessageShown: d,
52
- showLoadingIndicator: a,
53
- suggestedQuestions: v,
54
- useAnimation: o && D,
55
- userInfo: l
56
- }), e && /* @__PURE__ */ n(F, {
54
+ showLoadingIndicator: m,
55
+ suggestedQuestions: b,
56
+ useAnimation: n && y,
57
+ userInfo: a
58
+ }), e && /* @__PURE__ */ o(F, {
57
59
  onAgentEditorToggle: E,
58
- recordAction: r,
60
+ recordAction: i,
59
61
  setIsDebugModeShown: p
60
- }), k && /* @__PURE__ */ n(y, {
61
- askSuggestedQuestion: m,
62
- contentType: u,
63
- enableDebugMode: M,
64
- hasRequestInProgress: c,
65
- isAgentSelectorEnabled: h,
66
- isAIStudioAgentSelectorEnabled: A,
62
+ }), k && /* @__PURE__ */ o(B, {
63
+ askSuggestedQuestion: g,
64
+ contentType: l,
65
+ enableDebugMode: _,
66
+ hasRequestInProgress: r,
67
+ isAgentSelectorEnabled: M,
68
+ isAIStudioAgentSelectorEnabled: Q,
67
69
  isDebugModeShown: e,
68
- isStopResponseEnabled: Q,
69
- isStreamingEnabled: o,
70
- lastQuestion: i[i.length - 1],
71
- onRetryQuestion: _,
72
- onStopQuestion: x,
73
- recordAction: r,
74
- sendQuestion: b,
75
- setAskSuggestedQuestion: g,
70
+ isSidebarOpen: c,
71
+ isStopResponseEnabled: h,
72
+ isStreamingEnabled: n,
73
+ lastQuestion: u[u.length - 1],
74
+ onRetryQuestion: x,
75
+ onStopQuestion: v,
76
+ recordAction: i,
77
+ sendQuestion: D,
78
+ setAskSuggestedQuestion: f,
76
79
  toggleDebugMode: () => {
77
80
  p(!e);
78
81
  },
79
- user: l
82
+ user: a
80
83
  })]
81
84
  })
82
85
  });
83
86
  };
84
87
  export {
85
- V as BoxAiContentAnswers,
86
- V as default
88
+ X as BoxAiContentAnswers,
89
+ X as default
87
90
  };
@@ -4,10 +4,10 @@ import { useEffect as a, createRef as u } from "react";
4
4
  import { useIntl as d } from "react-intl";
5
5
  import { isDebugModeTrigger as l } from "../common/keyInputUtils.js";
6
6
  import p from "../footer/messages.js";
7
- import { useAgents as b, useAgentsDispatch as h } from "../../contexts/AgentsContext.js";
8
- import { LOGGER_BASE_CONFIG as _ } from "../common/constants.js";
7
+ import { useAgents as b, useAgentsDispatch as _ } from "../../contexts/AgentsContext.js";
8
+ import { LOGGER_BASE_CONFIG as h } from "../common/constants.js";
9
9
  import { jsx as E } from "react/jsx-runtime";
10
- const N = "_debug_hgecn_1", O = {
10
+ const N = "_debug_do5vl_1", O = {
11
11
  debug: N
12
12
  }, R = 25, S = ({
13
13
  onAgentEditorToggle: s,
@@ -18,7 +18,7 @@ const N = "_debug_hgecn_1", O = {
18
18
  formatMessage: r
19
19
  } = d(), {
20
20
  selectedAgent: t
21
- } = b(), m = h(), e = /* @__PURE__ */ u();
21
+ } = b(), m = _(), e = /* @__PURE__ */ u();
22
22
  a(() => {
23
23
  if (e.current) {
24
24
  const o = JSON.stringify(t.config, null, 4);
@@ -26,17 +26,17 @@ const N = "_debug_hgecn_1", O = {
26
26
  }
27
27
  }, [e, t, r]), a(() => {
28
28
  s && (s(t), n && n({
29
- ..._,
29
+ ...h,
30
30
  target: "debugMode"
31
31
  }));
32
32
  }, []);
33
- const c = () => {
33
+ const f = () => {
34
34
  m({
35
35
  type: "OVERRIDE_AGENT_CONFIG",
36
36
  agentName: t.name,
37
37
  agentConfig: JSON.parse(e.current.value)
38
38
  });
39
- }, f = (o) => {
39
+ }, c = (o) => {
40
40
  l(o) && i(!1);
41
41
  };
42
42
  return /* @__PURE__ */ E(g, {
@@ -46,8 +46,8 @@ const N = "_debug_hgecn_1", O = {
46
46
  hideLabel: !0,
47
47
  label: r(p.askQuestionPlaceholder),
48
48
  maxRows: R,
49
- onChange: c,
50
- onKeyDown: f
49
+ onChange: f,
50
+ onKeyDown: c
51
51
  });
52
52
  };
53
53
  export {
@@ -1,32 +1,34 @@
1
1
  import "../../../../styles/answer-content.css";
2
- import a from "clsx";
3
- import w from "../common/markdown.js";
4
- import { jsxs as d, Fragment as c, jsx as m } from "react/jsx-runtime";
5
- const _ = "_answerContent_1s7k1_1", i = "_answerMarkdown_1s7k1_13", e = {
6
- answerContent: _,
7
- answerMarkdown: i
8
- }, p = ({
2
+ import i from "clsx";
3
+ import m from "../common/markdown.js";
4
+ import { jsxs as w, Fragment as _, jsx as d } from "react/jsx-runtime";
5
+ const c = "_answerContent_kzv6t_1", p = "_isSidebarOpen_kzv6t_14", l = "_answerMarkdown_kzv6t_18", e = {
6
+ answerContent: c,
7
+ isSidebarOpen: p,
8
+ answerMarkdown: l
9
+ }, v = ({
9
10
  answer: n,
11
+ isSidebarOpen: r = !1,
10
12
  isMarkdownEnabled: t,
11
- className: r,
13
+ className: s,
12
14
  ...o
13
15
  }) => {
14
- let s = n;
15
- return t && n && (s = w.render(n)), /* @__PURE__ */ d(c, {
16
- children: [!t && /* @__PURE__ */ m("div", {
17
- className: a(e.answerContent, "Answer-text", r),
16
+ let a = n;
17
+ return t && n && (a = m.render(n)), /* @__PURE__ */ w(_, {
18
+ children: [!t && /* @__PURE__ */ d("div", {
19
+ className: i(e.answerContent, r && e.isSidebarOpen, "Answer-text", s),
18
20
  ...o,
19
21
  children: n
20
- }), t && /* @__PURE__ */ m("div", {
21
- className: a(e.answerContent, e.answerMarkdown, "Answer-text", r),
22
+ }), t && /* @__PURE__ */ d("div", {
23
+ className: i(e.answerContent, e.answerMarkdown, r && e.isSidebarOpen, "Answer-text", s),
22
24
  dangerouslySetInnerHTML: {
23
- __html: s
25
+ __html: a
24
26
  },
25
27
  ...o
26
28
  })]
27
29
  });
28
30
  };
29
31
  export {
30
- p as AnswerContent,
31
- p as default
32
+ v as AnswerContent,
33
+ v as default
32
34
  };
@@ -1,107 +1,116 @@
1
1
  import "../../../../styles/answer.css";
2
- import { useBreakpoint as k, Breakpoint as z, Text as b } from "@box/blueprint-web";
3
- import { BoxAi as M, AlertTriangle as H } from "@box/blueprint-web-assets/icons/Line";
4
- import { Size5 as L, Size6 as x, Gray65 as D, Size4 as f } from "@box/blueprint-web-assets/tokens/tokens";
5
- import F from "clsx";
6
- import * as c from "react";
7
- import { useIntl as U } from "react-intl";
8
- import { A as o } from "../../../../chunks/types.js";
9
- import { MediaContainer as m } from "../common/media-container.js";
10
- import { AnswerContent as y } from "./answer-content.js";
11
- import { CopyButton as B } from "./copy-button.js";
12
- import { InlineError as C } from "./inline-error.js";
13
- import { LoadingElement as G } from "./loading-element.js";
14
- import d from "./messages.js";
15
- import { References as j } from "./references.js";
16
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
17
- const W = "_answer_5bwzk_1", q = "_alertIcon_5bwzk_4", J = "_error_5bwzk_7", K = "_footer_5bwzk_11", Q = "_shouldHaveMarginTop_5bwzk_17", V = "_shouldUseAnimation_5bwzk_20", X = "_shouldAnimateHeight_5bwzk_24", Y = "_iconAvatar_5bwzk_28", r = {
18
- answer: W,
19
- alertIcon: q,
20
- error: J,
21
- footer: K,
22
- shouldHaveMarginTop: Q,
23
- shouldUseAnimation: V,
24
- shouldAnimateHeight: X,
25
- iconAvatar: Y
26
- }, Z = /* @__PURE__ */ new Set([o.RATE_LIMITING, o.NO_CONTENT, o.PRECONDITION_FAILED, o.GENERAL]), fe = /* @__PURE__ */ c.memo(({
27
- answer: n,
28
- citations: u,
29
- error: e,
30
- contentType: S,
2
+ import { useBreakpoint as O, Breakpoint as M, Text as H } from "@box/blueprint-web";
3
+ import { BoxAi as L, AlertTriangle as x } from "@box/blueprint-web-assets/icons/Line";
4
+ import { Size5 as D, Size6 as F, Gray65 as b, Size4 as p } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import U from "clsx";
6
+ import * as m from "react";
7
+ import { useIntl as y } from "react-intl";
8
+ import { A as e } from "../../../../chunks/types.js";
9
+ import { MediaContainer as d } from "../common/media-container.js";
10
+ import { AnswerContent as B } from "./answer-content.js";
11
+ import { CopyButton as C } from "./copy-button.js";
12
+ import { InlineError as G } from "./inline-error.js";
13
+ import { LoadingElement as j } from "./loading-element.js";
14
+ import E from "./messages.js";
15
+ import { References as W } from "./references.js";
16
+ import { jsxs as a, jsx as o } from "react/jsx-runtime";
17
+ const q = "_answer_5bwzk_1", J = "_alertIcon_5bwzk_4", K = "_error_5bwzk_7", Q = "_footer_5bwzk_11", V = "_shouldHaveMarginTop_5bwzk_17", X = "_shouldUseAnimation_5bwzk_20", Y = "_shouldAnimateHeight_5bwzk_24", Z = "_iconAvatar_5bwzk_28", r = {
18
+ answer: q,
19
+ alertIcon: J,
20
+ error: K,
21
+ footer: Q,
22
+ shouldHaveMarginTop: V,
23
+ shouldUseAnimation: X,
24
+ shouldAnimateHeight: Y,
25
+ iconAvatar: Z
26
+ }, $ = /* @__PURE__ */ new Set([e.RATE_LIMITING, e.NO_CONTENT, e.PRECONDITION_FAILED, e.GENERAL]), pt = /* @__PURE__ */ m.memo(({
27
+ answer: s,
28
+ citations: S,
29
+ error: t,
30
+ contentType: w,
31
31
  isCitationsEnabled: A = !1,
32
- isCompleted: a = !1,
33
- isLoading: w = !1,
34
- isMarkdownEnabled: I = !1,
35
- onCitationClick: N,
36
- onAnswerCopy: R,
37
- recordAction: i,
38
- useAnimation: g = !0
32
+ isCompleted: i = !1,
33
+ isLoading: I = !1,
34
+ isMarkdownEnabled: N = !1,
35
+ isSidebarOpen: n = !1,
36
+ onCitationClick: R,
37
+ onAnswerCopy: g,
38
+ recordAction: l,
39
+ useAnimation: T = !0
39
40
  }) => {
40
- const p = Z.has(e), E = w && !n && !e, [T, v] = c.useState(a), {
41
- formatMessage: l
42
- } = U(), _ = k() === z.Small ? L : x;
43
- c.useEffect(() => {
44
- setTimeout(() => v(a), 0);
45
- }, [a]);
46
- const h = () => /* @__PURE__ */ t(H, {
41
+ const _ = $.has(t), h = I && !s && !t, [v, P] = m.useState(i), {
42
+ formatMessage: c
43
+ } = y(), f = O() === M.Small ? D : F;
44
+ m.useEffect(() => {
45
+ setTimeout(() => P(i), 0);
46
+ }, [i]);
47
+ const u = () => /* @__PURE__ */ o(x, {
47
48
  className: r.alertIcon,
48
- color: D,
49
+ color: b,
49
50
  "data-testid": "content-answers-error-alert-icon",
50
- height: f,
51
+ height: p,
51
52
  role: "presentation",
52
- width: f
53
- }), O = () => /* @__PURE__ */ s(b, {
53
+ width: p
54
+ }), k = () => /* @__PURE__ */ a(H, {
54
55
  as: "p",
55
56
  className: r.error,
56
57
  color: "textOnLightSecondary",
57
58
  "data-testid": "content-answers-error",
58
59
  variant: "caption",
59
- children: [e === o.RESPONSE_INTERRUPTED && l(d.responseInterruptedError), e === o.RESPONSE_FAILED && l(d.responseFailedError), e === o.RESPONSE_STOPPED && l(d.responseStoppedError), e !== o.RESPONSE_STOPPED && h()]
60
- }), P = () => e !== o.RESPONSE_STOPPED ? /* @__PURE__ */ t(B, {
61
- answer: n,
62
- onAnswerCopy: R,
63
- recordAction: i
64
- }) : n ? null : h();
65
- return /* @__PURE__ */ s("div", {
60
+ children: [t === e.RESPONSE_INTERRUPTED && c(E.responseInterruptedError), t === e.RESPONSE_FAILED && c(E.responseFailedError), t === e.RESPONSE_STOPPED && c(E.responseStoppedError), t !== e.RESPONSE_STOPPED && u()]
61
+ }), z = () => t !== e.RESPONSE_STOPPED ? /* @__PURE__ */ o(C, {
62
+ answer: s,
63
+ onAnswerCopy: g,
64
+ recordAction: l
65
+ }) : s ? null : u();
66
+ return /* @__PURE__ */ a("div", {
66
67
  "aria-live": "polite",
67
68
  className: r.answer,
68
69
  "data-testid": "content-answers-answer",
69
- children: [!p && !E && /* @__PURE__ */ s(m, {
70
- children: [/* @__PURE__ */ t(m.Figure, {
71
- children: /* @__PURE__ */ t("div", {
70
+ children: [!_ && !h && /* @__PURE__ */ a(d, {
71
+ isSidebarOpen: n,
72
+ children: [/* @__PURE__ */ o(d.Figure, {
73
+ isSidebarOpen: n,
74
+ children: /* @__PURE__ */ o("div", {
72
75
  className: r.iconAvatar,
73
- children: /* @__PURE__ */ t(M, {
74
- height: _,
76
+ children: /* @__PURE__ */ o(L, {
77
+ height: f,
75
78
  role: "presentation",
76
- width: _
79
+ width: f
77
80
  })
78
81
  })
79
- }), /* @__PURE__ */ s(m.Content, {
80
- children: [/* @__PURE__ */ t(y, {
81
- answer: n,
82
- isMarkdownEnabled: I
83
- }), a && /* @__PURE__ */ s("div", {
84
- className: F(r.footer, {
85
- [r.shouldHaveMarginTop]: n,
86
- [r.shouldAnimateHeight]: T,
87
- [r.shouldUseAnimation]: g
82
+ }), /* @__PURE__ */ a(d.Content, {
83
+ isSidebarOpen: n,
84
+ variant: "answer",
85
+ children: [/* @__PURE__ */ o(B, {
86
+ answer: s,
87
+ isMarkdownEnabled: N,
88
+ isSidebarOpen: n
89
+ }), i && /* @__PURE__ */ a("div", {
90
+ className: U(r.footer, {
91
+ [r.shouldHaveMarginTop]: s,
92
+ [r.shouldAnimateHeight]: v,
93
+ [r.shouldUseAnimation]: T
88
94
  }),
89
95
  "data-testid": "content-answers-answer-footer",
90
- children: [e && O(), A && !e && /* @__PURE__ */ t(j, {
91
- citations: u,
92
- onCitationClick: N,
93
- recordAction: i
94
- }), P()]
96
+ children: [t && k(), A && !t && /* @__PURE__ */ o(W, {
97
+ citations: S,
98
+ onCitationClick: R,
99
+ recordAction: l
100
+ }), z()]
95
101
  })]
96
102
  })]
97
- }), p && /* @__PURE__ */ t(C, {
98
- contentType: S,
99
- error: e,
100
- recordAction: i
101
- }), E && /* @__PURE__ */ t(G, {})]
103
+ }), _ && /* @__PURE__ */ o(G, {
104
+ contentType: w,
105
+ error: t,
106
+ isSidebarOpen: n,
107
+ recordAction: l
108
+ }), h && /* @__PURE__ */ o(j, {
109
+ isSidebarOpen: n
110
+ })]
102
111
  });
103
112
  });
104
113
  export {
105
- fe as Answer,
106
- fe as default
114
+ pt as Answer,
115
+ pt as default
107
116
  };
@@ -1,81 +1,85 @@
1
1
  import "../../../../styles/inline-error.css";
2
- import { useBreakpoint as p, Breakpoint as _, Text as h } from "@box/blueprint-web";
3
- import { BoxAi as u, AlertTriangle as x } from "@box/blueprint-web-assets/icons/Line";
4
- import { Size5 as a, Size6 as N } from "@box/blueprint-web-assets/tokens/tokens";
5
- import * as d from "react";
6
- import { useIntl as v } from "react-intl";
7
- import { A as s } from "../../../../chunks/types.js";
8
- import { LOGGER_BASE_CONFIG as g } from "../common/constants.js";
9
- import { MediaContainer as l } from "../common/media-container.js";
2
+ import { useBreakpoint as p, Breakpoint as h, Text as u } from "@box/blueprint-web";
3
+ import { BoxAi as x, AlertTriangle as N } from "@box/blueprint-web-assets/icons/Line";
4
+ import { Size5 as s, Size6 as v } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import * as f from "react";
6
+ import { useIntl as g } from "react-intl";
7
+ import { A as l } 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
10
  import t from "./messages.js";
11
- import { jsx as r, jsxs as f } from "react/jsx-runtime";
12
- const A = "_inlineError_ft07o_1", S = "_text_ft07o_4", T = "_icon_ft07o_14", I = "_iconAvatar_ft07o_18", i = {
13
- inlineError: A,
14
- text: S,
15
- icon: T,
16
- iconAvatar: I
17
- }, z = ({
11
+ import { jsx as r, jsxs as E } from "react/jsx-runtime";
12
+ const T = "_inlineError_ft07o_1", I = "_text_ft07o_4", R = "_icon_ft07o_14", C = "_iconAvatar_ft07o_18", i = {
13
+ inlineError: T,
14
+ text: I,
15
+ icon: R,
16
+ iconAvatar: C
17
+ }, D = ({
18
18
  error: n,
19
- contentType: c,
20
- recordAction: o
19
+ contentType: m,
20
+ isSidebarOpen: o = !1,
21
+ recordAction: a
21
22
  }) => {
22
23
  const {
23
24
  formatMessage: e
24
- } = v();
25
- d.useEffect(() => {
26
- o && o({
27
- ...g,
25
+ } = g();
26
+ f.useEffect(() => {
27
+ a && a({
28
+ ...A,
28
29
  target: "inlineError"
29
30
  });
30
- }, [o]);
31
- const E = d.useCallback(() => {
31
+ }, [a]);
32
+ const _ = f.useCallback(() => {
32
33
  switch (n) {
33
- case s.RATE_LIMITING:
34
+ case l.RATE_LIMITING:
34
35
  return e(t.inlineRateLimitingErrorText);
35
- case s.NO_CONTENT:
36
+ case l.NO_CONTENT:
36
37
  return e(t.inlineNoContentErrorText);
37
- case s.PRECONDITION_FAILED:
38
+ case l.PRECONDITION_FAILED:
38
39
  return e(t.inlinePreconditionFailedErrorText, {
39
- type: c
40
+ type: m
40
41
  });
41
42
  default:
42
43
  return e(t.inlineErrorText);
43
44
  }
44
- }, [c, n, e]), m = p() === _.Small ? a : N;
45
+ }, [m, n, e]), d = p() === h.Small ? s : v;
45
46
  return /* @__PURE__ */ r("div", {
46
47
  className: i.inlineError,
47
48
  "data-testid": "content-answers-inline-error",
48
- children: /* @__PURE__ */ f(l, {
49
- children: [/* @__PURE__ */ r(l.Figure, {
49
+ children: /* @__PURE__ */ E(c, {
50
+ isSidebarOpen: o,
51
+ children: [/* @__PURE__ */ r(c.Figure, {
52
+ isSidebarOpen: o,
50
53
  variant: "center-aligned",
51
54
  children: /* @__PURE__ */ r("div", {
52
55
  className: i.iconAvatar,
53
- children: /* @__PURE__ */ r(u, {
54
- height: m,
56
+ children: /* @__PURE__ */ r(x, {
57
+ height: d,
55
58
  role: "presentation",
56
- width: m
59
+ width: d
57
60
  })
58
61
  })
59
- }), /* @__PURE__ */ f(l.Content, {
62
+ }), /* @__PURE__ */ E(c.Content, {
63
+ isSidebarOpen: o,
60
64
  shouldAddCard: !1,
61
65
  variant: "error",
62
66
  children: [/* @__PURE__ */ r("div", {
63
67
  className: i.icon,
64
- children: /* @__PURE__ */ r(x, {
65
- height: a,
68
+ children: /* @__PURE__ */ r(N, {
69
+ height: s,
66
70
  role: "presentation",
67
- width: a
71
+ width: s
68
72
  })
69
- }), /* @__PURE__ */ r(h, {
73
+ }), /* @__PURE__ */ r(u, {
70
74
  as: "p",
71
75
  className: i.text,
72
- children: n && E()
76
+ children: n && _()
73
77
  })]
74
78
  })]
75
79
  })
76
80
  });
77
81
  };
78
82
  export {
79
- z as InlineError,
80
- z as default
83
+ D as InlineError,
84
+ D as default
81
85
  };