@box/box-ai-content-answers 0.69.0 → 0.69.2
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.
|
@@ -1,109 +1,110 @@
|
|
|
1
|
-
import { useReducer as
|
|
2
|
-
import { R as
|
|
3
|
-
import { useContentAnswers as
|
|
4
|
-
import { ContentAnswersRecord as
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
1
|
+
import { useReducer as M, useEffect as V } from "react";
|
|
2
|
+
import { R as d } from "../../../../chunks/types.js";
|
|
3
|
+
import { useContentAnswers as W } from "./hooks/useContentAnswers.js";
|
|
4
|
+
import { ContentAnswersRecord as X, ContentAnswersItemRecord as Y } from "./records.js";
|
|
5
|
+
import Z from "./reducer.js";
|
|
6
|
+
import { jsx as $ } from "react/jsx-runtime";
|
|
7
7
|
const re = ({
|
|
8
|
-
WrappedComponent:
|
|
9
|
-
createSessionRequest:
|
|
10
|
-
getAgentConfig:
|
|
11
|
-
getAIStudioAgents:
|
|
12
|
-
fetchTimeout:
|
|
13
|
-
formatCitations:
|
|
14
|
-
getAnswer:
|
|
15
|
-
getAnswerStreaming:
|
|
8
|
+
WrappedComponent: f,
|
|
9
|
+
createSessionRequest: m,
|
|
10
|
+
getAgentConfig: S,
|
|
11
|
+
getAIStudioAgents: g,
|
|
12
|
+
fetchTimeout: A,
|
|
13
|
+
formatCitations: p,
|
|
14
|
+
getAnswer: C,
|
|
15
|
+
getAnswerStreaming: R,
|
|
16
16
|
getSuggestedQuestions: e,
|
|
17
|
-
hostAppName:
|
|
18
|
-
isAgentSelectorEnabled:
|
|
19
|
-
isAIStudioAgentSelectorEnabled:
|
|
17
|
+
hostAppName: w,
|
|
18
|
+
isAgentSelectorEnabled: Q,
|
|
19
|
+
isAIStudioAgentSelectorEnabled: T,
|
|
20
20
|
isCitationsEnabled: n,
|
|
21
|
-
isDebugModeEnabled:
|
|
22
|
-
isMarkdownEnabled:
|
|
21
|
+
isDebugModeEnabled: h,
|
|
22
|
+
isMarkdownEnabled: l,
|
|
23
23
|
isOpen: s,
|
|
24
|
-
isResetChatEnabled:
|
|
25
|
-
isStopResponseEnabled:
|
|
24
|
+
isResetChatEnabled: q,
|
|
25
|
+
isStopResponseEnabled: E,
|
|
26
26
|
isStreamingEnabled: r,
|
|
27
27
|
itemID: o,
|
|
28
|
-
itemIDs:
|
|
28
|
+
itemIDs: u,
|
|
29
29
|
onCloseModal: j,
|
|
30
30
|
shouldRenderProviders: U = !0,
|
|
31
31
|
suggestedQuestions: _,
|
|
32
32
|
warningNotice: v,
|
|
33
33
|
warningNoticeAriaLabel: x
|
|
34
34
|
}) => {
|
|
35
|
-
const [
|
|
36
|
-
item: new
|
|
35
|
+
const [c, y] = M(Z, new X({
|
|
36
|
+
item: new Y({
|
|
37
37
|
id: o
|
|
38
38
|
})
|
|
39
39
|
})), {
|
|
40
40
|
clearConversation: L,
|
|
41
41
|
createSession: N,
|
|
42
|
-
fetchAgentConfig:
|
|
43
|
-
fetchSuggestedQuestions:
|
|
42
|
+
fetchAgentConfig: i,
|
|
43
|
+
fetchSuggestedQuestions: a,
|
|
44
44
|
retryQuestion: O,
|
|
45
45
|
sendQuestion: P,
|
|
46
46
|
stopQuestion: b
|
|
47
|
-
} =
|
|
48
|
-
contentAnswers:
|
|
49
|
-
createSessionRequest:
|
|
47
|
+
} = W({
|
|
48
|
+
contentAnswers: c,
|
|
49
|
+
createSessionRequest: m,
|
|
50
50
|
dispatchStateUpdate: y,
|
|
51
|
-
fetchTimeout:
|
|
52
|
-
formatCitations:
|
|
53
|
-
getAgentConfig:
|
|
54
|
-
getAnswerStreaming:
|
|
55
|
-
getAnswer:
|
|
51
|
+
fetchTimeout: A,
|
|
52
|
+
formatCitations: p,
|
|
53
|
+
getAgentConfig: S,
|
|
54
|
+
getAnswerStreaming: R,
|
|
55
|
+
getAnswer: C,
|
|
56
56
|
getSuggestedQuestions: e,
|
|
57
57
|
isCitationsEnabled: n,
|
|
58
|
-
isStopResponseEnabled:
|
|
58
|
+
isStopResponseEnabled: E,
|
|
59
59
|
isStreamingEnabled: r,
|
|
60
|
-
itemID: o
|
|
60
|
+
itemID: o,
|
|
61
|
+
itemIDs: u
|
|
61
62
|
}), {
|
|
62
63
|
encodedSession: k,
|
|
63
64
|
error: z,
|
|
64
65
|
isLoading: B,
|
|
65
|
-
hasRequestInProgress:
|
|
66
|
-
questions:
|
|
66
|
+
hasRequestInProgress: F = !1,
|
|
67
|
+
questions: G,
|
|
67
68
|
suggestedQuestions: t
|
|
68
|
-
} =
|
|
69
|
-
|
|
70
|
-
s && t.requestState ===
|
|
71
|
-
}, [s,
|
|
72
|
-
const
|
|
69
|
+
} = c;
|
|
70
|
+
V(() => {
|
|
71
|
+
s && t.requestState === d.NOT_STARTED && a();
|
|
72
|
+
}, [s, a, t.requestState]);
|
|
73
|
+
const H = {
|
|
73
74
|
createSession: N,
|
|
74
75
|
encodedSession: k,
|
|
75
76
|
error: z,
|
|
76
|
-
getAIStudioAgents:
|
|
77
|
-
hostAppName:
|
|
77
|
+
getAIStudioAgents: g,
|
|
78
|
+
hostAppName: w,
|
|
78
79
|
hasCustomSuggestedQuestions: !!e,
|
|
79
|
-
hasRequestInProgress:
|
|
80
|
-
isAgentSelectorEnabled:
|
|
81
|
-
isAIStudioAgentSelectorEnabled:
|
|
80
|
+
hasRequestInProgress: F,
|
|
81
|
+
isAgentSelectorEnabled: Q,
|
|
82
|
+
isAIStudioAgentSelectorEnabled: T,
|
|
82
83
|
isCitationsEnabled: n,
|
|
83
|
-
isDebugModeEnabled:
|
|
84
|
-
isMarkdownEnabled:
|
|
84
|
+
isDebugModeEnabled: h,
|
|
85
|
+
isMarkdownEnabled: l,
|
|
85
86
|
isLoading: B,
|
|
86
87
|
isOpen: s,
|
|
87
|
-
isResetChatEnabled:
|
|
88
|
+
isResetChatEnabled: q,
|
|
88
89
|
isStreamingEnabled: r,
|
|
89
90
|
itemID: o,
|
|
90
|
-
itemIDs:
|
|
91
|
+
itemIDs: u,
|
|
91
92
|
onClearAction: L,
|
|
92
93
|
onCloseModal: j,
|
|
93
|
-
onSelectAgent:
|
|
94
|
-
onAgentEditorToggle:
|
|
95
|
-
questions:
|
|
94
|
+
onSelectAgent: i,
|
|
95
|
+
onAgentEditorToggle: i,
|
|
96
|
+
questions: G,
|
|
96
97
|
retryQuestion: O,
|
|
97
98
|
sendQuestion: P,
|
|
98
99
|
shouldRenderProviders: U,
|
|
99
100
|
stopQuestion: b,
|
|
100
|
-
suggestedQuestionsRequestState: e ? t.requestState :
|
|
101
|
+
suggestedQuestionsRequestState: e ? t.requestState : d.SUCCESS,
|
|
101
102
|
suggestedQuestions: e ? t.suggestions : _,
|
|
102
103
|
warningNotice: v,
|
|
103
104
|
warningNoticeAriaLabel: x
|
|
104
|
-
},
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
...
|
|
105
|
+
}, J = Object.fromEntries(Object.entries(H).filter(([D, K]) => K !== void 0));
|
|
106
|
+
return /* @__PURE__ */ $(f, {
|
|
107
|
+
...J
|
|
107
108
|
});
|
|
108
109
|
};
|
|
109
110
|
export {
|
|
@@ -1,114 +1,116 @@
|
|
|
1
1
|
import "../../../../styles/content.css";
|
|
2
|
-
import { LoadingIndicator as
|
|
3
|
-
import
|
|
2
|
+
import { LoadingIndicator as k } from "@box/blueprint-web";
|
|
3
|
+
import y from "clsx";
|
|
4
4
|
import * as e from "react";
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import
|
|
7
|
-
import { Chat as
|
|
8
|
-
import { ModalError as
|
|
9
|
-
import { jsx as t, jsxs as
|
|
10
|
-
const
|
|
11
|
-
loadingIndicatorWrapper:
|
|
12
|
-
content:
|
|
13
|
-
isLoading:
|
|
14
|
-
messagesEnd:
|
|
15
|
-
|
|
5
|
+
import { useIntl as H } from "react-intl";
|
|
6
|
+
import O from "../../messages.js";
|
|
7
|
+
import { Chat as T } from "../chat/chat.js";
|
|
8
|
+
import { ModalError as V } from "../modal-error/modal-error.js";
|
|
9
|
+
import { jsx as t, jsxs as B, Fragment as F } from "react/jsx-runtime";
|
|
10
|
+
const S = "_loadingIndicatorWrapper_b2shl_1", A = "_content_b2shl_5", D = "_isLoading_b2shl_17", G = "_messagesEnd_b2shl_21", J = "_innerContent_b2shl_25", s = {
|
|
11
|
+
loadingIndicatorWrapper: S,
|
|
12
|
+
content: A,
|
|
13
|
+
isLoading: D,
|
|
14
|
+
messagesEnd: G,
|
|
15
|
+
innerContent: J
|
|
16
|
+
}, P = ({
|
|
16
17
|
error: p,
|
|
17
18
|
hasCustomSuggestedQuestions: g,
|
|
18
19
|
hasRequestInProgress: a = !1,
|
|
19
|
-
isErrorMessageShown:
|
|
20
|
-
isSidebarOpen:
|
|
20
|
+
isErrorMessageShown: h = !1,
|
|
21
|
+
isSidebarOpen: _ = !1,
|
|
21
22
|
isStreamingEnabled: l = !1,
|
|
22
|
-
setIsErrorMessageShown:
|
|
23
|
-
onModalClose:
|
|
24
|
-
questions:
|
|
25
|
-
recordAction:
|
|
23
|
+
setIsErrorMessageShown: b,
|
|
24
|
+
onModalClose: v,
|
|
25
|
+
questions: C,
|
|
26
|
+
recordAction: u,
|
|
26
27
|
showLoadingIndicator: m = !1,
|
|
27
|
-
userInfo:
|
|
28
|
-
suggestedQuestions:
|
|
29
|
-
askSuggestedQuestion:
|
|
30
|
-
setAskSuggestedQuestion:
|
|
31
|
-
useAnimation:
|
|
28
|
+
userInfo: E,
|
|
29
|
+
suggestedQuestions: R,
|
|
30
|
+
askSuggestedQuestion: I,
|
|
31
|
+
setAskSuggestedQuestion: L,
|
|
32
|
+
useAnimation: N,
|
|
32
33
|
...w
|
|
33
34
|
}) => {
|
|
34
|
-
const
|
|
35
|
+
const d = e.useRef(null), i = e.useRef(null), f = e.useRef(null), c = e.useRef(!0), {
|
|
35
36
|
formatMessage: x
|
|
36
|
-
} =
|
|
37
|
-
f.current && f.current.scrollIntoView && i.current && (!l ||
|
|
38
|
-
behavior:
|
|
37
|
+
} = H(), n = e.useCallback((r) => {
|
|
38
|
+
f.current && f.current.scrollIntoView && i.current && (!l || c.current) && f.current.scrollIntoView({
|
|
39
|
+
behavior: r,
|
|
39
40
|
block: "nearest"
|
|
40
41
|
});
|
|
41
|
-
}, [l]),
|
|
42
|
+
}, [l]), W = () => {
|
|
42
43
|
if (i.current) {
|
|
43
44
|
const {
|
|
44
|
-
scrollTop:
|
|
45
|
+
scrollTop: r,
|
|
45
46
|
clientHeight: o,
|
|
46
|
-
scrollHeight:
|
|
47
|
-
} = i.current,
|
|
48
|
-
if (a &&
|
|
49
|
-
|
|
47
|
+
scrollHeight: M
|
|
48
|
+
} = i.current, j = M - (r + o);
|
|
49
|
+
if (a && j > 100) {
|
|
50
|
+
c.current = !1;
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
+
c.current = !0;
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
e.useEffect(() => {
|
|
56
|
-
a && (
|
|
57
|
-
}, [
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
if (!
|
|
57
|
+
a && (c.current = !0, n("instant"));
|
|
58
|
+
}, [n, a]), e.useEffect(() => {
|
|
59
|
+
c.current = !0, n("instant");
|
|
60
|
+
}, [n]), e.useLayoutEffect(() => {
|
|
61
|
+
if (!d.current)
|
|
61
62
|
return;
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
}), o =
|
|
65
|
-
return o &&
|
|
66
|
-
o &&
|
|
63
|
+
const r = new ResizeObserver(() => {
|
|
64
|
+
n(l ? "instant" : "smooth");
|
|
65
|
+
}), o = d.current;
|
|
66
|
+
return o && r.observe(o), () => {
|
|
67
|
+
o && r.unobserve(o);
|
|
67
68
|
};
|
|
68
|
-
}, [
|
|
69
|
-
const
|
|
70
|
-
clearError: () =>
|
|
69
|
+
}, [n, l]);
|
|
70
|
+
const z = () => h ? /* @__PURE__ */ t(V, {
|
|
71
|
+
clearError: () => b(!1),
|
|
71
72
|
error: p,
|
|
72
|
-
onModalClose:
|
|
73
|
-
recordAction:
|
|
73
|
+
onModalClose: v,
|
|
74
|
+
recordAction: u
|
|
74
75
|
}) : m ? /* @__PURE__ */ t("div", {
|
|
75
|
-
className:
|
|
76
|
-
children: /* @__PURE__ */ t(
|
|
77
|
-
"aria-label": x(
|
|
78
|
-
className:
|
|
76
|
+
className: s.loadingIndicatorWrapper,
|
|
77
|
+
children: /* @__PURE__ */ t(k, {
|
|
78
|
+
"aria-label": x(O.loading),
|
|
79
|
+
className: s.loadingIndicator,
|
|
79
80
|
"data-testid": "content-answers-modal-loading-indicator",
|
|
80
81
|
size: "large"
|
|
81
82
|
})
|
|
82
|
-
}) : /* @__PURE__ */
|
|
83
|
-
children: [/* @__PURE__ */ t(
|
|
84
|
-
askSuggestedQuestion:
|
|
83
|
+
}) : /* @__PURE__ */ B(F, {
|
|
84
|
+
children: [/* @__PURE__ */ t(T, {
|
|
85
|
+
askSuggestedQuestion: I,
|
|
85
86
|
hasCustomSuggestedQuestions: g,
|
|
86
87
|
hasRequestInProgress: a,
|
|
87
|
-
isSidebarOpen:
|
|
88
|
-
questions:
|
|
89
|
-
recordAction:
|
|
90
|
-
setAskSuggestedQuestion:
|
|
91
|
-
suggestedQuestions:
|
|
92
|
-
useAnimation:
|
|
93
|
-
userInfo:
|
|
88
|
+
isSidebarOpen: _,
|
|
89
|
+
questions: C,
|
|
90
|
+
recordAction: u,
|
|
91
|
+
setAskSuggestedQuestion: L,
|
|
92
|
+
suggestedQuestions: R,
|
|
93
|
+
useAnimation: N,
|
|
94
|
+
userInfo: E,
|
|
94
95
|
...w
|
|
95
96
|
}), /* @__PURE__ */ t("div", {
|
|
96
97
|
ref: f,
|
|
97
|
-
className:
|
|
98
|
+
className: s.messagesEnd
|
|
98
99
|
})]
|
|
99
100
|
});
|
|
100
101
|
return /* @__PURE__ */ t("div", {
|
|
101
102
|
ref: i,
|
|
102
|
-
className:
|
|
103
|
+
className: y(s.content, m ? s.isLoading : null),
|
|
103
104
|
"data-testid": "content-answers-content",
|
|
104
|
-
onScroll:
|
|
105
|
+
onScroll: W,
|
|
105
106
|
children: /* @__PURE__ */ t("div", {
|
|
106
|
-
ref:
|
|
107
|
-
|
|
107
|
+
ref: d,
|
|
108
|
+
className: s.innerContent,
|
|
109
|
+
children: z()
|
|
108
110
|
})
|
|
109
111
|
});
|
|
110
112
|
};
|
|
111
113
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
P as Content,
|
|
115
|
+
P as default
|
|
114
116
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"**/*.css"
|
|
55
55
|
],
|
|
56
56
|
"license": "SEE LICENSE IN LICENSE",
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "00d4574fc4e1c707bbf03d25a588cc4642281efa"
|
|
58
58
|
}
|
package/styles/content.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._loadingIndicatorWrapper_b2shl_1{width:100%}._content_b2shl_5{flex:1 1 auto;width:auto;max-height:35.375rem;padding:0 1.25rem 1.25rem;overflow:auto}@container box-ai-sidebar (max-width: 380px){._content_b2shl_5{padding:0 1rem 1rem}}._content_b2shl_5._isLoading_b2shl_17{display:flex;align-items:center}._content_b2shl_5 ._messagesEnd_b2shl_21{margin-bottom:-1.25rem;padding-bottom:1.25rem}._content_b2shl_5 ._innerContent_b2shl_25{width:100%}@media (max-width: 374px){._content_b2shl_5{flex:1;max-height:unset;padding:1rem;overflow-x:hidden}._content_b2shl_5 ._messagesEnd_b2shl_21{margin-bottom:-1rem;padding-bottom:1rem}}
|