@box/box-ai-content-answers 0.103.0 → 0.105.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 +79 -74
- package/esm/lib/components/answer/inline-error.js +57 -69
- package/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +128 -119
- package/esm/lib/components/chat/chat.js +63 -60
- package/esm/lib/components/footer/footer-actions.js +26 -22
- package/esm/lib/components/footer/footer.js +74 -70
- package/esm/lib/components/suggested-questions/suggested-questions.js +32 -30
- package/esm/lib/components/suggested-questions/suggestions.js +31 -27
- package/i18n/bn-IN.js +2 -2
- package/i18n/bn-IN.properties +2 -2
- package/i18n/da-DK.js +2 -2
- package/i18n/da-DK.properties +2 -2
- package/i18n/de-DE.js +2 -2
- package/i18n/de-DE.properties +2 -2
- package/i18n/en-AU.js +2 -2
- package/i18n/en-AU.properties +2 -2
- package/i18n/en-GB.js +2 -2
- package/i18n/en-GB.properties +2 -2
- package/i18n/es-419.js +2 -2
- package/i18n/es-419.properties +2 -2
- package/i18n/es-ES.js +2 -2
- package/i18n/es-ES.properties +2 -2
- package/i18n/fi-FI.js +2 -2
- package/i18n/fi-FI.properties +2 -2
- package/i18n/fr-CA.js +2 -2
- package/i18n/fr-CA.properties +2 -2
- package/i18n/fr-FR.js +2 -2
- package/i18n/fr-FR.properties +2 -2
- package/i18n/hi-IN.js +2 -2
- package/i18n/hi-IN.properties +2 -2
- package/i18n/it-IT.js +2 -2
- package/i18n/it-IT.properties +2 -2
- package/i18n/ja-JP.js +2 -2
- package/i18n/ja-JP.properties +2 -2
- package/i18n/ko-KR.js +2 -2
- package/i18n/ko-KR.properties +2 -2
- package/i18n/nb-NO.js +2 -2
- package/i18n/nb-NO.properties +2 -2
- package/i18n/nl-NL.js +2 -2
- package/i18n/nl-NL.properties +2 -2
- package/i18n/pl-PL.js +2 -2
- package/i18n/pl-PL.properties +2 -2
- package/i18n/pt-BR.js +2 -2
- package/i18n/pt-BR.properties +2 -2
- package/i18n/ru-RU.js +2 -2
- package/i18n/ru-RU.properties +2 -2
- package/i18n/sv-SE.js +2 -2
- package/i18n/sv-SE.properties +2 -2
- package/i18n/tr-TR.js +2 -2
- package/i18n/tr-TR.properties +2 -2
- package/i18n/zh-CN.js +2 -2
- package/i18n/zh-CN.properties +2 -2
- package/i18n/zh-TW.js +2 -2
- package/i18n/zh-TW.properties +2 -2
- package/package.json +3 -3
- package/types/lib/box-ai-content-answers.d.ts +6 -4
- package/types/lib/components/api-wrapper/hooks/useContentAnswers.d.ts +1 -1
- package/types/lib/components/api-wrapper/types.d.ts +1 -0
- package/types/lib/components/chat/chat.d.ts +1 -1
- package/types/lib/components/footer/footer-actions.d.ts +2 -1
- package/types/lib/components/footer/footer.d.ts +3 -1
- package/types/lib/components/suggested-questions/suggested-questions.d.ts +3 -1
- package/types/lib/components/suggested-questions/suggestions.d.ts +3 -1
- package/types/lib/types.d.ts +4 -0
|
@@ -1,97 +1,102 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import { AgentEditor as
|
|
4
|
-
import { Content as
|
|
5
|
-
import { Footer as
|
|
6
|
-
import { C as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import '../../styles/box-ai-content-answers.css';const
|
|
9
|
-
container:
|
|
10
|
-
contentAnswers:
|
|
11
|
-
sidebar:
|
|
12
|
-
},
|
|
13
|
-
className:
|
|
14
|
-
contentType:
|
|
15
|
-
contentName:
|
|
1
|
+
import p from "clsx";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { AgentEditor as L } from "./components/agents/agent-editor.js";
|
|
4
|
+
import { Content as T } from "./components/content/content.js";
|
|
5
|
+
import { Footer as H } from "./components/footer/footer.js";
|
|
6
|
+
import { C as J } from "../../chunks/types.js";
|
|
7
|
+
import { jsx as s, jsxs as K } from "react/jsx-runtime";
|
|
8
|
+
import '../../styles/box-ai-content-answers.css';const U = "_container_xgwyz_1", V = "_contentAnswers_xgwyz_8", W = "_sidebar_xgwyz_19", a = {
|
|
9
|
+
container: U,
|
|
10
|
+
contentAnswers: V,
|
|
11
|
+
sidebar: W
|
|
12
|
+
}, q = ({
|
|
13
|
+
className: S,
|
|
14
|
+
contentType: b,
|
|
15
|
+
contentName: x,
|
|
16
16
|
error: e,
|
|
17
|
-
hasCustomSuggestedQuestions:
|
|
18
|
-
hasRequestInProgress:
|
|
19
|
-
isAgentSelectorEnabled:
|
|
20
|
-
isAIStudioAgentSelectorEnabled:
|
|
21
|
-
isDebugModeEnabled:
|
|
22
|
-
isStopResponseEnabled:
|
|
17
|
+
hasCustomSuggestedQuestions: E,
|
|
18
|
+
hasRequestInProgress: d,
|
|
19
|
+
isAgentSelectorEnabled: h,
|
|
20
|
+
isAIStudioAgentSelectorEnabled: Q,
|
|
21
|
+
isDebugModeEnabled: M,
|
|
22
|
+
isStopResponseEnabled: R,
|
|
23
23
|
isStreamingEnabled: c,
|
|
24
24
|
questions: r,
|
|
25
|
-
recordAction:
|
|
26
|
-
retryQuestion:
|
|
27
|
-
showLoadingIndicator:
|
|
28
|
-
stopQuestion:
|
|
29
|
-
submitQuestion:
|
|
30
|
-
suggestedQuestions:
|
|
31
|
-
useAnimation:
|
|
32
|
-
onAgentEditorToggle:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
recordAction: l,
|
|
26
|
+
retryQuestion: y,
|
|
27
|
+
showLoadingIndicator: u,
|
|
28
|
+
stopQuestion: z,
|
|
29
|
+
submitQuestion: C,
|
|
30
|
+
suggestedQuestions: D,
|
|
31
|
+
useAnimation: F,
|
|
32
|
+
onAgentEditorToggle: N,
|
|
33
|
+
onUserIntentToUseAI: m,
|
|
34
|
+
variant: t = "modal",
|
|
35
|
+
hostAppName: j,
|
|
36
|
+
...k
|
|
36
37
|
}) => {
|
|
37
|
-
const [
|
|
38
|
-
|
|
39
|
-
...
|
|
40
|
-
component:
|
|
38
|
+
const [g, f] = n.useState(null), [A, I] = n.useState(e != null), [o, w] = n.useState(!1), O = e === J.LARGE_FILE, B = (!A || O) && !u, i = (G) => {
|
|
39
|
+
l && l({
|
|
40
|
+
...G,
|
|
41
|
+
component: t
|
|
41
42
|
});
|
|
43
|
+
}, _ = () => {
|
|
44
|
+
m && m();
|
|
42
45
|
};
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
}, [e]), /* @__PURE__ */
|
|
46
|
-
className:
|
|
47
|
-
children: /* @__PURE__ */
|
|
48
|
-
className:
|
|
49
|
-
children: [!
|
|
50
|
-
...
|
|
51
|
-
askSuggestedQuestion:
|
|
52
|
-
contentName:
|
|
53
|
-
contentType:
|
|
46
|
+
return n.useEffect(() => {
|
|
47
|
+
I(e != null);
|
|
48
|
+
}, [e]), /* @__PURE__ */ s("div", {
|
|
49
|
+
className: p(S, a.container),
|
|
50
|
+
children: /* @__PURE__ */ K("div", {
|
|
51
|
+
className: p(a.contentAnswers, t === "sidebar" && a.sidebar),
|
|
52
|
+
children: [!o && /* @__PURE__ */ s(T, {
|
|
53
|
+
...k,
|
|
54
|
+
askSuggestedQuestion: g,
|
|
55
|
+
contentName: x,
|
|
56
|
+
contentType: b,
|
|
54
57
|
error: e,
|
|
55
|
-
hasCustomSuggestedQuestions:
|
|
56
|
-
hasRequestInProgress:
|
|
57
|
-
hostAppName:
|
|
58
|
+
hasCustomSuggestedQuestions: E,
|
|
59
|
+
hasRequestInProgress: d,
|
|
60
|
+
hostAppName: j,
|
|
58
61
|
isErrorMessageShown: A,
|
|
59
62
|
isStreamingEnabled: c,
|
|
63
|
+
onSuggestedQuestionInteraction: _,
|
|
60
64
|
questions: r,
|
|
61
65
|
recordAction: i,
|
|
62
|
-
setAskSuggestedQuestion:
|
|
63
|
-
showLoadingIndicator:
|
|
64
|
-
suggestedQuestions:
|
|
65
|
-
useAnimation: c &&
|
|
66
|
-
variant:
|
|
67
|
-
}),
|
|
68
|
-
onAgentEditorToggle:
|
|
66
|
+
setAskSuggestedQuestion: f,
|
|
67
|
+
showLoadingIndicator: u,
|
|
68
|
+
suggestedQuestions: D,
|
|
69
|
+
useAnimation: c && F,
|
|
70
|
+
variant: t
|
|
71
|
+
}), o && /* @__PURE__ */ s(L, {
|
|
72
|
+
onAgentEditorToggle: N,
|
|
69
73
|
recordAction: i,
|
|
70
|
-
setIsDebugModeShown:
|
|
71
|
-
}),
|
|
72
|
-
askSuggestedQuestion:
|
|
73
|
-
enableDebugMode:
|
|
74
|
-
hasRequestInProgress:
|
|
75
|
-
isAgentSelectorEnabled:
|
|
76
|
-
isAIStudioAgentSelectorEnabled:
|
|
77
|
-
isDebugModeShown:
|
|
78
|
-
isStopResponseEnabled:
|
|
74
|
+
setIsDebugModeShown: w
|
|
75
|
+
}), B && /* @__PURE__ */ s(H, {
|
|
76
|
+
askSuggestedQuestion: g,
|
|
77
|
+
enableDebugMode: M,
|
|
78
|
+
hasRequestInProgress: d,
|
|
79
|
+
isAgentSelectorEnabled: h,
|
|
80
|
+
isAIStudioAgentSelectorEnabled: Q,
|
|
81
|
+
isDebugModeShown: o,
|
|
82
|
+
isStopResponseEnabled: R,
|
|
79
83
|
isStreamingEnabled: c,
|
|
80
84
|
lastQuestion: r[r.length - 1],
|
|
81
|
-
onRetryQuestion:
|
|
82
|
-
onStopQuestion:
|
|
85
|
+
onRetryQuestion: y,
|
|
86
|
+
onStopQuestion: z,
|
|
87
|
+
onUserInteraction: _,
|
|
83
88
|
recordAction: i,
|
|
84
|
-
sendQuestion:
|
|
85
|
-
setAskSuggestedQuestion:
|
|
89
|
+
sendQuestion: C,
|
|
90
|
+
setAskSuggestedQuestion: f,
|
|
86
91
|
toggleDebugMode: () => {
|
|
87
|
-
|
|
92
|
+
w(!o);
|
|
88
93
|
},
|
|
89
|
-
variant:
|
|
94
|
+
variant: t
|
|
90
95
|
})]
|
|
91
96
|
})
|
|
92
97
|
});
|
|
93
98
|
};
|
|
94
99
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
q as BoxAiContentAnswers,
|
|
101
|
+
q as default
|
|
97
102
|
};
|
|
@@ -1,87 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AlertTriangle as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
recordAction: s
|
|
1
|
+
import { Text as _ } from "@box/blueprint-web";
|
|
2
|
+
import { AlertTriangle as N } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { Size5 as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import * as m from "react";
|
|
5
|
+
import { useIntl as p } from "react-intl";
|
|
6
|
+
import { A as i } from "../../../../chunks/types.js";
|
|
7
|
+
import { LOGGER_BASE_CONFIG as u } from "../common/constants.js";
|
|
8
|
+
import { MediaContainer as d } from "../common/media-container.js";
|
|
9
|
+
import e from "./messages.js";
|
|
10
|
+
import { jsx as t, jsxs as x } from "react/jsx-runtime";
|
|
11
|
+
import '../../../../styles/inline-error.css';const T = "_inlineError_ft07o_1", h = "_text_ft07o_4", A = "_icon_ft07o_14", I = "_iconAvatar_ft07o_18", s = {
|
|
12
|
+
inlineError: T,
|
|
13
|
+
text: h,
|
|
14
|
+
icon: A,
|
|
15
|
+
iconAvatar: I
|
|
16
|
+
}, L = ({
|
|
17
|
+
error: n,
|
|
18
|
+
contentType: a,
|
|
19
|
+
variant: l = "modal",
|
|
20
|
+
recordAction: o
|
|
22
21
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
formatMessage:
|
|
25
|
-
} =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...
|
|
22
|
+
const E = l === "sidebar", {
|
|
23
|
+
formatMessage: r
|
|
24
|
+
} = p();
|
|
25
|
+
m.useEffect(() => {
|
|
26
|
+
o && o({
|
|
27
|
+
...u,
|
|
29
28
|
target: "inlineError"
|
|
30
29
|
});
|
|
31
|
-
}, [
|
|
32
|
-
const
|
|
33
|
-
switch (
|
|
34
|
-
case
|
|
35
|
-
return e
|
|
36
|
-
case
|
|
37
|
-
return e
|
|
38
|
-
case
|
|
39
|
-
return e
|
|
40
|
-
type:
|
|
30
|
+
}, [o]);
|
|
31
|
+
const f = m.useCallback(() => {
|
|
32
|
+
switch (n) {
|
|
33
|
+
case i.RATE_LIMITING:
|
|
34
|
+
return r(e.inlineRateLimitingErrorText);
|
|
35
|
+
case i.NO_CONTENT:
|
|
36
|
+
return r(e.inlineNoContentErrorText);
|
|
37
|
+
case i.PRECONDITION_FAILED:
|
|
38
|
+
return r(e.inlinePreconditionFailedErrorText, {
|
|
39
|
+
type: a
|
|
41
40
|
});
|
|
42
|
-
case
|
|
43
|
-
return e
|
|
41
|
+
case i.AGENT_NOT_FOUND:
|
|
42
|
+
return r(e.inlineAgentNotFoundErrorText);
|
|
44
43
|
default:
|
|
45
|
-
return e
|
|
44
|
+
return r(e.inlineErrorText);
|
|
46
45
|
}
|
|
47
|
-
}, [
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
className:
|
|
46
|
+
}, [a, n, r]);
|
|
47
|
+
return /* @__PURE__ */ t("div", {
|
|
48
|
+
className: s.inlineError,
|
|
50
49
|
"data-testid": "content-answers-inline-error",
|
|
51
|
-
children: /* @__PURE__ */
|
|
52
|
-
variant:
|
|
53
|
-
children:
|
|
54
|
-
isUsedInsideSidebar:
|
|
55
|
-
variant: "center-aligned",
|
|
56
|
-
children: /* @__PURE__ */ r("div", {
|
|
57
|
-
className: n.iconAvatar,
|
|
58
|
-
children: /* @__PURE__ */ r(g, {
|
|
59
|
-
height: f,
|
|
60
|
-
role: "presentation",
|
|
61
|
-
width: f
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
}), /* @__PURE__ */ _(c.Content, {
|
|
65
|
-
isUsedInsideSidebar: m,
|
|
50
|
+
children: /* @__PURE__ */ t(d, {
|
|
51
|
+
variant: l,
|
|
52
|
+
children: /* @__PURE__ */ x(d.Content, {
|
|
53
|
+
isUsedInsideSidebar: E,
|
|
66
54
|
shouldAddCard: !1,
|
|
67
55
|
variant: "error",
|
|
68
|
-
children: [/* @__PURE__ */
|
|
69
|
-
className:
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
-
height:
|
|
56
|
+
children: [/* @__PURE__ */ t("div", {
|
|
57
|
+
className: s.icon,
|
|
58
|
+
children: /* @__PURE__ */ t(N, {
|
|
59
|
+
height: c,
|
|
72
60
|
role: "presentation",
|
|
73
|
-
width:
|
|
61
|
+
width: c
|
|
74
62
|
})
|
|
75
|
-
}), /* @__PURE__ */
|
|
63
|
+
}), /* @__PURE__ */ t(_, {
|
|
76
64
|
as: "p",
|
|
77
|
-
className:
|
|
78
|
-
children:
|
|
65
|
+
className: s.text,
|
|
66
|
+
children: n && f()
|
|
79
67
|
})]
|
|
80
|
-
})
|
|
68
|
+
})
|
|
81
69
|
})
|
|
82
70
|
});
|
|
83
71
|
};
|
|
84
72
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
L as InlineError,
|
|
74
|
+
L as default
|
|
87
75
|
};
|