@box/box-ai-content-answers 1.7.1 → 1.7.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,24 +1,24 @@
|
|
|
1
|
-
import { useBreakpoint as
|
|
1
|
+
import { useBreakpoint as X, Breakpoint as Y, Modal as d, TooltipProvider as Z, Tooltip as ee } from "@box/blueprint-web";
|
|
2
2
|
import { ArrowsCollapse as oe } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
3
|
import { BoxAiLogo as te } from "@box/blueprint-web-assets/icons/Logo";
|
|
4
|
-
import { Size8 as
|
|
4
|
+
import { Size8 as v } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
5
|
import { BoxAiAgentSelectorWithApi as se, AgentsProvider as ae } from "@box/box-ai-agent-selector";
|
|
6
6
|
import { useState as le, useMemo as re, useCallback as I, useEffect as C } from "react";
|
|
7
7
|
import { useIntl as ne } from "react-intl";
|
|
8
8
|
import { BoxAiContentAnswers as ie } from "../../box-ai-content-answers.js";
|
|
9
|
-
import { A as
|
|
9
|
+
import { A as ce, R as de } from "../../../../chunks/types.js";
|
|
10
10
|
import { LOGGER_BASE_CONFIG as p, LOGGER_ACTION_CLICK as me } from "../common/constants.js";
|
|
11
11
|
import { s, C as ge } from "../../../../chunks/clear-conversation-button.js";
|
|
12
12
|
import fe from "./hooks/useStopPropagationOnEsc.js";
|
|
13
13
|
import { Title as ue } from "./title.js";
|
|
14
14
|
import S from "./messages.js";
|
|
15
|
-
import { jsxs as
|
|
16
|
-
const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", pe = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel,
|
|
15
|
+
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
16
|
+
const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", pe = (o) => o ? S.collapseModalAriaLabel : S.closeModalAriaLabel, he = (o) => o ? oe : void 0, Me = (o) => {
|
|
17
17
|
const l = o === "collapsible";
|
|
18
18
|
return {
|
|
19
19
|
closeModalLabel: pe(l),
|
|
20
20
|
closeModalTargetId: Ce(l),
|
|
21
|
-
closeModalIcon:
|
|
21
|
+
closeModalIcon: he(l)
|
|
22
22
|
};
|
|
23
23
|
}, Pe = ({
|
|
24
24
|
children: o,
|
|
@@ -28,7 +28,7 @@ const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
28
28
|
isAIStudioAgentSelectorEnabled: g = !1,
|
|
29
29
|
isDebugModeEnabled: B,
|
|
30
30
|
isStopResponseEnabled: _ = !1,
|
|
31
|
-
itemSize:
|
|
31
|
+
itemSize: M,
|
|
32
32
|
extension: T,
|
|
33
33
|
onClearAction: f,
|
|
34
34
|
onSelectAgent: k,
|
|
@@ -39,25 +39,25 @@ const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
39
39
|
shouldRenderProviders: H = !0,
|
|
40
40
|
shouldShowLandingPage: z = !1,
|
|
41
41
|
stopPropagationOnEsc: F,
|
|
42
|
-
variant:
|
|
42
|
+
variant: b = "closable",
|
|
43
43
|
items: i,
|
|
44
|
-
parentItem:
|
|
44
|
+
parentItem: c,
|
|
45
45
|
...j
|
|
46
46
|
}) => {
|
|
47
|
-
var
|
|
47
|
+
var w, E;
|
|
48
48
|
const {
|
|
49
|
-
open:
|
|
49
|
+
open: L,
|
|
50
50
|
defaultOpen: D,
|
|
51
51
|
onOpenChange: Q,
|
|
52
52
|
modal: U,
|
|
53
53
|
...a
|
|
54
|
-
} = j,
|
|
55
|
-
fe(F,
|
|
56
|
-
const u = (
|
|
54
|
+
} = j, R = ne(), W = X() <= Y.Medium;
|
|
55
|
+
fe(F, L);
|
|
56
|
+
const u = (E = (w = a == null ? void 0 : a.questions) == null ? void 0 : w[a.questions.length - 1]) == null ? void 0 : E.error, [y, A] = le(!1), {
|
|
57
57
|
closeModalLabel: O,
|
|
58
58
|
closeModalTargetId: K,
|
|
59
|
-
closeModalIcon:
|
|
60
|
-
} = re(() =>
|
|
59
|
+
closeModalIcon: $
|
|
60
|
+
} = re(() => Me(b), [b]), n = I((t) => {
|
|
61
61
|
r && (t.data ?? (t.data = {}), t.data.hostAppName = m, r(t));
|
|
62
62
|
}, [m, r]);
|
|
63
63
|
C(() => {
|
|
@@ -65,76 +65,76 @@ const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
65
65
|
...p,
|
|
66
66
|
target: "loaded",
|
|
67
67
|
data: {
|
|
68
|
-
fileSize:
|
|
68
|
+
fileSize: M,
|
|
69
69
|
fileType: T
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
}, [n, T,
|
|
72
|
+
}, [n, T, M, i, r]), C(() => {
|
|
73
73
|
i && n({
|
|
74
74
|
...p,
|
|
75
75
|
target: "loaded",
|
|
76
76
|
data: {
|
|
77
|
-
parentItemType:
|
|
77
|
+
parentItemType: c == null ? void 0 : c.type,
|
|
78
78
|
items: i.map((t) => ({
|
|
79
79
|
status: t.status,
|
|
80
80
|
fileType: t.fileType
|
|
81
81
|
}))
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
}, [n,
|
|
85
|
-
u && u ===
|
|
84
|
+
}, [n, c, r]), C(() => {
|
|
85
|
+
u && u === ce.AGENT_NOT_FOUND && A(!0);
|
|
86
86
|
}, [u]);
|
|
87
|
-
const
|
|
87
|
+
const J = () => {
|
|
88
88
|
f && (f(), n({
|
|
89
89
|
...p,
|
|
90
90
|
action: me,
|
|
91
91
|
target: "clearChat"
|
|
92
92
|
}));
|
|
93
|
-
},
|
|
93
|
+
}, V = I(async () => (A(!1), l()), [l]), N = /* @__PURE__ */ h(d, {
|
|
94
94
|
defaultOpen: D,
|
|
95
95
|
modal: U,
|
|
96
96
|
onOpenChange: Q,
|
|
97
|
-
open:
|
|
98
|
-
children: [/* @__PURE__ */ e(
|
|
97
|
+
open: L,
|
|
98
|
+
children: [/* @__PURE__ */ e(d.Trigger, {
|
|
99
99
|
children: o
|
|
100
|
-
}), /* @__PURE__ */
|
|
100
|
+
}), /* @__PURE__ */ h(d.Content, {
|
|
101
101
|
className: s.contentAnswersModal,
|
|
102
102
|
"data-testid": "content-answers-modal",
|
|
103
103
|
size: "xlarge",
|
|
104
|
-
children: [/* @__PURE__ */ e(
|
|
104
|
+
children: [/* @__PURE__ */ e(d.Header, {
|
|
105
105
|
className: s.modalHeaderContainer,
|
|
106
|
-
children: /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ h("div", {
|
|
107
107
|
className: s.modalHeader,
|
|
108
108
|
children: [!W && /* @__PURE__ */ e(te, {
|
|
109
109
|
className: s.BoxAIIconColor,
|
|
110
110
|
"data-testid": "content-answers-icon-color",
|
|
111
|
-
height:
|
|
112
|
-
width:
|
|
111
|
+
height: v,
|
|
112
|
+
width: v
|
|
113
113
|
}), /* @__PURE__ */ e(ue, {
|
|
114
114
|
isAIStudioAgentSelectorEnabled: g
|
|
115
115
|
}), g && /* @__PURE__ */ e(se, {
|
|
116
116
|
contentClassName: s.agentSelectorContent,
|
|
117
117
|
disabled: a.hasRequestInProgress,
|
|
118
|
-
fetcher:
|
|
118
|
+
fetcher: V,
|
|
119
119
|
hostAppName: m,
|
|
120
120
|
onSelectAgent: k,
|
|
121
121
|
onSelectedAgentCallback: P,
|
|
122
122
|
recordAction: r,
|
|
123
|
-
requestState: y ?
|
|
123
|
+
requestState: y ? de.ERROR : void 0,
|
|
124
124
|
shouldHideAgentSelectorOnLoad: !0,
|
|
125
125
|
triggerChipClassName: s.agentSelectorTrigger,
|
|
126
126
|
useAgentLocalStorage: !0
|
|
127
127
|
})]
|
|
128
128
|
})
|
|
129
129
|
}), /* @__PURE__ */ e(ie, {
|
|
130
|
-
className: s.boxAiContentAnswers
|
|
130
|
+
className: `box-content-answers-chat-container ${s.boxAiContentAnswers}`,
|
|
131
131
|
hasCustomSuggestedQuestions: x,
|
|
132
132
|
hostAppName: m,
|
|
133
133
|
isAIStudioAgentSelectorEnabled: g,
|
|
134
134
|
isDebugModeEnabled: B,
|
|
135
135
|
isStopResponseEnabled: _,
|
|
136
136
|
items: i,
|
|
137
|
-
parentItem:
|
|
137
|
+
parentItem: c,
|
|
138
138
|
promptValue: q,
|
|
139
139
|
recordAction: n,
|
|
140
140
|
setPromptValue: G,
|
|
@@ -142,16 +142,16 @@ const Ce = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
142
142
|
...a
|
|
143
143
|
}), f && /* @__PURE__ */ e(ge, {
|
|
144
144
|
hasRequestInProgress: a.hasRequestInProgress,
|
|
145
|
-
onClick:
|
|
146
|
-
}), /* @__PURE__ */ e(
|
|
145
|
+
onClick: J
|
|
146
|
+
}), /* @__PURE__ */ e(Z, {
|
|
147
147
|
children: /* @__PURE__ */ e(ee, {
|
|
148
|
-
content:
|
|
148
|
+
content: R.formatMessage(O),
|
|
149
149
|
"data-testid": "content-answers-close-modal-tooltip",
|
|
150
|
-
children: /* @__PURE__ */ e(
|
|
151
|
-
"aria-label":
|
|
150
|
+
children: /* @__PURE__ */ e(d.Close, {
|
|
151
|
+
"aria-label": R.formatMessage(O),
|
|
152
152
|
className: s["modal-close-button"],
|
|
153
153
|
"data-target-id": K,
|
|
154
|
-
icon:
|
|
154
|
+
icon: $,
|
|
155
155
|
size: "small"
|
|
156
156
|
})
|
|
157
157
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*!
|
|
2
|
+
Theme: a11y-dark
|
|
3
|
+
Author: @ericwbailey
|
|
4
|
+
Maintainer: @ericwbailey
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
*/.hljs{
|
|
6
|
+
Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css
|
|
7
|
+
*/.box-content-answers-chat-container code.hljs{padding:3px 5px}.box-content-answers-chat-container pre code.hljs{display:block;padding:1em;overflow-x:auto}.box-content-answers-chat-container .hljs{color:#f8f8f2;background:#2b2b2b}.box-content-answers-chat-container .hljs-comment,.box-content-answers-chat-container .hljs-quote{color:#d4d0ab}.box-content-answers-chat-container .hljs-variable,.box-content-answers-chat-container .hljs-template-variable,.box-content-answers-chat-container .hljs-tag,.box-content-answers-chat-container .hljs-name,.box-content-answers-chat-container .hljs-selector-id,.box-content-answers-chat-container .hljs-selector-class,.box-content-answers-chat-container .hljs-regexp,.box-content-answers-chat-container .hljs-deletion{color:#ffa07a}.box-content-answers-chat-container .hljs-number,.box-content-answers-chat-container .hljs-built_in,.box-content-answers-chat-container .hljs-literal,.box-content-answers-chat-container .hljs-type,.box-content-answers-chat-container .hljs-params,.box-content-answers-chat-container .hljs-meta,.box-content-answers-chat-container .hljs-link{color:#f5ab35}.box-content-answers-chat-container .hljs-attribute{color:gold}.box-content-answers-chat-container .hljs-string,.box-content-answers-chat-container .hljs-symbol,.box-content-answers-chat-container .hljs-bullet,.box-content-answers-chat-container .hljs-addition{color:#abe338}.box-content-answers-chat-container .hljs-title,.box-content-answers-chat-container .hljs-section{color:#00e0e0}.box-content-answers-chat-container .hljs-keyword,.box-content-answers-chat-container .hljs-selector-tag{color:#dcc6e0}.box-content-answers-chat-container .hljs-emphasis{font-style:italic}.box-content-answers-chat-container .hljs-strong{font-weight:700}@media screen and (-ms-high-contrast: active){.box-content-answers-chat-container .hljs-addition,.box-content-answers-chat-container .hljs-attribute,.box-content-answers-chat-container .hljs-built_in,.box-content-answers-chat-container .hljs-bullet,.box-content-answers-chat-container .hljs-comment,.box-content-answers-chat-container .hljs-link,.box-content-answers-chat-container .hljs-literal,.box-content-answers-chat-container .hljs-meta,.box-content-answers-chat-container .hljs-number,.box-content-answers-chat-container .hljs-params,.box-content-answers-chat-container .hljs-string,.box-content-answers-chat-container .hljs-symbol,.box-content-answers-chat-container .hljs-type,.box-content-answers-chat-container .hljs-quote{color:highlight}.box-content-answers-chat-container .hljs-keyword,.box-content-answers-chat-container .hljs-selector-tag{font-weight:700}}
|