@box/box-ai-content-answers 0.54.6 → 0.55.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 (53) hide show
  1. package/chunks/types.js +1 -1
  2. package/esm/lib/components/answer/answer-content.js +20 -17
  3. package/esm/lib/components/answer/answer.js +73 -63
  4. package/esm/lib/components/answer/citation.js +74 -65
  5. package/esm/lib/components/answer/copy-button.js +13 -11
  6. package/esm/lib/components/answer/inline-error.js +55 -45
  7. package/esm/lib/components/answer/loading-element.js +30 -26
  8. package/esm/lib/components/answer/messages.js +6 -2
  9. package/esm/lib/components/answer/references.js +22 -20
  10. package/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +108 -108
  11. package/esm/lib/components/chat/chat.js +52 -51
  12. package/esm/lib/components/common/mock-data.js +6 -23
  13. package/i18n/bn-IN.js +1 -0
  14. package/i18n/da-DK.js +1 -0
  15. package/i18n/de-DE.js +1 -0
  16. package/i18n/en-AU.js +1 -0
  17. package/i18n/en-CA.js +1 -0
  18. package/i18n/en-GB.js +1 -0
  19. package/i18n/en-US.js +1 -0
  20. package/i18n/en-US.properties +2 -0
  21. package/i18n/en-x-pseudo.js +1 -0
  22. package/i18n/es-419.js +1 -0
  23. package/i18n/es-ES.js +1 -0
  24. package/i18n/fi-FI.js +1 -0
  25. package/i18n/fr-CA.js +1 -0
  26. package/i18n/fr-FR.js +1 -0
  27. package/i18n/hi-IN.js +1 -0
  28. package/i18n/it-IT.js +1 -0
  29. package/i18n/ja-JP.js +1 -0
  30. package/i18n/json/src/lib/components/answer/messages.json +1 -1
  31. package/i18n/ko-KR.js +1 -0
  32. package/i18n/nb-NO.js +1 -0
  33. package/i18n/nl-NL.js +1 -0
  34. package/i18n/pl-PL.js +1 -0
  35. package/i18n/pt-BR.js +1 -0
  36. package/i18n/ru-RU.js +1 -0
  37. package/i18n/sv-SE.js +1 -0
  38. package/i18n/tr-TR.js +1 -0
  39. package/i18n/zh-CN.js +1 -0
  40. package/i18n/zh-TW.js +1 -0
  41. package/package.json +2 -2
  42. package/types/lib/components/answer/answer.d.ts +2 -0
  43. package/types/lib/components/answer/inline-error.d.ts +2 -1
  44. package/types/lib/components/answer/messages.d.ts +5 -0
  45. package/types/lib/types.d.ts +1 -0
  46. package/chunks/answer-content.module.js +0 -8
  47. package/chunks/answer.module.js +0 -13
  48. package/chunks/citation.module.js +0 -14
  49. package/chunks/copy-button.module.js +0 -7
  50. package/chunks/inline-error.module.js +0 -10
  51. package/chunks/loading.module.js +0 -9
  52. package/chunks/references.module.js +0 -7
  53. /package/styles/{loading.css → loading-element.css} +0 -0
package/chunks/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  let n = /* @__PURE__ */ function(e) {
2
- return e.GENERAL = "general", e.RATE_LIMITING = "rate_limiting", e.NO_CONTENT = "no_content", e.RESPONSE_FAILED = "response_failed", e.RESPONSE_INTERRUPTED = "response_interrupted", e.RESPONSE_STOPPED = "response_stopped", e;
2
+ return e.GENERAL = "general", e.RATE_LIMITING = "rate_limiting", e.NO_CONTENT = "no_content", e.PRECONDITION_FAILED = "precondition_failed", e.RESPONSE_FAILED = "response_failed", e.RESPONSE_INTERRUPTED = "response_interrupted", e.RESPONSE_STOPPED = "response_stopped", e;
3
3
  }({}), r = /* @__PURE__ */ function(e) {
4
4
  return e.LARGE_FILE = "large_file", e.GENERAL = "general", e;
5
5
  }({}), t = /* @__PURE__ */ function(e) {
@@ -1,21 +1,24 @@
1
- import m from "clsx";
2
- import i from "../common/markdown.js";
3
- import { s as r } from "../../../../chunks/answer-content.module.js";
4
- import { jsxs as l, Fragment as f, jsx as d } from "react/jsx-runtime";
5
- const C = ({
6
- answer: t,
7
- isMarkdownEnabled: e,
8
- className: n,
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 = ({
9
+ answer: n,
10
+ isMarkdownEnabled: t,
11
+ className: r,
9
12
  ...o
10
13
  }) => {
11
- let s = t;
12
- return e && t && (s = i.render(t)), /* @__PURE__ */ l(f, {
13
- children: [!e && /* @__PURE__ */ d("div", {
14
- className: m(r.answerContent, "Answer-text", n),
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),
15
18
  ...o,
16
- children: t
17
- }), e && /* @__PURE__ */ d("div", {
18
- className: m(r.answerContent, r.answerMarkdown, "Answer-text", n),
19
+ children: n
20
+ }), t && /* @__PURE__ */ m("div", {
21
+ className: a(e.answerContent, e.answerMarkdown, "Answer-text", r),
19
22
  dangerouslySetInnerHTML: {
20
23
  __html: s
21
24
  },
@@ -24,6 +27,6 @@ const C = ({
24
27
  });
25
28
  };
26
29
  export {
27
- C as AnswerContent,
28
- C as default
30
+ p as AnswerContent,
31
+ p as default
29
32
  };
@@ -1,100 +1,110 @@
1
- import { useBreakpoint as g, Breakpoint as x, Text as A } from "@box/blueprint-web";
2
- import { BoxAi as _, AlertTriangle as L } from "@box/blueprint-web-assets/icons/Line";
3
- import { Size5 as C, Size6 as k, Gray65 as y, Size4 as u } from "@box/blueprint-web-assets/tokens/tokens";
4
- import z from "clsx";
5
- import * as p from "react";
6
- import { useIntl as D } from "react-intl";
1
+ import "../../../../styles/answer.css";
2
+ import { useBreakpoint as g, Breakpoint as x, Text as T } from "@box/blueprint-web";
3
+ import { BoxAi as L, AlertTriangle as C } from "@box/blueprint-web-assets/icons/Line";
4
+ import { Size5 as D, Size6 as F, Gray65 as k, Size4 as S } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import y from "clsx";
6
+ import * as l from "react";
7
+ import { useIntl as z } from "react-intl";
7
8
  import { A as r } from "../../../../chunks/types.js";
8
- import { MediaContainer as f } from "../common/media-container.js";
9
- import { AnswerContent as F } from "./answer-content.js";
10
- import { CopyButton as M } from "./copy-button.js";
11
- import { InlineError as G } from "./inline-error.js";
12
- import { LoadingElement as b } from "./loading-element.js";
13
- import d from "./messages.js";
14
- import { References as j } from "./references.js";
15
- import { s as o } from "../../../../chunks/answer.module.js";
16
- import { jsxs as n, jsx as t } from "react/jsx-runtime";
17
- const ne = /* @__PURE__ */ p.memo(({
18
- answer: s,
19
- citations: R,
9
+ import { MediaContainer as p } from "../common/media-container.js";
10
+ import { AnswerContent as M } from "./answer-content.js";
11
+ import { CopyButton as G } from "./copy-button.js";
12
+ import { InlineError as b } from "./inline-error.js";
13
+ import { LoadingElement as j } from "./loading-element.js";
14
+ import f from "./messages.js";
15
+ import { References as B } from "./references.js";
16
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
17
+ const U = "_answer_13vnd_9", W = "_alertIcon_13vnd_12", q = "_error_13vnd_15", H = "_footer_13vnd_19", J = "_animated_13vnd_24", K = "_heightExpand_13vnd_1", Q = "_iconAvatar_13vnd_28", o = {
18
+ answer: U,
19
+ alertIcon: W,
20
+ error: q,
21
+ footer: H,
22
+ animated: J,
23
+ heightExpand: K,
24
+ iconAvatar: Q
25
+ }, V = /* @__PURE__ */ new Set([r.RATE_LIMITING, r.NO_CONTENT, r.PRECONDITION_FAILED, r.GENERAL]), Ee = /* @__PURE__ */ l.memo(({
26
+ answer: n,
27
+ citations: I,
20
28
  error: e,
21
- handleScrollToBottom: i,
22
- isCitationsEnabled: I = !1,
23
- isCompleted: v = !1,
24
- isLoading: P = !1,
29
+ contentType: N,
30
+ handleScrollToBottom: a,
31
+ isCitationsEnabled: R = !1,
32
+ isCompleted: u = !1,
33
+ isLoading: w = !1,
25
34
  isMarkdownEnabled: O = !1,
26
- isStreamingEnabled: a = !1,
27
- onCitationClick: w,
28
- recordAction: m,
29
- useAnimation: c = !0
35
+ isStreamingEnabled: i = !1,
36
+ onCitationClick: P,
37
+ recordAction: c,
38
+ useAnimation: m = !0
30
39
  }) => {
31
- const E = p.useRef(!0), S = e === r.RATE_LIMITING || e === r.NO_CONTENT || e === r.GENERAL, h = P && !s && !e, {
32
- formatMessage: l
33
- } = D(), N = g() === x.Small ? C : k;
34
- p.useEffect(() => {
40
+ const E = l.useRef(!0), _ = V.has(e), h = w && !n && !e, {
41
+ formatMessage: d
42
+ } = z(), v = g() === x.Small ? D : F;
43
+ l.useEffect(() => {
35
44
  if (E.current) {
36
45
  E.current = !1;
37
46
  return;
38
47
  }
39
- s && i && i(a ? "instant" : "smooth", a);
40
- }, [s, i, a]);
41
- const T = () => /* @__PURE__ */ n(A, {
48
+ n && a && a(i ? "instant" : "smooth", i);
49
+ }, [n, a, i]);
50
+ const A = () => /* @__PURE__ */ s(T, {
42
51
  as: "p",
43
52
  className: o.error,
44
53
  color: "textOnLightSecondary",
45
54
  "data-testid": "content-answers-error",
46
55
  variant: "caption",
47
- children: [e === r.RESPONSE_INTERRUPTED && l(d.responseInterruptedError), e === r.RESPONSE_FAILED && l(d.responseFailedError), e === r.RESPONSE_STOPPED && l(d.responseStoppedError), e !== r.RESPONSE_STOPPED && /* @__PURE__ */ t(L, {
56
+ children: [e === r.RESPONSE_INTERRUPTED && d(f.responseInterruptedError), e === r.RESPONSE_FAILED && d(f.responseFailedError), e === r.RESPONSE_STOPPED && d(f.responseStoppedError), e !== r.RESPONSE_STOPPED && /* @__PURE__ */ t(C, {
48
57
  className: o.alertIcon,
49
- color: y,
58
+ color: k,
50
59
  "data-testid": "content-answers-error-alert-icon",
51
- height: u,
60
+ height: S,
52
61
  role: "presentation",
53
- width: u
62
+ width: S
54
63
  })]
55
64
  });
56
- return /* @__PURE__ */ n("div", {
65
+ return /* @__PURE__ */ s("div", {
57
66
  "aria-live": "polite",
58
67
  className: o.answer,
59
68
  "data-testid": "content-answers-answer",
60
- children: [!S && !h && /* @__PURE__ */ n(f, {
61
- children: [/* @__PURE__ */ t(f.Figure, {
69
+ children: [!_ && !h && /* @__PURE__ */ s(p, {
70
+ children: [/* @__PURE__ */ t(p.Figure, {
62
71
  children: /* @__PURE__ */ t("div", {
63
72
  className: o.iconAvatar,
64
- children: /* @__PURE__ */ t(_, {
65
- height: N,
73
+ children: /* @__PURE__ */ t(L, {
74
+ height: v,
66
75
  role: "presentation",
67
- width: N
76
+ width: v
68
77
  })
69
78
  })
70
- }), /* @__PURE__ */ n(f.Content, {
71
- useAnimation: c,
72
- children: [/* @__PURE__ */ t(F, {
73
- answer: s,
79
+ }), /* @__PURE__ */ s(p.Content, {
80
+ useAnimation: m,
81
+ children: [/* @__PURE__ */ t(M, {
82
+ answer: n,
74
83
  isMarkdownEnabled: O
75
- }), v && /* @__PURE__ */ n("div", {
76
- className: z(o.footer, {
77
- [o.animated]: c
84
+ }), u && /* @__PURE__ */ s("div", {
85
+ className: y(o.footer, {
86
+ [o.animated]: m
78
87
  }),
79
88
  "data-testid": "content-answers-answer-footer",
80
- children: [e && T(), I && !e && /* @__PURE__ */ t(j, {
81
- citations: R,
82
- onCitationClick: w,
83
- recordAction: m
84
- }), /* @__PURE__ */ t(M, {
85
- answer: s,
86
- recordAction: m
89
+ children: [e && A(), R && !e && /* @__PURE__ */ t(B, {
90
+ citations: I,
91
+ onCitationClick: P,
92
+ recordAction: c
93
+ }), /* @__PURE__ */ t(G, {
94
+ answer: n,
95
+ recordAction: c
87
96
  })]
88
97
  })]
89
98
  })]
90
- }), S && /* @__PURE__ */ t(G, {
99
+ }), _ && /* @__PURE__ */ t(b, {
100
+ contentType: N,
91
101
  error: e,
92
- recordAction: m,
93
- useAnimation: c
94
- }), h && /* @__PURE__ */ t(b, {})]
102
+ recordAction: c,
103
+ useAnimation: m
104
+ }), h && /* @__PURE__ */ t(j, {})]
95
105
  });
96
106
  });
97
107
  export {
98
- ne as Answer,
99
- ne as default
108
+ Ee as Answer,
109
+ Ee as default
100
110
  };
@@ -1,34 +1,43 @@
1
- import { Popover as d, Status as S, Text as N, TextButton as M } from "@box/blueprint-web";
2
- import { ArrowUpRightSquare as D } from "@box/blueprint-web-assets/icons/Fill";
3
- import G from "clsx";
4
- import R from "lodash/debounce";
5
- import _ from "lodash/truncate";
6
- import { useState as b, useRef as F, useCallback as A, useEffect as y } from "react";
7
- import { useIntl as j } from "react-intl";
8
- import { LOGGER_BASE_CONFIG as w, LOGGER_ACTION_CLICK as K } from "../common/constants.js";
9
- import { MAX_CITATION_LENGTH as P } from "./constants.js";
10
- import i from "./messages.js";
11
- import { s as o } from "../../../../chunks/citation.module.js";
12
- import { jsxs as B, jsx as e } from "react/jsx-runtime";
13
- const Z = ({
1
+ import "../../../../styles/citation.css";
2
+ import { Popover as d, Status as O, Text as x, TextButton as k } from "@box/blueprint-web";
3
+ import { ArrowUpRightSquare as E } from "@box/blueprint-web-assets/icons/Fill";
4
+ import L from "clsx";
5
+ import M from "lodash/debounce";
6
+ import D from "lodash/truncate";
7
+ import { useState as B, useRef as G, useCallback as R, useEffect as F } from "react";
8
+ import { useIntl as A } from "react-intl";
9
+ import { LOGGER_BASE_CONFIG as v, LOGGER_ACTION_CLICK as j } from "../common/constants.js";
10
+ import { MAX_CITATION_LENGTH as K } from "./constants.js";
11
+ import s from "./messages.js";
12
+ import { jsxs as y, jsx as e } from "react/jsx-runtime";
13
+ const P = "_citationTrigger_wo5ky_1", U = "_citationStatus_wo5ky_5", q = "_animate_wo5ky_12", H = "_fadeIn_wo5ky_16", W = "_cardTooltip_wo5ky_20", X = "_cardTooltipTitle_wo5ky_24", $ = "_cardTooltipCitation_wo5ky_28", z = "_cardTooltipButton_wo5ky_33", o = {
14
+ citationTrigger: P,
15
+ citationStatus: U,
16
+ animate: q,
17
+ fadeIn: H,
18
+ cardTooltip: W,
19
+ cardTooltipTitle: X,
20
+ cardTooltipCitation: $,
21
+ cardTooltipButton: z
22
+ }, st = ({
14
23
  animate: p,
15
- content: T,
24
+ content: m,
16
25
  id: a,
17
- recordAction: n,
18
- fileId: h,
19
- title: l,
20
- onCitationClick: c
26
+ recordAction: i,
27
+ fileId: _,
28
+ title: c,
29
+ onCitationClick: l
21
30
  }) => {
22
- const [g, O] = b(!1), [E, I] = b(!p), {
23
- formatMessage: r
24
- } = j(), x = !!c, C = F(null);
25
- let f;
26
- l ? f = r(i.cardTooltipTitleWithDocumentName, {
27
- title: l.toString()
28
- }) : f = r(i.cardTooltipTitle);
29
- const v = R((t) => {
30
- O(t), t === !0 && n && n({
31
- ...w,
31
+ const [g, I] = B(!1), [N, S] = B(!p), {
32
+ formatMessage: n
33
+ } = A(), h = !!l, w = G(null);
34
+ let T;
35
+ c ? T = n(s.cardTooltipTitleWithDocumentName, {
36
+ title: c.toString()
37
+ }) : T = n(s.cardTooltipTitle);
38
+ const C = M((t) => {
39
+ I(t), t === !0 && i && i({
40
+ ...v,
32
41
  feature: "answers-citations",
33
42
  target: "hovered",
34
43
  data: {
@@ -36,88 +45,88 @@ const Z = ({
36
45
  }
37
46
  });
38
47
  }, 100), u = () => {
39
- v(!0);
40
- }, s = () => {
41
- v(!1);
42
- }, L = A(() => {
43
- c && n && (c(h, l), n({
44
- ...w,
48
+ C(!0);
49
+ }, r = () => {
50
+ C(!1);
51
+ }, b = R(() => {
52
+ l && i && (l(_, c), i({
53
+ ...v,
45
54
  feature: "answers-citations",
46
- target: K,
55
+ target: j,
47
56
  data: {
48
57
  index: a
49
58
  }
50
59
  }));
51
- }, [c, n, a, h, l]);
52
- y(() => {
53
- p && I(!0);
60
+ }, [l, i, a, _, c]);
61
+ F(() => {
62
+ p && S(!0);
54
63
  }, []);
55
- const m = T ? _(T.toString(), {
56
- length: P,
64
+ const f = m ? D(m.toString(), {
65
+ length: K,
57
66
  separator: /,? +/
58
67
  }) : void 0;
59
- return /* @__PURE__ */ B(d.Root, {
68
+ return /* @__PURE__ */ y(d.Root, {
60
69
  modal: !1,
61
70
  open: g,
62
71
  children: [/* @__PURE__ */ e(d.Trigger, {
63
72
  className: o.citationTrigger,
64
73
  onMouseEnter: u,
65
- onMouseLeave: s,
66
- children: /* @__PURE__ */ e(S, {
67
- ref: C,
68
- "aria-label": g ? m : r(i.referenceAriaLabel, {
74
+ onMouseLeave: r,
75
+ children: /* @__PURE__ */ e(O, {
76
+ ref: w,
77
+ "aria-label": g ? f : n(s.referenceAriaLabel, {
69
78
  number: a
70
79
  }),
71
- className: G(o.citationStatus, {
80
+ className: L(o.citationStatus, {
72
81
  [o.animate]: p,
73
- [o.fadeIn]: E
82
+ [o.fadeIn]: N
74
83
  }),
75
84
  colorIndex: 0,
76
85
  "data-testid": "content-answers-citation-status",
77
86
  interactive: !0,
78
- onBlur: s,
87
+ onBlur: r,
79
88
  onFocus: u,
80
89
  tabIndex: 0,
81
90
  text: `${a}`
82
91
  })
83
92
  }), /* @__PURE__ */ e(d.ContentContainer, {
84
- "aria-label": m,
93
+ "aria-label": f,
85
94
  collisionPadding: 10,
86
95
  "data-testid": "content-answers-citation-card",
87
- onBlur: s,
96
+ onBlur: r,
88
97
  onCloseAutoFocus: (t) => t.preventDefault(),
89
98
  onEscapeKeyDown: () => {
90
99
  var t;
91
- (t = C.current) == null || t.focus(), s();
100
+ (t = w.current) == null || t.focus(), r();
92
101
  },
93
102
  onFocus: u,
94
103
  onMouseEnter: u,
95
- onMouseLeave: s,
104
+ onMouseLeave: r,
96
105
  onOpenAutoFocus: (t) => {
97
- x || t.preventDefault();
106
+ h || t.preventDefault();
98
107
  },
99
108
  side: "top",
100
109
  sideOffset: 5,
101
110
  children: /* @__PURE__ */ e(d.MainContent, {
102
- children: /* @__PURE__ */ B("div", {
111
+ children: /* @__PURE__ */ y("div", {
103
112
  className: o.cardTooltip,
104
- children: [/* @__PURE__ */ e(N, {
113
+ children: [/* @__PURE__ */ e(x, {
105
114
  as: "h4",
106
115
  className: o.cardTooltipTitle,
107
116
  variant: "bodyDefaultBold",
108
- children: f
109
- }), /* @__PURE__ */ e(N, {
117
+ children: T
118
+ }), /* @__PURE__ */ e(x, {
110
119
  as: "p",
111
120
  className: o.cardTooltipCitation,
112
121
  color: "textOnLightDefault",
113
122
  variant: "caption",
114
- children: m
115
- }), x && /* @__PURE__ */ e(M, {
116
- "aria-label": r(i.cardTooltipButton),
123
+ children: f
124
+ }), h && /* @__PURE__ */ e(k, {
125
+ "aria-label": n(s.cardTooltipButton),
117
126
  className: o.cardTooltipButton,
118
- icon: D,
119
- onClick: L,
120
- children: r(i.cardTooltipButton)
127
+ icon: E,
128
+ onClick: b,
129
+ children: n(s.cardTooltipButton)
121
130
  })]
122
131
  })
123
132
  })
@@ -125,6 +134,6 @@ const Z = ({
125
134
  });
126
135
  };
127
136
  export {
128
- Z as Citation,
129
- Z as default
137
+ st as Citation,
138
+ st as default
130
139
  };
@@ -1,12 +1,14 @@
1
+ import "../../../../styles/copy-button.css";
1
2
  import { useNotification as n, Tooltip as p, IconButton as l } from "@box/blueprint-web";
2
3
  import { Clipboard as m } from "@box/blueprint-web-assets/icons/Fill";
3
4
  import { useIntl as u } from "react-intl";
4
- import f from "../../messages.js";
5
- import { LOGGER_BASE_CONFIG as d, LOGGER_ACTION_CLICK as b } from "../common/constants.js";
5
+ import d from "../../messages.js";
6
+ import { LOGGER_BASE_CONFIG as f, LOGGER_ACTION_CLICK as b } from "../common/constants.js";
6
7
  import t from "./messages.js";
7
- import { s as C } from "../../../../chunks/copy-button.module.js";
8
- import { jsx as r } from "react/jsx-runtime";
9
- const N = ({
8
+ import { jsx as c } from "react/jsx-runtime";
9
+ const y = "_copyButton_1mhca_1", C = {
10
+ copyButton: y
11
+ }, N = ({
10
12
  answer: i,
11
13
  recordAction: a
12
14
  }) => {
@@ -14,9 +16,9 @@ const N = ({
14
16
  formatMessage: o
15
17
  } = u(), {
16
18
  addNotification: e
17
- } = n(), c = () => {
19
+ } = n(), r = () => {
18
20
  a && a({
19
- ...d,
21
+ ...f,
20
22
  action: b,
21
23
  target: "copyToClipboard"
22
24
  }), i && navigator && navigator.clipboard && navigator.clipboard.writeText && navigator.clipboard.writeText(i).then(() => {
@@ -25,17 +27,17 @@ const N = ({
25
27
  styledText: o(t.copyToClipboardSucceeded),
26
28
  variant: "success",
27
29
  typeIconAriaLabel: o(t.copyButtonSuccessText),
28
- closeButtonAriaLabel: o(f.closeButtonText)
30
+ closeButtonAriaLabel: o(d.closeButtonText)
29
31
  });
30
32
  });
31
33
  };
32
- return /* @__PURE__ */ r(p, {
34
+ return /* @__PURE__ */ c(p, {
33
35
  content: o(t.copyToClipboard),
34
- children: /* @__PURE__ */ r(l, {
36
+ children: /* @__PURE__ */ c(l, {
35
37
  "aria-label": o(t.copyToClipboard),
36
38
  className: C.copyButton,
37
39
  icon: m,
38
- onClick: c,
40
+ onClick: r,
39
41
  onFocusCapture: (s) => {
40
42
  s.target.matches(":focus-visible") || s.stopPropagation();
41
43
  },
@@ -1,73 +1,83 @@
1
- import { useBreakpoint as h, Breakpoint as E, Text as u } from "@box/blueprint-web";
2
- import { BoxAi as g, AlertTriangle as N } from "@box/blueprint-web-assets/icons/Line";
3
- import { Size5 as n, Size6 as S } from "@box/blueprint-web-assets/tokens/tokens";
4
- import * as l from "react";
5
- import { useIntl as v } from "react-intl";
6
- import { A as m } from "../../../../chunks/types.js";
7
- import { LOGGER_BASE_CONFIG as x } from "../common/constants.js";
8
- import { MediaContainer as a } from "../common/media-container.js";
9
- import o from "./messages.js";
10
- import { s as e } from "../../../../chunks/inline-error.module.js";
11
- import { jsx as r, jsxs as c } from "react/jsx-runtime";
12
- const b = ({
13
- error: t,
14
- recordAction: i,
15
- useAnimation: d
1
+ import "../../../../styles/inline-error.css";
2
+ import { useBreakpoint as _, 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 a, Size6 as v } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import * as d from "react";
6
+ import { useIntl as g } from "react-intl";
7
+ import { A as s } from "../../../../chunks/types.js";
8
+ import { LOGGER_BASE_CONFIG as A } from "../common/constants.js";
9
+ import { MediaContainer as l } from "../common/media-container.js";
10
+ import t from "./messages.js";
11
+ import { jsx as r, jsxs as f } from "react/jsx-runtime";
12
+ const S = "_inlineError_ft07o_1", T = "_text_ft07o_4", I = "_icon_ft07o_14", R = "_iconAvatar_ft07o_18", i = {
13
+ inlineError: S,
14
+ text: T,
15
+ icon: I,
16
+ iconAvatar: R
17
+ }, j = ({
18
+ error: n,
19
+ contentType: c,
20
+ recordAction: o,
21
+ useAnimation: E
16
22
  }) => {
17
23
  const {
18
- formatMessage: p
19
- } = v();
20
- l.useEffect(() => {
21
- i && i({
22
- ...x,
24
+ formatMessage: e
25
+ } = g();
26
+ d.useEffect(() => {
27
+ o && o({
28
+ ...A,
23
29
  target: "inlineError"
24
30
  });
25
- }, [i]);
26
- const f = l.useCallback(() => {
27
- switch (t) {
28
- case m.RATE_LIMITING:
29
- return o.inlineRateLimitingErrorText;
30
- case m.NO_CONTENT:
31
- return o.inlineNoContentErrorText;
31
+ }, [o]);
32
+ const p = d.useCallback(() => {
33
+ switch (n) {
34
+ case s.RATE_LIMITING:
35
+ return e(t.inlineRateLimitingErrorText);
36
+ case s.NO_CONTENT:
37
+ return e(t.inlineNoContentErrorText);
38
+ case s.PRECONDITION_FAILED:
39
+ return e(t.inlinePreconditionFailedErrorText, {
40
+ type: c
41
+ });
32
42
  default:
33
- return o.inlineErrorText;
43
+ return e(t.inlineErrorText);
34
44
  }
35
- }, [t]), s = h() === E.Small ? n : S;
45
+ }, [c, n, e]), m = _() === h.Small ? a : v;
36
46
  return /* @__PURE__ */ r("div", {
37
- className: e.inlineError,
47
+ className: i.inlineError,
38
48
  "data-testid": "content-answers-inline-error",
39
- children: /* @__PURE__ */ c(a, {
40
- children: [/* @__PURE__ */ r(a.Figure, {
49
+ children: /* @__PURE__ */ f(l, {
50
+ children: [/* @__PURE__ */ r(l.Figure, {
41
51
  variant: "center-aligned",
42
52
  children: /* @__PURE__ */ r("div", {
43
- className: e.iconAvatar,
44
- children: /* @__PURE__ */ r(g, {
45
- height: s,
53
+ className: i.iconAvatar,
54
+ children: /* @__PURE__ */ r(x, {
55
+ height: m,
46
56
  role: "presentation",
47
- width: s
57
+ width: m
48
58
  })
49
59
  })
50
- }), /* @__PURE__ */ c(a.Content, {
60
+ }), /* @__PURE__ */ f(l.Content, {
51
61
  shouldAddCard: !1,
52
- useAnimation: d,
62
+ useAnimation: E,
53
63
  variant: "error",
54
64
  children: [/* @__PURE__ */ r("div", {
55
- className: e.icon,
65
+ className: i.icon,
56
66
  children: /* @__PURE__ */ r(N, {
57
- height: n,
67
+ height: a,
58
68
  role: "presentation",
59
- width: n
69
+ width: a
60
70
  })
61
71
  }), /* @__PURE__ */ r(u, {
62
72
  as: "p",
63
- className: e.text,
64
- children: t && p(f())
73
+ className: i.text,
74
+ children: n && p()
65
75
  })]
66
76
  })]
67
77
  })
68
78
  });
69
79
  };
70
80
  export {
71
- b as InlineError,
72
- b as default
81
+ j as InlineError,
82
+ j as default
73
83
  };