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