@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.
- package/esm/lib/box-ai-content-answers.js +63 -60
- package/esm/lib/components/agents/agent-editor.js +9 -9
- package/esm/lib/components/answer/answer-content.js +19 -17
- package/esm/lib/components/answer/answer.js +90 -81
- package/esm/lib/components/answer/inline-error.js +45 -41
- package/esm/lib/components/answer/loading-element.js +32 -26
- package/esm/lib/components/chat/chat.js +61 -56
- package/esm/lib/components/common/media-container.js +40 -35
- package/esm/lib/components/content/content.js +43 -41
- package/esm/lib/components/footer/footer.js +55 -54
- package/esm/lib/components/question/question.js +34 -27
- package/esm/lib/components/suggested-questions/suggested-questions.js +58 -54
- package/esm/lib/components/suggested-questions/suggestions.js +18 -15
- package/esm/lib/components/welcome-message/welcome-message.js +45 -39
- package/package.json +2 -2
- package/styles/agent-editor.css +1 -1
- package/styles/answer-content.css +1 -1
- package/styles/box-ai-content-answers.css +1 -1
- package/styles/content.css +1 -1
- package/styles/media-container.css +1 -1
- package/styles/question.css +1 -1
- package/styles/suggested-questions.css +1 -1
- package/styles/suggestions.css +1 -1
- package/styles/welcome-message.css +1 -1
- package/types/lib/box-ai-content-answers.d.ts +1 -0
- package/types/lib/components/answer/answer-content.d.ts +2 -1
- package/types/lib/components/answer/answer.d.ts +1 -0
- package/types/lib/components/answer/inline-error.d.ts +2 -1
- package/types/lib/components/answer/loading-element.d.ts +4 -1
- package/types/lib/components/chat/chat.d.ts +1 -1
- package/types/lib/components/common/media-container.d.ts +3 -0
- package/types/lib/components/content/content.d.ts +1 -1
- package/types/lib/components/footer/footer.d.ts +2 -1
- package/types/lib/components/question/question.d.ts +2 -1
- package/types/lib/components/suggested-questions/suggested-questions.d.ts +2 -1
- package/types/lib/components/suggested-questions/suggestions.d.ts +2 -1
- package/types/lib/components/welcome-message/welcome-message.d.ts +1 -1
- package/types/lib/stories/shared.d.ts +1 -0
- 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
|
|
7
|
-
import { jsx as
|
|
8
|
-
const
|
|
9
|
-
container:
|
|
10
|
-
contentAnswers:
|
|
11
|
-
},
|
|
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:
|
|
13
|
+
contentType: l,
|
|
14
14
|
error: t,
|
|
15
|
-
hasRequestInProgress:
|
|
16
|
-
isAgentSelectorEnabled:
|
|
17
|
-
isAIStudioAgentSelectorEnabled:
|
|
18
|
-
isDebugModeEnabled:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 [
|
|
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__ */
|
|
37
|
-
className: C(S,
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
-
className:
|
|
40
|
-
children: [!e && /* @__PURE__ */
|
|
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:
|
|
43
|
-
contentType:
|
|
43
|
+
askSuggestedQuestion: g,
|
|
44
|
+
contentType: l,
|
|
44
45
|
error: t,
|
|
45
|
-
hasRequestInProgress:
|
|
46
|
-
isErrorMessageShown:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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:
|
|
53
|
-
suggestedQuestions:
|
|
54
|
-
useAnimation:
|
|
55
|
-
userInfo:
|
|
56
|
-
}), e && /* @__PURE__ */
|
|
54
|
+
showLoadingIndicator: m,
|
|
55
|
+
suggestedQuestions: b,
|
|
56
|
+
useAnimation: n && y,
|
|
57
|
+
userInfo: a
|
|
58
|
+
}), e && /* @__PURE__ */ o(F, {
|
|
57
59
|
onAgentEditorToggle: E,
|
|
58
|
-
recordAction:
|
|
60
|
+
recordAction: i,
|
|
59
61
|
setIsDebugModeShown: p
|
|
60
|
-
}), k && /* @__PURE__ */
|
|
61
|
-
askSuggestedQuestion:
|
|
62
|
-
contentType:
|
|
63
|
-
enableDebugMode:
|
|
64
|
-
hasRequestInProgress:
|
|
65
|
-
isAgentSelectorEnabled:
|
|
66
|
-
isAIStudioAgentSelectorEnabled:
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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:
|
|
82
|
+
user: a
|
|
80
83
|
})]
|
|
81
84
|
})
|
|
82
85
|
});
|
|
83
86
|
};
|
|
84
87
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
8
|
-
import { LOGGER_BASE_CONFIG as
|
|
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 = "
|
|
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 =
|
|
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
|
|
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
|
-
},
|
|
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:
|
|
50
|
-
onKeyDown:
|
|
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
|
|
3
|
-
import
|
|
4
|
-
import { jsxs as
|
|
5
|
-
const
|
|
6
|
-
answerContent:
|
|
7
|
-
|
|
8
|
-
|
|
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:
|
|
13
|
+
className: s,
|
|
12
14
|
...o
|
|
13
15
|
}) => {
|
|
14
|
-
let
|
|
15
|
-
return t && n && (
|
|
16
|
-
children: [!t && /* @__PURE__ */
|
|
17
|
-
className:
|
|
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__ */
|
|
21
|
-
className:
|
|
22
|
+
}), t && /* @__PURE__ */ d("div", {
|
|
23
|
+
className: i(e.answerContent, e.answerMarkdown, r && e.isSidebarOpen, "Answer-text", s),
|
|
22
24
|
dangerouslySetInnerHTML: {
|
|
23
|
-
__html:
|
|
25
|
+
__html: a
|
|
24
26
|
},
|
|
25
27
|
...o
|
|
26
28
|
})]
|
|
27
29
|
});
|
|
28
30
|
};
|
|
29
31
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
v as AnswerContent,
|
|
33
|
+
v as default
|
|
32
34
|
};
|
|
@@ -1,107 +1,116 @@
|
|
|
1
1
|
import "../../../../styles/answer.css";
|
|
2
|
-
import { useBreakpoint as
|
|
3
|
-
import { BoxAi as
|
|
4
|
-
import { Size5 as
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import { A as
|
|
9
|
-
import { MediaContainer as
|
|
10
|
-
import { AnswerContent as
|
|
11
|
-
import { CopyButton as
|
|
12
|
-
import { InlineError as
|
|
13
|
-
import { LoadingElement as
|
|
14
|
-
import
|
|
15
|
-
import { References as
|
|
16
|
-
import { jsxs as
|
|
17
|
-
const
|
|
18
|
-
answer:
|
|
19
|
-
alertIcon:
|
|
20
|
-
error:
|
|
21
|
-
footer:
|
|
22
|
-
shouldHaveMarginTop:
|
|
23
|
-
shouldUseAnimation:
|
|
24
|
-
shouldAnimateHeight:
|
|
25
|
-
iconAvatar:
|
|
26
|
-
},
|
|
27
|
-
answer:
|
|
28
|
-
citations:
|
|
29
|
-
error:
|
|
30
|
-
contentType:
|
|
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:
|
|
33
|
-
isLoading:
|
|
34
|
-
isMarkdownEnabled:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
41
|
-
formatMessage:
|
|
42
|
-
} =
|
|
43
|
-
|
|
44
|
-
setTimeout(() =>
|
|
45
|
-
}, [
|
|
46
|
-
const
|
|
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:
|
|
49
|
+
color: b,
|
|
49
50
|
"data-testid": "content-answers-error-alert-icon",
|
|
50
|
-
height:
|
|
51
|
+
height: p,
|
|
51
52
|
role: "presentation",
|
|
52
|
-
width:
|
|
53
|
-
}),
|
|
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: [
|
|
60
|
-
}),
|
|
61
|
-
answer:
|
|
62
|
-
onAnswerCopy:
|
|
63
|
-
recordAction:
|
|
64
|
-
}) :
|
|
65
|
-
return /* @__PURE__ */
|
|
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: [!
|
|
70
|
-
|
|
71
|
-
|
|
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__ */
|
|
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__ */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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: [
|
|
91
|
-
citations:
|
|
92
|
-
onCitationClick:
|
|
93
|
-
recordAction:
|
|
94
|
-
}),
|
|
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
|
-
}),
|
|
98
|
-
contentType:
|
|
99
|
-
error:
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
106
|
-
|
|
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
|
|
3
|
-
import { BoxAi as
|
|
4
|
-
import { Size5 as
|
|
5
|
-
import * as
|
|
6
|
-
import { useIntl as
|
|
7
|
-
import { A as
|
|
8
|
-
import { LOGGER_BASE_CONFIG as
|
|
9
|
-
import { MediaContainer as
|
|
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
|
|
12
|
-
const
|
|
13
|
-
inlineError:
|
|
14
|
-
text:
|
|
15
|
-
icon:
|
|
16
|
-
iconAvatar:
|
|
17
|
-
},
|
|
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:
|
|
20
|
-
|
|
19
|
+
contentType: m,
|
|
20
|
+
isSidebarOpen: o = !1,
|
|
21
|
+
recordAction: a
|
|
21
22
|
}) => {
|
|
22
23
|
const {
|
|
23
24
|
formatMessage: e
|
|
24
|
-
} =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...
|
|
25
|
+
} = g();
|
|
26
|
+
f.useEffect(() => {
|
|
27
|
+
a && a({
|
|
28
|
+
...A,
|
|
28
29
|
target: "inlineError"
|
|
29
30
|
});
|
|
30
|
-
}, [
|
|
31
|
-
const
|
|
31
|
+
}, [a]);
|
|
32
|
+
const _ = f.useCallback(() => {
|
|
32
33
|
switch (n) {
|
|
33
|
-
case
|
|
34
|
+
case l.RATE_LIMITING:
|
|
34
35
|
return e(t.inlineRateLimitingErrorText);
|
|
35
|
-
case
|
|
36
|
+
case l.NO_CONTENT:
|
|
36
37
|
return e(t.inlineNoContentErrorText);
|
|
37
|
-
case
|
|
38
|
+
case l.PRECONDITION_FAILED:
|
|
38
39
|
return e(t.inlinePreconditionFailedErrorText, {
|
|
39
|
-
type:
|
|
40
|
+
type: m
|
|
40
41
|
});
|
|
41
42
|
default:
|
|
42
43
|
return e(t.inlineErrorText);
|
|
43
44
|
}
|
|
44
|
-
}, [
|
|
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__ */
|
|
49
|
-
|
|
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(
|
|
54
|
-
height:
|
|
56
|
+
children: /* @__PURE__ */ r(x, {
|
|
57
|
+
height: d,
|
|
55
58
|
role: "presentation",
|
|
56
|
-
width:
|
|
59
|
+
width: d
|
|
57
60
|
})
|
|
58
61
|
})
|
|
59
|
-
}), /* @__PURE__ */
|
|
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(
|
|
65
|
-
height:
|
|
68
|
+
children: /* @__PURE__ */ r(N, {
|
|
69
|
+
height: s,
|
|
66
70
|
role: "presentation",
|
|
67
|
-
width:
|
|
71
|
+
width: s
|
|
68
72
|
})
|
|
69
|
-
}), /* @__PURE__ */ r(
|
|
73
|
+
}), /* @__PURE__ */ r(u, {
|
|
70
74
|
as: "p",
|
|
71
75
|
className: i.text,
|
|
72
|
-
children: n &&
|
|
76
|
+
children: n && _()
|
|
73
77
|
})]
|
|
74
78
|
})]
|
|
75
79
|
})
|
|
76
80
|
});
|
|
77
81
|
};
|
|
78
82
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
D as InlineError,
|
|
84
|
+
D as default
|
|
81
85
|
};
|