@box/box-ai-content-answers 2.1.38 → 2.1.40
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/dist/chunks/answer-content.js +1 -32
- package/dist/chunks/answer.js +1 -183
- package/dist/chunks/box-ai-content-answers.js +1 -78
- package/dist/chunks/chat.js +1 -116
- package/dist/chunks/citation.js +1 -124
- package/dist/chunks/clear-conversation-button.js +1 -37
- package/dist/chunks/content.js +1 -89
- package/dist/chunks/content2.js +1 -213
- package/dist/chunks/contextual-items-message.js +1 -43
- package/dist/chunks/embed-the-answer-button.js +1 -52
- package/dist/chunks/feedback-tooltip.js +1 -130
- package/dist/chunks/footer-actions.js +1 -44
- package/dist/chunks/inline-error.js +1 -63
- package/dist/chunks/items-dropdown.js +1 -67
- package/dist/chunks/markdown.js +6 -6776
- package/dist/chunks/markdown.module.js +1 -13
- package/dist/chunks/media-container.js +1 -32
- package/dist/chunks/question.js +1 -29
- package/dist/chunks/references.js +1 -43
- package/dist/chunks/stopResponseButton.js +1 -45
- package/dist/chunks/suggested-questions.js +1 -70
- package/dist/chunks/suggestions.js +1 -35
- package/dist/chunks/thinkingBubble.js +1 -111
- package/dist/chunks/thumb-buttons.js +1 -103
- package/dist/chunks/types.js +1 -14
- package/dist/chunks/unsupported-items-notice.js +1 -25
- package/dist/chunks/warning-message.js +1 -21
- package/dist/esm/index.js +1 -11
- package/dist/esm/lib/box-ai-content-answers.js +1 -2
- package/dist/esm/lib/components/answer/answer-content.js +1 -2
- package/dist/esm/lib/components/answer/answer.js +1 -2
- package/dist/esm/lib/components/answer/citation.js +1 -2
- package/dist/esm/lib/components/answer/constants.js +1 -2
- package/dist/esm/lib/components/answer/copy-button.js +1 -46
- package/dist/esm/lib/components/answer/embed-the-answer-button.js +1 -2
- package/dist/esm/lib/components/answer/feedback-tooltip.js +1 -2
- package/dist/esm/lib/components/answer/inline-error.js +1 -2
- package/dist/esm/lib/components/answer/loading-indicator.js +1 -29
- package/dist/esm/lib/components/answer/messages.js +1 -148
- package/dist/esm/lib/components/answer/no-citations.js +1 -29
- package/dist/esm/lib/components/answer/references.js +1 -2
- package/dist/esm/lib/components/answer/thumb-buttons.js +1 -2
- package/dist/esm/lib/components/api-wrapper/actions.js +1 -2
- package/dist/esm/lib/components/api-wrapper/api-wrapper.js +1 -8
- package/dist/esm/lib/components/api-wrapper/constants.js +1 -30
- package/dist/esm/lib/components/api-wrapper/content-answers-component.js +1 -83
- package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +1 -211
- package/dist/esm/lib/components/api-wrapper/records.js +1 -38
- package/dist/esm/lib/components/api-wrapper/reducer.js +1 -42
- package/dist/esm/lib/components/api-wrapper/utils/format.js +1 -13
- package/dist/esm/lib/components/api-wrapper/utils/request.js +1 -12
- package/dist/esm/lib/components/api-wrapper/utils/stream.js +2 -116
- package/dist/esm/lib/components/api-wrapper/utils/typed-record.js +1 -3
- package/dist/esm/lib/components/chat/chat.js +1 -2
- package/dist/esm/lib/components/chat/index.js +1 -2
- package/dist/esm/lib/components/common/agentUtils.js +1 -5
- package/dist/esm/lib/components/common/constants.js +1 -19
- package/dist/esm/lib/components/common/focusInputUtils.js +1 -5
- package/dist/esm/lib/components/common/inline-citation.js +1 -24
- package/dist/esm/lib/components/common/keyInputUtils.js +1 -3
- package/dist/esm/lib/components/common/markdown-react.js +1 -97
- package/dist/esm/lib/components/common/markdown.js +1 -2
- package/dist/esm/lib/components/common/media-container.js +1 -2
- package/dist/esm/lib/components/common/mock-data.js +1 -305
- package/dist/esm/lib/components/common/performance.js +1 -3
- package/dist/esm/lib/components/content/content.js +1 -2
- package/dist/esm/lib/components/content/index.js +1 -2
- package/dist/esm/lib/components/footer/constants.js +1 -12
- package/dist/esm/lib/components/footer/footer-actions.js +1 -2
- package/dist/esm/lib/components/footer/footer.js +1 -151
- package/dist/esm/lib/components/footer/index.js +1 -2
- package/dist/esm/lib/components/footer/messages.js +1 -36
- package/dist/esm/lib/components/footer/stopResponseButton.js +1 -2
- package/dist/esm/lib/components/modal/clear-conversation-button.js +1 -2
- package/dist/esm/lib/components/modal/hooks/useEventListeners.js +1 -10
- package/dist/esm/lib/components/modal/hooks/useStopPropagationOnEsc.js +1 -19
- package/dist/esm/lib/components/modal/messages.js +1 -20
- package/dist/esm/lib/components/modal/modal.js +1 -143
- package/dist/esm/lib/components/modal/title.js +1 -14
- package/dist/esm/lib/components/modal-error/index.js +1 -2
- package/dist/esm/lib/components/modal-error/messages.js +1 -16
- package/dist/esm/lib/components/modal-error/modal-error.js +1 -33
- package/dist/esm/lib/components/question/question.js +1 -2
- package/dist/esm/lib/components/sidebar/content.js +1 -2
- package/dist/esm/lib/components/sidebar/context.js +1 -16
- package/dist/esm/lib/components/sidebar/messages.js +1 -28
- package/dist/esm/lib/components/sidebar/sidebar.js +1 -80
- package/dist/esm/lib/components/sidebar/title.js +1 -14
- package/dist/esm/lib/components/suggested-questions/messages.js +1 -16
- package/dist/esm/lib/components/suggested-questions/mocks.js +1 -36
- package/dist/esm/lib/components/suggested-questions/suggested-questions.js +1 -2
- package/dist/esm/lib/components/suggested-questions/suggestions.js +1 -2
- package/dist/esm/lib/components/thinkingBubble/boxAILoadingIndicator.js +11 -277
- package/dist/esm/lib/components/thinkingBubble/messages.js +1 -24
- package/dist/esm/lib/components/thinkingBubble/thinkingBubble.js +1 -2
- package/dist/esm/lib/components/welcome-message/contextual-items-message.js +1 -2
- package/dist/esm/lib/components/welcome-message/items-dropdown.js +1 -2
- package/dist/esm/lib/components/welcome-message/messages.js +10 -52
- package/dist/esm/lib/components/welcome-message/unsupported-items-notice.js +1 -2
- package/dist/esm/lib/components/welcome-message/warning-message.js +1 -2
- package/dist/esm/lib/components/welcome-message/welcome-message.js +1 -53
- package/dist/esm/lib/constants.js +1 -9
- package/dist/esm/lib/hooks/usePromptFocus.js +1 -28
- package/dist/esm/lib/messages.js +1 -56
- package/dist/esm/lib/utils/constants.js +1 -2
- package/dist/esm/lib/utils/inlineCitationsUtils.js +1 -18
- package/package.json +11 -11
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
openPromptLibraryBtn: {
|
|
4
|
-
id: "boxAI.contentAnswers.openPromptLibraryBtn",
|
|
5
|
-
defaultMessage: "Open Prompt Library"
|
|
6
|
-
},
|
|
7
|
-
promptsBtn: {
|
|
8
|
-
id: "boxAI.contentAnswers.promptsBtn",
|
|
9
|
-
defaultMessage: "Prompts"
|
|
10
|
-
},
|
|
11
|
-
maxCharactersReachedError: {
|
|
12
|
-
id: "boxAI.contentAnswers.maxCharactersReachedError",
|
|
13
|
-
defaultMessage: "Maximum of {characterLimit} characters reached"
|
|
14
|
-
},
|
|
15
|
-
askQuestionPlaceholder: {
|
|
16
|
-
id: "boxAI.contentAnswers.askQuestionPlaceholder",
|
|
17
|
-
defaultMessage: "Ask Box AI"
|
|
18
|
-
},
|
|
19
|
-
askDisabledTooltip: {
|
|
20
|
-
id: "boxAI.contentAnswers.askDisabledTooltip",
|
|
21
|
-
defaultMessage: "You can submit another question once Box AI has finished responding"
|
|
22
|
-
},
|
|
23
|
-
ask: {
|
|
24
|
-
id: "boxAI.contentAnswers.ask",
|
|
25
|
-
defaultMessage: "Ask"
|
|
26
|
-
},
|
|
27
|
-
retryResponse: {
|
|
28
|
-
id: "boxAI.contentAnswers.retryResponse",
|
|
29
|
-
defaultMessage: "Retry"
|
|
30
|
-
},
|
|
31
|
-
stopResponse: {
|
|
32
|
-
id: "boxAI.contentAnswers.stopResponse",
|
|
33
|
-
defaultMessage: "Stop Response"
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({openPromptLibraryBtn:{id:`boxAI.contentAnswers.openPromptLibraryBtn`,defaultMessage:`Open Prompt Library`},promptsBtn:{id:`boxAI.contentAnswers.promptsBtn`,defaultMessage:`Prompts`},maxCharactersReachedError:{id:`boxAI.contentAnswers.maxCharactersReachedError`,defaultMessage:`Maximum of {characterLimit} characters reached`},askQuestionPlaceholder:{id:`boxAI.contentAnswers.askQuestionPlaceholder`,defaultMessage:`Ask Box AI`},askDisabledTooltip:{id:`boxAI.contentAnswers.askDisabledTooltip`,defaultMessage:`You can submit another question once Box AI has finished responding`},ask:{id:`boxAI.contentAnswers.ask`,defaultMessage:`Ask`},retryResponse:{id:`boxAI.contentAnswers.retryResponse`,defaultMessage:`Retry`},stopResponse:{id:`boxAI.contentAnswers.stopResponse`,defaultMessage:`Stop Response`}});export{messages as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as StopResponseButton };
|
|
1
|
+
import{t as StopResponseButton}from"../../../../chunks/stopResponseButton.js";export{StopResponseButton};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ClearConversationButton, e as default };
|
|
1
|
+
import{t as ClearConversationButton}from"../../../../chunks/clear-conversation-button.js";export{ClearConversationButton,ClearConversationButton as default};
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = () => ({
|
|
3
|
-
addKeydownEventListener: e((e) => {
|
|
4
|
-
document.addEventListener("keydown", e);
|
|
5
|
-
}, []),
|
|
6
|
-
removeKeydownEventListener: e((e) => {
|
|
7
|
-
document.removeEventListener("keydown", e);
|
|
8
|
-
}, [])
|
|
9
|
-
});
|
|
10
|
-
export { t as default };
|
|
1
|
+
import{useCallback}from"react";var useEventListeners=()=>({addKeydownEventListener:useCallback(callback=>{document.addEventListener(`keydown`,callback)},[]),removeKeydownEventListener:useCallback(callback=>{document.removeEventListener(`keydown`,callback)},[])});export{useEventListeners as default};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useCallback as t, useEffect as n } from "react";
|
|
3
|
-
var r = (r, i) => {
|
|
4
|
-
let a = t((e) => {
|
|
5
|
-
e.key === "Escape" && e.stopPropagation();
|
|
6
|
-
}, []), { addKeydownEventListener: o, removeKeydownEventListener: s } = e();
|
|
7
|
-
return n(() => {
|
|
8
|
-
if (!(!r || !i)) return o(a), () => {
|
|
9
|
-
s(a);
|
|
10
|
-
};
|
|
11
|
-
}, [
|
|
12
|
-
r,
|
|
13
|
-
i,
|
|
14
|
-
a,
|
|
15
|
-
o,
|
|
16
|
-
s
|
|
17
|
-
]), { handleKeyDownOnEsc: a };
|
|
18
|
-
};
|
|
19
|
-
export { r as default };
|
|
1
|
+
import useEventListeners from"./useEventListeners.js";import{useCallback,useEffect}from"react";var useStopPropagationOnEsc=(stopPropagationOnEsc,open)=>{let handleKeyDownOnEsc=useCallback(event=>{event.key===`Escape`&&event.stopPropagation()},[]),{addKeydownEventListener,removeKeydownEventListener}=useEventListeners();return useEffect(()=>{if(!(!stopPropagationOnEsc||!open))return addKeydownEventListener(handleKeyDownOnEsc),()=>{removeKeydownEventListener(handleKeyDownOnEsc)}},[stopPropagationOnEsc,open,handleKeyDownOnEsc,addKeydownEventListener,removeKeydownEventListener]),{handleKeyDownOnEsc}};export{useStopPropagationOnEsc as default};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
contentAnswersTitle: {
|
|
4
|
-
id: "boxAI.contentAnswers.contentAnswersTitle",
|
|
5
|
-
defaultMessage: "Box AI"
|
|
6
|
-
},
|
|
7
|
-
closeModalAriaLabel: {
|
|
8
|
-
id: "boxAI.contentAnswers.closeModalAriaLabel",
|
|
9
|
-
defaultMessage: "Close Modal"
|
|
10
|
-
},
|
|
11
|
-
clearConversationLabel: {
|
|
12
|
-
id: "boxAI.contentAnswers.clearConversationLabel",
|
|
13
|
-
defaultMessage: "Clear conversation"
|
|
14
|
-
},
|
|
15
|
-
collapseModalAriaLabel: {
|
|
16
|
-
id: "boxAI.contentAnswers.collapseModalAriaLabel",
|
|
17
|
-
defaultMessage: "Switch to sidebar view"
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({contentAnswersTitle:{id:`boxAI.contentAnswers.contentAnswersTitle`,defaultMessage:`Box AI`},closeModalAriaLabel:{id:`boxAI.contentAnswers.closeModalAriaLabel`,defaultMessage:`Close Modal`},clearConversationLabel:{id:`boxAI.contentAnswers.clearConversationLabel`,defaultMessage:`Clear conversation`},collapseModalAriaLabel:{id:`boxAI.contentAnswers.collapseModalAriaLabel`,defaultMessage:`Switch to sidebar view`}});export{messages as default};
|
|
@@ -1,143 +1 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { a as t, t as n } from "../../../../chunks/types.js";
|
|
3
|
-
import { LOGGER_ACTION_CLICK as r, LOGGER_BASE_CONFIG as i } from "../common/constants.js";
|
|
4
|
-
import a from "./messages.js";
|
|
5
|
-
import { n as o, t as s } from "../../../../chunks/clear-conversation-button.js";
|
|
6
|
-
import c from "./hooks/useStopPropagationOnEsc.js";
|
|
7
|
-
import { Title as l } from "./title.js";
|
|
8
|
-
import { useCallback as u, useEffect as d, useMemo as f, useState as ee } from "react";
|
|
9
|
-
import { Breakpoint as p, Modal as m, Tooltip as h, TooltipProvider as g, useBlueprintModernization as te, useBreakpoint as _ } from "@box/blueprint-web";
|
|
10
|
-
import { useIntl as ne } from "react-intl";
|
|
11
|
-
import { BoxAiLogo as re } from "@box/blueprint-web-assets/icons/Logo";
|
|
12
|
-
import { Size8 as v } from "@box/blueprint-web-assets/tokens/tokens";
|
|
13
|
-
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
14
|
-
import { ArrowsMinimize as x } from "@box/blueprint-web-assets/icons/Medium";
|
|
15
|
-
import { ArrowsCollapse as S } from "@box/blueprint-web-assets/icons/Fill";
|
|
16
|
-
import { AgentsProvider as ie, BoxAiAgentSelectorWithApi as ae } from "@box/box-ai-agent-selector";
|
|
17
|
-
var C = (e) => e ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", w = (e) => e ? a.collapseModalAriaLabel : a.closeModalAriaLabel, T = (e, t) => e ? t ? x : S : void 0, oe = (e, t) => {
|
|
18
|
-
let n = e === "collapsible";
|
|
19
|
-
return {
|
|
20
|
-
closeModalLabel: w(n),
|
|
21
|
-
closeModalTargetId: C(n),
|
|
22
|
-
closeModalIcon: T(n, t)
|
|
23
|
-
};
|
|
24
|
-
}, E = ({ children: a, getAIStudioAgents: x, hasCustomSuggestedQuestions: S, hostAppName: C, isAIStudioAgentSelectorEnabled: w = !1, isDebugModeEnabled: T, isStopResponseEnabled: E = !1, itemSize: D, extension: O, onClearAction: k, onSelectAgent: A, onSelectedAgentCallback: j, promptValue: M, recordAction: N, setPromptValue: P, shouldRenderProviders: F = !0, shouldShowLandingPage: I = !1, stopPropagationOnEsc: L, variant: R = "closable", items: z, parentItem: B, ...V }) => {
|
|
25
|
-
let { enableModernizedComponents: H } = te(), { open: U, defaultOpen: W, onOpenChange: G, modal: K, ...q } = V, J = ne(), se = _() <= p.Medium;
|
|
26
|
-
c(L, U);
|
|
27
|
-
let Y = q?.questions?.[q.questions.length - 1]?.error, [ce, X] = ee(!1), { closeModalLabel: Z, closeModalTargetId: le, closeModalIcon: ue } = f(() => oe(R, H), [R, H]), Q = u((e) => {
|
|
28
|
-
N && (e.data ??= {}, e.data.hostAppName = C, N(e));
|
|
29
|
-
}, [C, N]);
|
|
30
|
-
d(() => {
|
|
31
|
-
z || Q({
|
|
32
|
-
...i,
|
|
33
|
-
target: "loaded",
|
|
34
|
-
data: {
|
|
35
|
-
fileSize: D,
|
|
36
|
-
fileType: O
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}, [
|
|
40
|
-
Q,
|
|
41
|
-
O,
|
|
42
|
-
D,
|
|
43
|
-
z,
|
|
44
|
-
N
|
|
45
|
-
]), d(() => {
|
|
46
|
-
z && Q({
|
|
47
|
-
...i,
|
|
48
|
-
target: "loaded",
|
|
49
|
-
data: {
|
|
50
|
-
parentItemType: B?.type,
|
|
51
|
-
items: z.map((e) => ({
|
|
52
|
-
status: e.status,
|
|
53
|
-
fileType: e.fileType
|
|
54
|
-
}))
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}, [
|
|
58
|
-
Q,
|
|
59
|
-
B,
|
|
60
|
-
N
|
|
61
|
-
]), d(() => {
|
|
62
|
-
Y && Y === n.AGENT_NOT_FOUND && X(!0);
|
|
63
|
-
}, [Y]);
|
|
64
|
-
let de = () => {
|
|
65
|
-
k && (k(), Q({
|
|
66
|
-
...i,
|
|
67
|
-
action: r,
|
|
68
|
-
target: "clearChat"
|
|
69
|
-
}));
|
|
70
|
-
}, fe = u(async () => (X(!1), x()), [x]), $ = /* @__PURE__ */ b(m, {
|
|
71
|
-
defaultOpen: W,
|
|
72
|
-
modal: K,
|
|
73
|
-
onOpenChange: G,
|
|
74
|
-
open: U,
|
|
75
|
-
children: [/* @__PURE__ */ y(m.Trigger, { children: a }), /* @__PURE__ */ b(m.Content, {
|
|
76
|
-
className: o.contentAnswersModal,
|
|
77
|
-
"data-testid": "content-answers-modal",
|
|
78
|
-
size: "xlarge",
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ y(m.Header, {
|
|
81
|
-
className: o.modalHeaderContainer,
|
|
82
|
-
children: /* @__PURE__ */ b("div", {
|
|
83
|
-
className: o.modalHeader,
|
|
84
|
-
children: [
|
|
85
|
-
!se && /* @__PURE__ */ y(re, {
|
|
86
|
-
className: o.BoxAIIconColor,
|
|
87
|
-
"data-testid": "content-answers-icon-color",
|
|
88
|
-
height: v,
|
|
89
|
-
width: v
|
|
90
|
-
}),
|
|
91
|
-
/* @__PURE__ */ y(l, { isAIStudioAgentSelectorEnabled: w }),
|
|
92
|
-
w && /* @__PURE__ */ y(ae, {
|
|
93
|
-
contentClassName: o.agentSelectorContent,
|
|
94
|
-
disabled: q.hasRequestInProgress,
|
|
95
|
-
fetcher: fe,
|
|
96
|
-
hostAppName: C,
|
|
97
|
-
onSelectAgent: A,
|
|
98
|
-
onSelectedAgentCallback: j,
|
|
99
|
-
recordAction: N,
|
|
100
|
-
requestState: ce ? t.ERROR : void 0,
|
|
101
|
-
shouldHideAgentSelectorOnLoad: !0,
|
|
102
|
-
triggerChipClassName: o.agentSelectorTrigger,
|
|
103
|
-
useAgentLocalStorage: !0
|
|
104
|
-
})
|
|
105
|
-
]
|
|
106
|
-
})
|
|
107
|
-
}),
|
|
108
|
-
/* @__PURE__ */ y(e, {
|
|
109
|
-
className: `box-content-answers-chat-container ${o.boxAiContentAnswers}`,
|
|
110
|
-
hasCustomSuggestedQuestions: S,
|
|
111
|
-
hostAppName: C,
|
|
112
|
-
isAIStudioAgentSelectorEnabled: w,
|
|
113
|
-
isDebugModeEnabled: T,
|
|
114
|
-
isStopResponseEnabled: E,
|
|
115
|
-
items: z,
|
|
116
|
-
parentItem: B,
|
|
117
|
-
promptValue: M,
|
|
118
|
-
recordAction: Q,
|
|
119
|
-
setPromptValue: P,
|
|
120
|
-
shouldShowLandingPage: I,
|
|
121
|
-
...q
|
|
122
|
-
}),
|
|
123
|
-
k && /* @__PURE__ */ y(s, {
|
|
124
|
-
hasRequestInProgress: q.hasRequestInProgress,
|
|
125
|
-
onClick: de
|
|
126
|
-
}),
|
|
127
|
-
/* @__PURE__ */ y(g, { children: /* @__PURE__ */ y(h, {
|
|
128
|
-
content: J.formatMessage(Z),
|
|
129
|
-
"data-testid": "content-answers-close-modal-tooltip",
|
|
130
|
-
children: /* @__PURE__ */ y(m.Close, {
|
|
131
|
-
"aria-label": J.formatMessage(Z),
|
|
132
|
-
className: o["modal-close-button"],
|
|
133
|
-
"data-target-id": le,
|
|
134
|
-
icon: ue,
|
|
135
|
-
size: "small"
|
|
136
|
-
})
|
|
137
|
-
}) })
|
|
138
|
-
]
|
|
139
|
-
})]
|
|
140
|
-
});
|
|
141
|
-
return F ? /* @__PURE__ */ y(ie, { children: $ }) : $;
|
|
142
|
-
};
|
|
143
|
-
export { E as IntelligenceModal, E as default };
|
|
1
|
+
import{t as BoxAiContentAnswers}from"../../../../chunks/box-ai-content-answers.js";import{a as REQUEST_STATE$1,t as ANSWER_ERROR}from"../../../../chunks/types.js";import{LOGGER_ACTION_CLICK,LOGGER_BASE_CONFIG}from"../common/constants.js";import messages from"./messages.js";import{n as modal_module_default,t as ClearConversationButton}from"../../../../chunks/clear-conversation-button.js";import useStopPropagationOnEsc from"./hooks/useStopPropagationOnEsc.js";import{Title}from"./title.js";import{useCallback,useEffect,useMemo,useState}from"react";import{Breakpoint,Modal,Tooltip,TooltipProvider,useBlueprintModernization,useBreakpoint}from"@box/blueprint-web";import{useIntl}from"react-intl";import{BoxAiLogo}from"@box/blueprint-web-assets/icons/Logo";import{Size8}from"@box/blueprint-web-assets/tokens/tokens";import{jsx,jsxs}from"react/jsx-runtime";import{ArrowsMinimize}from"@box/blueprint-web-assets/icons/Medium";import{ArrowsCollapse}from"@box/blueprint-web-assets/icons/Fill";import{AgentsProvider,BoxAiAgentSelectorWithApi}from"@box/box-ai-agent-selector";var getModalTargetId=isCollapsible=>isCollapsible?`Modal.Close-collapseContentAnswersModal`:`Modal.Close-closeContentAnswersModal`,getCloseModalLabel=isCollapsible=>isCollapsible?messages.collapseModalAriaLabel:messages.closeModalAriaLabel,getModalIcon=(isCollapsible,enableModernizedComponents)=>isCollapsible?enableModernizedComponents?ArrowsMinimize:ArrowsCollapse:void 0,getModalData=(variant,enableModernizedComponents)=>{let isCollapsible=variant===`collapsible`;return{closeModalLabel:getCloseModalLabel(isCollapsible),closeModalTargetId:getModalTargetId(isCollapsible),closeModalIcon:getModalIcon(isCollapsible,enableModernizedComponents)}},IntelligenceModal=({children,getAIStudioAgents,hasCustomSuggestedQuestions,hostAppName,isAIStudioAgentSelectorEnabled=!1,isDebugModeEnabled,isStopResponseEnabled=!1,itemSize,extension,onClearAction,onSelectAgent,onSelectedAgentCallback,promptValue,recordAction,setPromptValue,shouldRenderProviders=!0,shouldShowLandingPage=!1,stopPropagationOnEsc,variant=`closable`,items,parentItem,...props})=>{let{enableModernizedComponents}=useBlueprintModernization(),{open,defaultOpen,onOpenChange,modal,...intelligenceProps}=props,intl=useIntl(),isSmallMedium=useBreakpoint()<=Breakpoint.Medium;useStopPropagationOnEsc(stopPropagationOnEsc,open);let lastQuestionError=intelligenceProps?.questions?.[intelligenceProps.questions.length-1]?.error,[shouldInvalidateAgentList,setShouldInvalidateAgentList]=useState(!1),{closeModalLabel,closeModalTargetId,closeModalIcon}=useMemo(()=>getModalData(variant,enableModernizedComponents),[variant,enableModernizedComponents]),eventLogger=useCallback(payload=>{recordAction&&(payload.data??={},payload.data.hostAppName=hostAppName,recordAction(payload))},[hostAppName,recordAction]);useEffect(()=>{items||eventLogger({...LOGGER_BASE_CONFIG,target:`loaded`,data:{fileSize:itemSize,fileType:extension}})},[eventLogger,extension,itemSize,items,recordAction]),useEffect(()=>{items&&eventLogger({...LOGGER_BASE_CONFIG,target:`loaded`,data:{parentItemType:parentItem?.type,items:items.map(item=>({status:item.status,fileType:item.fileType}))}})},[eventLogger,parentItem,recordAction]),useEffect(()=>{lastQuestionError&&lastQuestionError===ANSWER_ERROR.AGENT_NOT_FOUND&&setShouldInvalidateAgentList(!0)},[lastQuestionError]);let handleOnClearClick=()=>{onClearAction&&(onClearAction(),eventLogger({...LOGGER_BASE_CONFIG,action:LOGGER_ACTION_CLICK,target:`clearChat`}))},handleAgentFetch=useCallback(async()=>(setShouldInvalidateAgentList(!1),getAIStudioAgents()),[getAIStudioAgents]),modalContent=jsxs(Modal,{defaultOpen,modal,onOpenChange,open,children:[jsx(Modal.Trigger,{children}),jsxs(Modal.Content,{className:modal_module_default.contentAnswersModal,"data-testid":`content-answers-modal`,size:`xlarge`,children:[jsx(Modal.Header,{className:modal_module_default.modalHeaderContainer,children:jsxs(`div`,{className:modal_module_default.modalHeader,children:[!isSmallMedium&&jsx(BoxAiLogo,{className:modal_module_default.BoxAIIconColor,"data-testid":`content-answers-icon-color`,height:Size8,width:Size8}),jsx(Title,{isAIStudioAgentSelectorEnabled}),isAIStudioAgentSelectorEnabled&&jsx(BoxAiAgentSelectorWithApi,{contentClassName:modal_module_default.agentSelectorContent,disabled:intelligenceProps.hasRequestInProgress,fetcher:handleAgentFetch,hostAppName,onSelectAgent,onSelectedAgentCallback,recordAction,requestState:shouldInvalidateAgentList?REQUEST_STATE$1.ERROR:void 0,shouldHideAgentSelectorOnLoad:!0,triggerChipClassName:modal_module_default.agentSelectorTrigger,useAgentLocalStorage:!0})]})}),jsx(BoxAiContentAnswers,{className:`box-content-answers-chat-container ${modal_module_default.boxAiContentAnswers}`,hasCustomSuggestedQuestions,hostAppName,isAIStudioAgentSelectorEnabled,isDebugModeEnabled,isStopResponseEnabled,items,parentItem,promptValue,recordAction:eventLogger,setPromptValue,shouldShowLandingPage,...intelligenceProps}),onClearAction&&jsx(ClearConversationButton,{hasRequestInProgress:intelligenceProps.hasRequestInProgress,onClick:handleOnClearClick}),jsx(TooltipProvider,{children:jsx(Tooltip,{content:intl.formatMessage(closeModalLabel),"data-testid":`content-answers-close-modal-tooltip`,children:jsx(Modal.Close,{"aria-label":intl.formatMessage(closeModalLabel),className:modal_module_default[`modal-close-button`],"data-target-id":closeModalTargetId,icon:closeModalIcon,size:`small`})})})]})]});return shouldRenderProviders?jsx(AgentsProvider,{children:modalContent}):modalContent};export{IntelligenceModal,IntelligenceModal as default};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Text as t } from "@box/blueprint-web";
|
|
3
|
-
import { useIntl as n } from "react-intl";
|
|
4
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
import { REQUEST_STATE as i, useAgents as a } from "@box/box-ai-agent-selector";
|
|
6
|
-
var o = ({ isAIStudioAgentSelectorEnabled: o = !1 }) => {
|
|
7
|
-
let { formatMessage: s } = n(), { agents: c, requestState: l } = a(), u = l !== i.NOT_STARTED && l !== i.IN_PROGRESS, d = l === i.ERROR || l === i.CANCELLED, f = c.length > 1 && l === i.SUCCESS;
|
|
8
|
-
return !o || d || !f && u ? /* @__PURE__ */ r(t, {
|
|
9
|
-
as: "span",
|
|
10
|
-
variant: "titleMedium",
|
|
11
|
-
children: s(e.contentAnswersTitle)
|
|
12
|
-
}) : null;
|
|
13
|
-
};
|
|
14
|
-
export { o as Title, o as default };
|
|
1
|
+
import messages from"./messages.js";import{Text}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{REQUEST_STATE,useAgents}from"@box/box-ai-agent-selector";var Title=({isAIStudioAgentSelectorEnabled=!1})=>{let{formatMessage}=useIntl(),{agents,requestState}=useAgents(),hasAgentSelectorRequestEnded=requestState!==REQUEST_STATE.NOT_STARTED&&requestState!==REQUEST_STATE.IN_PROGRESS,hasAgentSelectorRequestFailed=requestState===REQUEST_STATE.ERROR||requestState===REQUEST_STATE.CANCELLED,isAgentSelectorVisible=agents.length>1&&requestState===REQUEST_STATE.SUCCESS;return!isAIStudioAgentSelectorEnabled||hasAgentSelectorRequestFailed||!isAgentSelectorVisible&&hasAgentSelectorRequestEnded?jsx(Text,{as:`span`,variant:`titleMedium`,children:formatMessage(messages.contentAnswersTitle)}):null};export{Title,Title as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ModalError };
|
|
1
|
+
import{ModalError}from"./modal-error.js";export{ModalError};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
intelligenceUnaivalableHeading: {
|
|
4
|
-
id: "boxAI.contentAnswers.intelligenceUnaivalableHeading",
|
|
5
|
-
defaultMessage: "Box AI is unavailable"
|
|
6
|
-
},
|
|
7
|
-
intelligenceUnavailableDescription: {
|
|
8
|
-
id: "boxAI.contentAnswers.intelligenceUnavailableDescription",
|
|
9
|
-
defaultMessage: "The Box AI service is not responding."
|
|
10
|
-
},
|
|
11
|
-
intelligenceUnaivalableTryAgain: {
|
|
12
|
-
id: "boxAI.contentAnswers.intelligenceUnaivalableTryAgain",
|
|
13
|
-
defaultMessage: "Please try again later."
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({intelligenceUnaivalableHeading:{id:`boxAI.contentAnswers.intelligenceUnaivalableHeading`,defaultMessage:`Box AI is unavailable`},intelligenceUnavailableDescription:{id:`boxAI.contentAnswers.intelligenceUnavailableDescription`,defaultMessage:`The Box AI service is not responding.`},intelligenceUnaivalableTryAgain:{id:`boxAI.contentAnswers.intelligenceUnaivalableTryAgain`,defaultMessage:`Please try again later.`}});export{messages as default};
|
|
@@ -1,33 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LOGGER_BASE_CONFIG as t } from "../common/constants.js";
|
|
3
|
-
import n from "./messages.js";
|
|
4
|
-
import * as r from "react";
|
|
5
|
-
import { EmptyState as i, Text as a } from "@box/blueprint-web";
|
|
6
|
-
import { useIntl as o } from "react-intl";
|
|
7
|
-
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
-
import { Unplugged as l } from "@box/blueprint-web-assets/illustrations/Medium";
|
|
9
|
-
var u = ({ error: u = e.GENERAL, recordAction: d }) => {
|
|
10
|
-
let f = o();
|
|
11
|
-
return r.useEffect(() => {
|
|
12
|
-
d && d({
|
|
13
|
-
...t,
|
|
14
|
-
target: "modalError",
|
|
15
|
-
data: { errorType: "Intelligence service unavailable" }
|
|
16
|
-
});
|
|
17
|
-
}, [d]), /* @__PURE__ */ s(i, {
|
|
18
|
-
body: /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s(a, {
|
|
19
|
-
as: "p",
|
|
20
|
-
children: f.formatMessage(n.intelligenceUnavailableDescription)
|
|
21
|
-
}), /* @__PURE__ */ s(a, {
|
|
22
|
-
as: "p",
|
|
23
|
-
children: f.formatMessage(n.intelligenceUnaivalableTryAgain)
|
|
24
|
-
})] }),
|
|
25
|
-
"data-testid": "content-answers-modal-error",
|
|
26
|
-
heading: /* @__PURE__ */ s(a, {
|
|
27
|
-
as: "h2",
|
|
28
|
-
children: f.formatMessage(n.intelligenceUnaivalableHeading)
|
|
29
|
-
}),
|
|
30
|
-
illustration: l
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
export { u as ModalError };
|
|
1
|
+
import{r as CONTENT_ERROR}from"../../../../chunks/types.js";import{LOGGER_BASE_CONFIG}from"../common/constants.js";import messages from"./messages.js";import*as React$1 from"react";import{EmptyState,Text}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{Unplugged}from"@box/blueprint-web-assets/illustrations/Medium";var ModalError=({error=CONTENT_ERROR.GENERAL,recordAction})=>{let intl=useIntl();return React$1.useEffect(()=>{recordAction&&recordAction({...LOGGER_BASE_CONFIG,target:`modalError`,data:{errorType:`Intelligence service unavailable`}})},[recordAction]),jsx(EmptyState,{body:jsxs(`div`,{children:[jsx(Text,{as:`p`,children:intl.formatMessage(messages.intelligenceUnavailableDescription)}),jsx(Text,{as:`p`,children:intl.formatMessage(messages.intelligenceUnaivalableTryAgain)})]}),"data-testid":`content-answers-modal-error`,heading:jsx(Text,{as:`h2`,children:intl.formatMessage(messages.intelligenceUnaivalableHeading)}),illustration:Unplugged})};export{ModalError};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as Question, e as default };
|
|
1
|
+
import{t as Question}from"../../../../chunks/question.js";export{Question,Question as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as default };
|
|
1
|
+
import{t as content_default}from"../../../../chunks/content2.js";export{content_default as default};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "lodash/noop";
|
|
3
|
-
var n = /*#__PURE__*/ e.createContext({
|
|
4
|
-
cache: {},
|
|
5
|
-
contentName: "",
|
|
6
|
-
elementId: "",
|
|
7
|
-
fileExtension: "",
|
|
8
|
-
isFeedbackEnabled: !1,
|
|
9
|
-
isFeedbackFormEnabled: !1,
|
|
10
|
-
isStopResponseEnabled: !1,
|
|
11
|
-
items: [],
|
|
12
|
-
recordAction: t,
|
|
13
|
-
setCacheValue: t,
|
|
14
|
-
shouldPreinitSession: !0
|
|
15
|
-
});
|
|
16
|
-
export { n as IntelligenceSidebarContext };
|
|
1
|
+
import*as React$1 from"react";import noop from"lodash/noop";var IntelligenceSidebarContext=React$1.createContext({cache:{},contentName:``,elementId:``,fileExtension:``,isFeedbackEnabled:!1,isFeedbackFormEnabled:!1,isStopResponseEnabled:!1,items:[],recordAction:noop,setCacheValue:noop,shouldPreinitSession:!0});export{IntelligenceSidebarContext};
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
welcomeMessageIntelligentQueryNotice: {
|
|
4
|
-
id: "boxui.contentAnswers.welcomeMessageIntelligentQueryNotice",
|
|
5
|
-
defaultMessage: "You can ask Box AI both simple and complex questions in your spreadsheet: total counts, averages, advanced comparisons, trend analyses and so on. Try it out today!"
|
|
6
|
-
},
|
|
7
|
-
welcomeMessageSpreadsheetNotice: {
|
|
8
|
-
id: "boxui.contentAnswers.welcomeMessageSpreadsheetNotice",
|
|
9
|
-
defaultMessage: "Spreadsheet support works best for text dense files"
|
|
10
|
-
},
|
|
11
|
-
welcomeMessageSpreadsheetNoticeAriaLabel: {
|
|
12
|
-
id: "boxui.contentAnswers.welcomeMessageSpreadsheetNoticeAriaLabel",
|
|
13
|
-
defaultMessage: "spreadsheet support notification banner"
|
|
14
|
-
},
|
|
15
|
-
sidebarBoxAISwitchToModalView: {
|
|
16
|
-
id: "contentAnswersSidebar.sidebarBoxAISwitchToModalView",
|
|
17
|
-
defaultMessage: "Switch to modal view"
|
|
18
|
-
},
|
|
19
|
-
sidebarBoxAIClose: {
|
|
20
|
-
id: "contentAnswersSidebar.sidebarBoxAIClose",
|
|
21
|
-
defaultMessage: "Close"
|
|
22
|
-
},
|
|
23
|
-
sidebarBoxAIContent: {
|
|
24
|
-
id: "contentAnswersSidebar.sidebarBoxAIContent",
|
|
25
|
-
defaultMessage: "content"
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({welcomeMessageIntelligentQueryNotice:{id:`boxui.contentAnswers.welcomeMessageIntelligentQueryNotice`,defaultMessage:`You can ask Box AI both simple and complex questions in your spreadsheet: total counts, averages, advanced comparisons, trend analyses and so on. Try it out today!`},welcomeMessageSpreadsheetNotice:{id:`boxui.contentAnswers.welcomeMessageSpreadsheetNotice`,defaultMessage:`Spreadsheet support works best for text dense files`},welcomeMessageSpreadsheetNoticeAriaLabel:{id:`boxui.contentAnswers.welcomeMessageSpreadsheetNoticeAriaLabel`,defaultMessage:`spreadsheet support notification banner`},sidebarBoxAISwitchToModalView:{id:`contentAnswersSidebar.sidebarBoxAISwitchToModalView`,defaultMessage:`Switch to modal view`},sidebarBoxAIClose:{id:`contentAnswersSidebar.sidebarBoxAIClose`,defaultMessage:`Close`},sidebarBoxAIContent:{id:`contentAnswersSidebar.sidebarBoxAIContent`,defaultMessage:`content`}});export{messages as default};
|
|
@@ -1,80 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IntelligenceSidebarContext as n } from "./context.js";
|
|
3
|
-
import r from "./messages.js";
|
|
4
|
-
import { t as i } from "../../../../chunks/content2.js";
|
|
5
|
-
import * as a from "react";
|
|
6
|
-
import { useIntl as o } from "react-intl";
|
|
7
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
-
import { AgentsProvider as c } from "@box/box-ai-agent-selector";
|
|
9
|
-
var l = (l) => {
|
|
10
|
-
let { cache: u, contentName: d, elementId: f, fileExtension: p, fileID: m, getSuggestedQuestions: h, isIntelligentQueryMode: g, isFeedbackEnabled: _, isFeedbackFormEnabled: v, isStopResponseEnabled: y = !1, items: b, itemSize: x, localizedQuestions: S, onFeedbackFormSubmit: C, onUserInteraction: w, onSelectedAgentCallback: T, recordAction: E, setCacheValue: D, shouldPreinitSession: O = !0, setHasQuestions: k, promptButtonClickHandler: A, embedTheAnswerButtonConfig: j, onClose: M, ...N } = l, { questions: P, agents: F } = u, { selectedAgent: I } = F, { formatMessage: L } = o(), R = a.useMemo(() => ({
|
|
11
|
-
cache: u,
|
|
12
|
-
contentName: d,
|
|
13
|
-
elementId: f,
|
|
14
|
-
fileExtension: p,
|
|
15
|
-
isFeedbackEnabled: _,
|
|
16
|
-
isFeedbackFormEnabled: v,
|
|
17
|
-
isStopResponseEnabled: y,
|
|
18
|
-
items: b,
|
|
19
|
-
itemSize: x,
|
|
20
|
-
onFeedbackFormSubmit: C,
|
|
21
|
-
onUserInteraction: w,
|
|
22
|
-
onSelectedAgentCallback: T,
|
|
23
|
-
recordAction: E,
|
|
24
|
-
setCacheValue: D,
|
|
25
|
-
shouldPreinitSession: O
|
|
26
|
-
}), [
|
|
27
|
-
u,
|
|
28
|
-
d,
|
|
29
|
-
f,
|
|
30
|
-
p,
|
|
31
|
-
_,
|
|
32
|
-
v,
|
|
33
|
-
y,
|
|
34
|
-
b,
|
|
35
|
-
x,
|
|
36
|
-
C,
|
|
37
|
-
w,
|
|
38
|
-
T,
|
|
39
|
-
E,
|
|
40
|
-
D,
|
|
41
|
-
O
|
|
42
|
-
]), z = P.length > 0;
|
|
43
|
-
a.useEffect(() => {
|
|
44
|
-
k && k(z);
|
|
45
|
-
}, [z, k]);
|
|
46
|
-
let B = P;
|
|
47
|
-
P.length > 0 && !P[P.length - 1].isCompleted && (B = B.slice(0, -1));
|
|
48
|
-
let V = t.includes(p), H = e.includes(p), U = "";
|
|
49
|
-
g && H ? U = L(r.welcomeMessageIntelligentQueryNotice) : V && (U = L(r.welcomeMessageSpreadsheetNotice));
|
|
50
|
-
let W = I?.suggestedQuestions !== null, G = (e) => {
|
|
51
|
-
D("suggestedQuestions", e);
|
|
52
|
-
}, K = typeof h == "function" ? [] : S, q = u.suggestedQuestions?.length > 0 && !W ? u.suggestedQuestions : K;
|
|
53
|
-
return /* @__PURE__ */ s(c, {
|
|
54
|
-
value: u.agents,
|
|
55
|
-
children: /* @__PURE__ */ s(n.Provider, {
|
|
56
|
-
value: R,
|
|
57
|
-
children: /* @__PURE__ */ s(i, {
|
|
58
|
-
cachedSuggestedQuestions: W ? [] : u.suggestedQuestions,
|
|
59
|
-
embedTheAnswerButtonConfig: j,
|
|
60
|
-
getSuggestedQuestions: h,
|
|
61
|
-
isOpen: !0,
|
|
62
|
-
isStopResponseEnabled: y,
|
|
63
|
-
itemID: m,
|
|
64
|
-
items: b,
|
|
65
|
-
onClose: M,
|
|
66
|
-
onSuggestedQuestionsFetched: G,
|
|
67
|
-
promptButtonClickHandler: A,
|
|
68
|
-
restoredQuestions: B,
|
|
69
|
-
restoredSession: u.encodedSession,
|
|
70
|
-
restoredShouldShowLandingPage: u.shouldShowLandingPage,
|
|
71
|
-
shouldPreinitSession: O,
|
|
72
|
-
suggestedQuestions: q,
|
|
73
|
-
warningNotice: U,
|
|
74
|
-
warningNoticeAriaLabel: L(r.welcomeMessageSpreadsheetNoticeAriaLabel),
|
|
75
|
-
...N
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
export { l as IntelligenceSidebar, l as default };
|
|
1
|
+
import{INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS,SPREADSHEET_FILE_EXTENSIONS}from"../common/constants.js";import{IntelligenceSidebarContext}from"./context.js";import messages from"./messages.js";import{t as content_default}from"../../../../chunks/content2.js";import*as React$1 from"react";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{AgentsProvider}from"@box/box-ai-agent-selector";var IntelligenceSidebar=props=>{let{cache,contentName,elementId,fileExtension,fileID,getSuggestedQuestions,isIntelligentQueryMode,isFeedbackEnabled,isFeedbackFormEnabled,isStopResponseEnabled=!1,items,itemSize,localizedQuestions,onFeedbackFormSubmit,onUserInteraction,onSelectedAgentCallback,recordAction,setCacheValue,shouldPreinitSession=!0,setHasQuestions,promptButtonClickHandler,embedTheAnswerButtonConfig,onClose,...rest}=props,{questions,agents}=cache,{selectedAgent}=agents,{formatMessage}=useIntl(),contextValue=React$1.useMemo(()=>({cache,contentName,elementId,fileExtension,isFeedbackEnabled,isFeedbackFormEnabled,isStopResponseEnabled,items,itemSize,onFeedbackFormSubmit,onUserInteraction,onSelectedAgentCallback,recordAction,setCacheValue,shouldPreinitSession}),[cache,contentName,elementId,fileExtension,isFeedbackEnabled,isFeedbackFormEnabled,isStopResponseEnabled,items,itemSize,onFeedbackFormSubmit,onUserInteraction,onSelectedAgentCallback,recordAction,setCacheValue,shouldPreinitSession]),newHasQuestions=questions.length>0;React$1.useEffect(()=>{setHasQuestions&&setHasQuestions(newHasQuestions)},[newHasQuestions,setHasQuestions]);let questionsWithoutInProgress=questions;questions.length>0&&!questions[questions.length-1].isCompleted&&(questionsWithoutInProgress=questionsWithoutInProgress.slice(0,-1));let isSpreadsheet=SPREADSHEET_FILE_EXTENSIONS.includes(fileExtension),isIntelligentQueryCompatible=INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS.includes(fileExtension),spreadsheetNotice=``;isIntelligentQueryMode&&isIntelligentQueryCompatible?spreadsheetNotice=formatMessage(messages.welcomeMessageIntelligentQueryNotice):isSpreadsheet&&(spreadsheetNotice=formatMessage(messages.welcomeMessageSpreadsheetNotice));let doesSelectedAgentHaveCustomSuggestedQuestions=selectedAgent?.suggestedQuestions!==null,handleSuggestedQuestionsFetched=fetchedSuggestedQuestions=>{setCacheValue(`suggestedQuestions`,fetchedSuggestedQuestions)},fallbackSuggestedQuestions=typeof getSuggestedQuestions==`function`?[]:localizedQuestions,suggestedQuestions=cache.suggestedQuestions?.length>0&&!doesSelectedAgentHaveCustomSuggestedQuestions?cache.suggestedQuestions:fallbackSuggestedQuestions;return jsx(AgentsProvider,{value:cache.agents,children:jsx(IntelligenceSidebarContext.Provider,{value:contextValue,children:jsx(content_default,{cachedSuggestedQuestions:doesSelectedAgentHaveCustomSuggestedQuestions?[]:cache.suggestedQuestions,embedTheAnswerButtonConfig,getSuggestedQuestions,isOpen:!0,isStopResponseEnabled,itemID:fileID,items,onClose,onSuggestedQuestionsFetched:handleSuggestedQuestionsFetched,promptButtonClickHandler,restoredQuestions:questionsWithoutInProgress,restoredSession:cache.encodedSession,restoredShouldShowLandingPage:cache.shouldShowLandingPage,shouldPreinitSession,suggestedQuestions,warningNotice:spreadsheetNotice,warningNoticeAriaLabel:formatMessage(messages.welcomeMessageSpreadsheetNoticeAriaLabel),...rest})})})};export{IntelligenceSidebar,IntelligenceSidebar as default};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Text as t } from "@box/blueprint-web";
|
|
3
|
-
import { useIntl as n } from "react-intl";
|
|
4
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
import { REQUEST_STATE as i, useAgents as a } from "@box/box-ai-agent-selector";
|
|
6
|
-
function o({ isAIStudioAgentSelectorEnabled: o = !1 }) {
|
|
7
|
-
let { formatMessage: s } = n(), { agents: c, requestState: l } = a(), u = l !== i.NOT_STARTED && l !== i.IN_PROGRESS, d = l === i.ERROR || l === i.CANCELLED, f = c.length > 1 && l === i.SUCCESS;
|
|
8
|
-
return !o || d || !f && u ? /* @__PURE__ */ r(t, {
|
|
9
|
-
as: "h3",
|
|
10
|
-
className: "bcs-title",
|
|
11
|
-
children: s(e.contentAnswersTitle)
|
|
12
|
-
}) : null;
|
|
13
|
-
}
|
|
14
|
-
export { o as default };
|
|
1
|
+
import messages from"../../messages.js";import{Text}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import{REQUEST_STATE,useAgents}from"@box/box-ai-agent-selector";function IntelligenceSidebarTitle({isAIStudioAgentSelectorEnabled=!1}){let{formatMessage}=useIntl(),{agents,requestState}=useAgents(),hasAgentSelectorRequestEnded=requestState!==REQUEST_STATE.NOT_STARTED&&requestState!==REQUEST_STATE.IN_PROGRESS,hasAgentSelectorRequestFailed=requestState===REQUEST_STATE.ERROR||requestState===REQUEST_STATE.CANCELLED,isAgentSelectorVisible=agents.length>1&&requestState===REQUEST_STATE.SUCCESS;return!isAIStudioAgentSelectorEnabled||hasAgentSelectorRequestFailed||!isAgentSelectorVisible&&hasAgentSelectorRequestEnded?jsx(Text,{as:`h3`,className:`bcs-title`,children:formatMessage(messages.contentAnswersTitle)}):null}export{IntelligenceSidebarTitle as default};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
loadingSuggestedQuestions: {
|
|
4
|
-
id: "boxAI.contentAnswers.loadingSuggestedQuestions",
|
|
5
|
-
defaultMessage: "Loading suggestions"
|
|
6
|
-
},
|
|
7
|
-
loadingSuggestedQuestionsFailed: {
|
|
8
|
-
id: "boxAI.contentAnswers.loadingSuggestedQuestionsFailed",
|
|
9
|
-
defaultMessage: "Suggestions failed to load"
|
|
10
|
-
},
|
|
11
|
-
suggestedQuestions: {
|
|
12
|
-
id: "boxAI.contentAnswers.suggestedQuestions",
|
|
13
|
-
defaultMessage: "Suggested Questions:"
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({loadingSuggestedQuestions:{id:`boxAI.contentAnswers.loadingSuggestedQuestions`,defaultMessage:`Loading suggestions`},loadingSuggestedQuestionsFailed:{id:`boxAI.contentAnswers.loadingSuggestedQuestionsFailed`,defaultMessage:`Suggestions failed to load`},suggestedQuestions:{id:`boxAI.contentAnswers.suggestedQuestions`,defaultMessage:`Suggested Questions:`}});export{messages as default};
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
{
|
|
3
|
-
id: "suggested-question-1",
|
|
4
|
-
prompt: "Summarize this document"
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
id: "suggested-question-2",
|
|
8
|
-
prompt: "What are the key takeaways?"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: "suggested-question-3",
|
|
12
|
-
prompt: "How can this document be improved?"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: "suggested-question-4",
|
|
16
|
-
prompt: "Are there any next steps defined?"
|
|
17
|
-
}
|
|
18
|
-
], t = [
|
|
19
|
-
{
|
|
20
|
-
id: "suggested-question-1",
|
|
21
|
-
prompt: "Cached suggested question 1"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: "suggested-question-2",
|
|
25
|
-
prompt: "Cached suggested question 2"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: "suggested-question-3",
|
|
29
|
-
prompt: "Cached suggested question 3"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: "suggested-question-4",
|
|
33
|
-
prompt: "Cached suggested question 4"
|
|
34
|
-
}
|
|
35
|
-
];
|
|
36
|
-
export { t as DEFAULT_CUSTOM_SUGGESTED_QUESTIONS, e as DEFAULT_SUGGESTED_QUESTIONS };
|
|
1
|
+
var DEFAULT_SUGGESTED_QUESTIONS=[{id:`suggested-question-1`,prompt:`Summarize this document`},{id:`suggested-question-2`,prompt:`What are the key takeaways?`},{id:`suggested-question-3`,prompt:`How can this document be improved?`},{id:`suggested-question-4`,prompt:`Are there any next steps defined?`}],DEFAULT_CUSTOM_SUGGESTED_QUESTIONS=[{id:`suggested-question-1`,prompt:`Cached suggested question 1`},{id:`suggested-question-2`,prompt:`Cached suggested question 2`},{id:`suggested-question-3`,prompt:`Cached suggested question 3`},{id:`suggested-question-4`,prompt:`Cached suggested question 4`}];export{DEFAULT_CUSTOM_SUGGESTED_QUESTIONS,DEFAULT_SUGGESTED_QUESTIONS};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as SuggestedQuestions, e as default };
|
|
1
|
+
import{t as SuggestedQuestions}from"../../../../chunks/suggested-questions.js";export{SuggestedQuestions,SuggestedQuestions as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as Suggestions, e as default };
|
|
1
|
+
import{t as Suggestions}from"../../../../chunks/suggestions.js";export{Suggestions,Suggestions as default};
|