@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.
- package/chunks/types.js +1 -1
- package/esm/lib/components/answer/answer-content.js +20 -17
- package/esm/lib/components/answer/answer.js +73 -63
- package/esm/lib/components/answer/citation.js +74 -65
- package/esm/lib/components/answer/copy-button.js +13 -11
- package/esm/lib/components/answer/inline-error.js +55 -45
- package/esm/lib/components/answer/loading-element.js +30 -26
- package/esm/lib/components/answer/messages.js +6 -2
- package/esm/lib/components/answer/references.js +22 -20
- package/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +108 -108
- package/esm/lib/components/chat/chat.js +52 -51
- package/esm/lib/components/common/mock-data.js +6 -23
- package/i18n/bn-IN.js +1 -0
- package/i18n/da-DK.js +1 -0
- package/i18n/de-DE.js +1 -0
- package/i18n/en-AU.js +1 -0
- package/i18n/en-CA.js +1 -0
- package/i18n/en-GB.js +1 -0
- package/i18n/en-US.js +1 -0
- package/i18n/en-US.properties +2 -0
- package/i18n/en-x-pseudo.js +1 -0
- package/i18n/es-419.js +1 -0
- package/i18n/es-ES.js +1 -0
- package/i18n/fi-FI.js +1 -0
- package/i18n/fr-CA.js +1 -0
- package/i18n/fr-FR.js +1 -0
- package/i18n/hi-IN.js +1 -0
- package/i18n/it-IT.js +1 -0
- package/i18n/ja-JP.js +1 -0
- package/i18n/json/src/lib/components/answer/messages.json +1 -1
- package/i18n/ko-KR.js +1 -0
- package/i18n/nb-NO.js +1 -0
- package/i18n/nl-NL.js +1 -0
- package/i18n/pl-PL.js +1 -0
- package/i18n/pt-BR.js +1 -0
- package/i18n/ru-RU.js +1 -0
- package/i18n/sv-SE.js +1 -0
- package/i18n/tr-TR.js +1 -0
- package/i18n/zh-CN.js +1 -0
- package/i18n/zh-TW.js +1 -0
- package/package.json +2 -2
- package/types/lib/components/answer/answer.d.ts +2 -0
- package/types/lib/components/answer/inline-error.d.ts +2 -1
- package/types/lib/components/answer/messages.d.ts +5 -0
- package/types/lib/types.d.ts +1 -0
- package/chunks/answer-content.module.js +0 -8
- package/chunks/answer.module.js +0 -13
- package/chunks/citation.module.js +0 -14
- package/chunks/copy-button.module.js +0 -7
- package/chunks/inline-error.module.js +0 -10
- package/chunks/loading.module.js +0 -9
- package/chunks/references.module.js +0 -7
- /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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { jsxs as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 =
|
|
12
|
-
return
|
|
13
|
-
children: [!
|
|
14
|
-
className:
|
|
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:
|
|
17
|
-
}),
|
|
18
|
-
className:
|
|
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
|
-
|
|
28
|
-
|
|
30
|
+
p as AnswerContent,
|
|
31
|
+
p as default
|
|
29
32
|
};
|
|
@@ -1,100 +1,110 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
|
9
|
-
import { AnswerContent as
|
|
10
|
-
import { CopyButton as
|
|
11
|
-
import { InlineError as
|
|
12
|
-
import { LoadingElement as
|
|
13
|
-
import
|
|
14
|
-
import { References as
|
|
15
|
-
import { s as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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:
|
|
27
|
-
onCitationClick:
|
|
28
|
-
recordAction:
|
|
29
|
-
useAnimation:
|
|
35
|
+
isStreamingEnabled: i = !1,
|
|
36
|
+
onCitationClick: P,
|
|
37
|
+
recordAction: c,
|
|
38
|
+
useAnimation: m = !0
|
|
30
39
|
}) => {
|
|
31
|
-
const E =
|
|
32
|
-
formatMessage:
|
|
33
|
-
} =
|
|
34
|
-
|
|
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
|
-
|
|
40
|
-
}, [
|
|
41
|
-
const
|
|
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 &&
|
|
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:
|
|
58
|
+
color: k,
|
|
50
59
|
"data-testid": "content-answers-error-alert-icon",
|
|
51
|
-
height:
|
|
60
|
+
height: S,
|
|
52
61
|
role: "presentation",
|
|
53
|
-
width:
|
|
62
|
+
width: S
|
|
54
63
|
})]
|
|
55
64
|
});
|
|
56
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ s("div", {
|
|
57
66
|
"aria-live": "polite",
|
|
58
67
|
className: o.answer,
|
|
59
68
|
"data-testid": "content-answers-answer",
|
|
60
|
-
children: [!
|
|
61
|
-
children: [/* @__PURE__ */ t(
|
|
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:
|
|
73
|
+
children: /* @__PURE__ */ t(L, {
|
|
74
|
+
height: v,
|
|
66
75
|
role: "presentation",
|
|
67
|
-
width:
|
|
76
|
+
width: v
|
|
68
77
|
})
|
|
69
78
|
})
|
|
70
|
-
}), /* @__PURE__ */
|
|
71
|
-
useAnimation:
|
|
72
|
-
children: [/* @__PURE__ */ t(
|
|
73
|
-
answer:
|
|
79
|
+
}), /* @__PURE__ */ s(p.Content, {
|
|
80
|
+
useAnimation: m,
|
|
81
|
+
children: [/* @__PURE__ */ t(M, {
|
|
82
|
+
answer: n,
|
|
74
83
|
isMarkdownEnabled: O
|
|
75
|
-
}),
|
|
76
|
-
className:
|
|
77
|
-
[o.animated]:
|
|
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 &&
|
|
81
|
-
citations:
|
|
82
|
-
onCitationClick:
|
|
83
|
-
recordAction:
|
|
84
|
-
}), /* @__PURE__ */ t(
|
|
85
|
-
answer:
|
|
86
|
-
recordAction:
|
|
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
|
-
}),
|
|
99
|
+
}), _ && /* @__PURE__ */ t(b, {
|
|
100
|
+
contentType: N,
|
|
91
101
|
error: e,
|
|
92
|
-
recordAction:
|
|
93
|
-
useAnimation:
|
|
94
|
-
}), h && /* @__PURE__ */ t(
|
|
102
|
+
recordAction: c,
|
|
103
|
+
useAnimation: m
|
|
104
|
+
}), h && /* @__PURE__ */ t(j, {})]
|
|
95
105
|
});
|
|
96
106
|
});
|
|
97
107
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
Ee as Answer,
|
|
109
|
+
Ee as default
|
|
100
110
|
};
|
|
@@ -1,34 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { jsxs as
|
|
13
|
-
const
|
|
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:
|
|
24
|
+
content: m,
|
|
16
25
|
id: a,
|
|
17
|
-
recordAction:
|
|
18
|
-
fileId:
|
|
19
|
-
title:
|
|
20
|
-
onCitationClick:
|
|
26
|
+
recordAction: i,
|
|
27
|
+
fileId: _,
|
|
28
|
+
title: c,
|
|
29
|
+
onCitationClick: l
|
|
21
30
|
}) => {
|
|
22
|
-
const [g,
|
|
23
|
-
formatMessage:
|
|
24
|
-
} =
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
title:
|
|
28
|
-
}) :
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
...
|
|
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
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
...
|
|
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:
|
|
55
|
+
target: j,
|
|
47
56
|
data: {
|
|
48
57
|
index: a
|
|
49
58
|
}
|
|
50
59
|
}));
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
p &&
|
|
60
|
+
}, [l, i, a, _, c]);
|
|
61
|
+
F(() => {
|
|
62
|
+
p && S(!0);
|
|
54
63
|
}, []);
|
|
55
|
-
const
|
|
56
|
-
length:
|
|
64
|
+
const f = m ? D(m.toString(), {
|
|
65
|
+
length: K,
|
|
57
66
|
separator: /,? +/
|
|
58
67
|
}) : void 0;
|
|
59
|
-
return /* @__PURE__ */
|
|
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:
|
|
66
|
-
children: /* @__PURE__ */ e(
|
|
67
|
-
ref:
|
|
68
|
-
"aria-label": g ?
|
|
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:
|
|
80
|
+
className: L(o.citationStatus, {
|
|
72
81
|
[o.animate]: p,
|
|
73
|
-
[o.fadeIn]:
|
|
82
|
+
[o.fadeIn]: N
|
|
74
83
|
}),
|
|
75
84
|
colorIndex: 0,
|
|
76
85
|
"data-testid": "content-answers-citation-status",
|
|
77
86
|
interactive: !0,
|
|
78
|
-
onBlur:
|
|
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":
|
|
93
|
+
"aria-label": f,
|
|
85
94
|
collisionPadding: 10,
|
|
86
95
|
"data-testid": "content-answers-citation-card",
|
|
87
|
-
onBlur:
|
|
96
|
+
onBlur: r,
|
|
88
97
|
onCloseAutoFocus: (t) => t.preventDefault(),
|
|
89
98
|
onEscapeKeyDown: () => {
|
|
90
99
|
var t;
|
|
91
|
-
(t =
|
|
100
|
+
(t = w.current) == null || t.focus(), r();
|
|
92
101
|
},
|
|
93
102
|
onFocus: u,
|
|
94
103
|
onMouseEnter: u,
|
|
95
|
-
onMouseLeave:
|
|
104
|
+
onMouseLeave: r,
|
|
96
105
|
onOpenAutoFocus: (t) => {
|
|
97
|
-
|
|
106
|
+
h || t.preventDefault();
|
|
98
107
|
},
|
|
99
108
|
side: "top",
|
|
100
109
|
sideOffset: 5,
|
|
101
110
|
children: /* @__PURE__ */ e(d.MainContent, {
|
|
102
|
-
children: /* @__PURE__ */
|
|
111
|
+
children: /* @__PURE__ */ y("div", {
|
|
103
112
|
className: o.cardTooltip,
|
|
104
|
-
children: [/* @__PURE__ */ e(
|
|
113
|
+
children: [/* @__PURE__ */ e(x, {
|
|
105
114
|
as: "h4",
|
|
106
115
|
className: o.cardTooltipTitle,
|
|
107
116
|
variant: "bodyDefaultBold",
|
|
108
|
-
children:
|
|
109
|
-
}), /* @__PURE__ */ e(
|
|
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:
|
|
115
|
-
}),
|
|
116
|
-
"aria-label":
|
|
123
|
+
children: f
|
|
124
|
+
}), h && /* @__PURE__ */ e(k, {
|
|
125
|
+
"aria-label": n(s.cardTooltipButton),
|
|
117
126
|
className: o.cardTooltipButton,
|
|
118
|
-
icon:
|
|
119
|
-
onClick:
|
|
120
|
-
children:
|
|
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
|
-
|
|
129
|
-
|
|
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
|
|
5
|
-
import { LOGGER_BASE_CONFIG as
|
|
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 {
|
|
8
|
-
|
|
9
|
-
|
|
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(),
|
|
19
|
+
} = n(), r = () => {
|
|
18
20
|
a && a({
|
|
19
|
-
...
|
|
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(
|
|
30
|
+
closeButtonAriaLabel: o(d.closeButtonText)
|
|
29
31
|
});
|
|
30
32
|
});
|
|
31
33
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ c(p, {
|
|
33
35
|
content: o(t.copyToClipboard),
|
|
34
|
-
children: /* @__PURE__ */
|
|
36
|
+
children: /* @__PURE__ */ c(l, {
|
|
35
37
|
"aria-label": o(t.copyToClipboard),
|
|
36
38
|
className: C.copyButton,
|
|
37
39
|
icon: m,
|
|
38
|
-
onClick:
|
|
40
|
+
onClick: r,
|
|
39
41
|
onFocusCapture: (s) => {
|
|
40
42
|
s.target.matches(":focus-visible") || s.stopPropagation();
|
|
41
43
|
},
|
|
@@ -1,73 +1,83 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { jsx as r, jsxs as
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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:
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...
|
|
24
|
+
formatMessage: e
|
|
25
|
+
} = g();
|
|
26
|
+
d.useEffect(() => {
|
|
27
|
+
o && o({
|
|
28
|
+
...A,
|
|
23
29
|
target: "inlineError"
|
|
24
30
|
});
|
|
25
|
-
}, [
|
|
26
|
-
const
|
|
27
|
-
switch (
|
|
28
|
-
case
|
|
29
|
-
return
|
|
30
|
-
case
|
|
31
|
-
return
|
|
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
|
|
43
|
+
return e(t.inlineErrorText);
|
|
34
44
|
}
|
|
35
|
-
}, [
|
|
45
|
+
}, [c, n, e]), m = _() === h.Small ? a : v;
|
|
36
46
|
return /* @__PURE__ */ r("div", {
|
|
37
|
-
className:
|
|
47
|
+
className: i.inlineError,
|
|
38
48
|
"data-testid": "content-answers-inline-error",
|
|
39
|
-
children: /* @__PURE__ */
|
|
40
|
-
children: [/* @__PURE__ */ r(
|
|
49
|
+
children: /* @__PURE__ */ f(l, {
|
|
50
|
+
children: [/* @__PURE__ */ r(l.Figure, {
|
|
41
51
|
variant: "center-aligned",
|
|
42
52
|
children: /* @__PURE__ */ r("div", {
|
|
43
|
-
className:
|
|
44
|
-
children: /* @__PURE__ */ r(
|
|
45
|
-
height:
|
|
53
|
+
className: i.iconAvatar,
|
|
54
|
+
children: /* @__PURE__ */ r(x, {
|
|
55
|
+
height: m,
|
|
46
56
|
role: "presentation",
|
|
47
|
-
width:
|
|
57
|
+
width: m
|
|
48
58
|
})
|
|
49
59
|
})
|
|
50
|
-
}), /* @__PURE__ */
|
|
60
|
+
}), /* @__PURE__ */ f(l.Content, {
|
|
51
61
|
shouldAddCard: !1,
|
|
52
|
-
useAnimation:
|
|
62
|
+
useAnimation: E,
|
|
53
63
|
variant: "error",
|
|
54
64
|
children: [/* @__PURE__ */ r("div", {
|
|
55
|
-
className:
|
|
65
|
+
className: i.icon,
|
|
56
66
|
children: /* @__PURE__ */ r(N, {
|
|
57
|
-
height:
|
|
67
|
+
height: a,
|
|
58
68
|
role: "presentation",
|
|
59
|
-
width:
|
|
69
|
+
width: a
|
|
60
70
|
})
|
|
61
71
|
}), /* @__PURE__ */ r(u, {
|
|
62
72
|
as: "p",
|
|
63
|
-
className:
|
|
64
|
-
children:
|
|
73
|
+
className: i.text,
|
|
74
|
+
children: n && p()
|
|
65
75
|
})]
|
|
66
76
|
})]
|
|
67
77
|
})
|
|
68
78
|
});
|
|
69
79
|
};
|
|
70
80
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
j as InlineError,
|
|
82
|
+
j as default
|
|
73
83
|
};
|