@box/box-ai-content-answers 0.74.2 → 0.75.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/chunks/clear-conversation-button.js +39 -0
- package/esm/index.js +12 -10
- package/esm/lib/components/modal/clear-conversation-button.js +10 -0
- package/esm/lib/components/modal/modal.js +86 -109
- package/package.json +4 -4
- package/types/index.d.ts +1 -0
- package/types/lib/components/modal/clear-conversation-button.d.ts +5 -0
- /package/styles/{modal.css → clear-conversation-button.css} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "../styles/clear-conversation-button.css";
|
|
2
|
+
import { Tooltip as r, IconButton as a } from "@box/blueprint-web";
|
|
3
|
+
import { Trash as s } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import { useIntl as l } from "react-intl";
|
|
5
|
+
import e from "../esm/lib/components/modal/messages.js";
|
|
6
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
7
|
+
const c = "_BoxAIIconColor_1ed3r_1", d = "_modalHeader_1ed3r_5", i = "_contentAnswersModal_1ed3r_10", _ = "_boxAiContentAnswers_1ed3r_17", m = "_clearButton_1ed3r_25", C = "_contentAnswerModal_1ed3r_1", g = "_modalHeaderContainer_1ed3r_54", A = "_agentSelectorTrigger_1ed3r_62", u = "_agentSelectorContent_1ed3r_73", b = {
|
|
8
|
+
BoxAIIconColor: c,
|
|
9
|
+
modalHeader: d,
|
|
10
|
+
contentAnswersModal: i,
|
|
11
|
+
boxAiContentAnswers: _,
|
|
12
|
+
clearButton: m,
|
|
13
|
+
"modal-close-button": "_modal-close-button_1ed3r_29",
|
|
14
|
+
contentAnswerModal: C,
|
|
15
|
+
modalHeaderContainer: g,
|
|
16
|
+
agentSelectorTrigger: A,
|
|
17
|
+
agentSelectorContent: u
|
|
18
|
+
}, f = ({
|
|
19
|
+
onClick: n
|
|
20
|
+
}) => {
|
|
21
|
+
const o = l();
|
|
22
|
+
return /* @__PURE__ */ t(r, {
|
|
23
|
+
content: o.formatMessage(e.clearConversationLabel),
|
|
24
|
+
"data-testid": "clear-conversation-tooltip",
|
|
25
|
+
variant: "standard",
|
|
26
|
+
children: /* @__PURE__ */ t(a, {
|
|
27
|
+
"aria-label": o.formatMessage(e.clearConversationLabel),
|
|
28
|
+
className: b.clearButton,
|
|
29
|
+
"data-testid": "clear-conversation-button",
|
|
30
|
+
icon: s,
|
|
31
|
+
onClick: n,
|
|
32
|
+
size: "small"
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
f as C,
|
|
38
|
+
b as s
|
|
39
|
+
};
|
package/esm/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { BoxAiContentAnswers as e } from "./lib/box-ai-content-answers.js";
|
|
2
|
-
import { AnswerContent as
|
|
3
|
-
import { withApiWrapper as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { AnswerContent as n } from "./lib/components/answer/answer-content.js";
|
|
3
|
+
import { withApiWrapper as R } from "./lib/components/api-wrapper/api-wrapper.js";
|
|
4
|
+
import { C as s } from "../chunks/clear-conversation-button.js";
|
|
5
|
+
import { IntelligenceModal as A } from "./lib/components/modal/modal.js";
|
|
6
|
+
import { A as E, C as f, R as m } from "../chunks/types.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
E as ANSWER_ERROR,
|
|
9
|
+
n as AnswerContent,
|
|
9
10
|
e as BoxAiContentAnswers,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
f as CONTENT_ERROR,
|
|
12
|
+
s as ClearConversationButton,
|
|
13
|
+
A as IntelligenceModal,
|
|
14
|
+
m as REQUEST_STATE,
|
|
15
|
+
R as withApiWrapper
|
|
14
16
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "@box/blueprint-web";
|
|
2
|
+
import "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import "react-intl";
|
|
4
|
+
import "./messages.js";
|
|
5
|
+
import { C as e, C } from "../../../../chunks/clear-conversation-button.js";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
export {
|
|
8
|
+
e as ClearConversationButton,
|
|
9
|
+
C as default
|
|
10
|
+
};
|
|
@@ -1,155 +1,132 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { LOGGER_BASE_CONFIG as B, LOGGER_ACTION_CLICK as ae } from "../common/constants.js";
|
|
1
|
+
import { useBreakpoint as U, Breakpoint as W, Modal as n, Text as D } from "@box/blueprint-web";
|
|
2
|
+
import { ArrowsCollapse as K } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { BoxAiLogo as $ } from "@box/blueprint-web-assets/icons/Logo";
|
|
4
|
+
import { Size8 as T } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import { BoxAiAgentSelectorWithApi as J, AgentsProvider as V } from "@box/box-ai-agent-selector";
|
|
6
|
+
import l from "react";
|
|
7
|
+
import { useIntl as X } from "react-intl";
|
|
8
|
+
import { BoxAiContentAnswers as Y } from "../../box-ai-content-answers.js";
|
|
9
|
+
import { AgentsProvider as Z } from "../../contexts/AgentsContext.js";
|
|
10
|
+
import { A as y, R as ee } from "../../../../chunks/types.js";
|
|
11
|
+
import { AgentSelector as te } from "../agents/agent-selector.js";
|
|
12
|
+
import { LOGGER_BASE_CONFIG as L, LOGGER_ACTION_CLICK as oe } from "../common/constants.js";
|
|
13
|
+
import { s as t, C as re } from "../../../../chunks/clear-conversation-button.js";
|
|
15
14
|
import se from "./hooks/useStopPropagationOnEsc.js";
|
|
16
|
-
import
|
|
17
|
-
import { jsxs as
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
boxAiContentAnswers: de,
|
|
23
|
-
clearButton: me,
|
|
24
|
-
"modal-close-button": "_modal-close-button_1ed3r_29",
|
|
25
|
-
contentAnswerModal: ge,
|
|
26
|
-
modalHeaderContainer: _e,
|
|
27
|
-
agentSelectorTrigger: fe,
|
|
28
|
-
agentSelectorContent: Ce
|
|
29
|
-
}, He = ({
|
|
30
|
-
children: N,
|
|
31
|
-
getAIStudioAgents: f,
|
|
32
|
-
hasCustomSuggestedQuestions: S,
|
|
15
|
+
import f from "./messages.js";
|
|
16
|
+
import { jsxs as g, jsx as e } from "react/jsx-runtime";
|
|
17
|
+
const Re = ({
|
|
18
|
+
children: _,
|
|
19
|
+
getAIStudioAgents: p,
|
|
20
|
+
hasCustomSuggestedQuestions: b,
|
|
33
21
|
hostAppName: m,
|
|
34
22
|
isAgentSelectorEnabled: C,
|
|
35
|
-
isAIStudioAgentSelectorEnabled:
|
|
36
|
-
isDebugModeEnabled:
|
|
37
|
-
isResetChatEnabled:
|
|
38
|
-
isStopResponseEnabled:
|
|
23
|
+
isAIStudioAgentSelectorEnabled: i,
|
|
24
|
+
isDebugModeEnabled: x,
|
|
25
|
+
isResetChatEnabled: k,
|
|
26
|
+
isStopResponseEnabled: w = !1,
|
|
39
27
|
itemSize: u,
|
|
40
|
-
extension:
|
|
41
|
-
onClearAction:
|
|
42
|
-
onSelectAgent:
|
|
28
|
+
extension: h,
|
|
29
|
+
onClearAction: A,
|
|
30
|
+
onSelectAgent: B,
|
|
43
31
|
recordAction: o,
|
|
44
|
-
shouldRenderProviders:
|
|
45
|
-
stopPropagationOnEsc:
|
|
46
|
-
variant:
|
|
47
|
-
...
|
|
32
|
+
shouldRenderProviders: S = !0,
|
|
33
|
+
stopPropagationOnEsc: G,
|
|
34
|
+
variant: N = "closable",
|
|
35
|
+
...I
|
|
48
36
|
}) => {
|
|
49
|
-
var
|
|
37
|
+
var E, M;
|
|
50
38
|
const {
|
|
51
|
-
open:
|
|
52
|
-
defaultOpen:
|
|
53
|
-
onOpenChange:
|
|
54
|
-
modal:
|
|
39
|
+
open: O,
|
|
40
|
+
defaultOpen: P,
|
|
41
|
+
onOpenChange: H,
|
|
42
|
+
modal: q,
|
|
55
43
|
...r
|
|
56
|
-
} =
|
|
57
|
-
se(
|
|
58
|
-
const
|
|
59
|
-
o && (
|
|
44
|
+
} = I, c = X(), z = U() <= W.Medium;
|
|
45
|
+
se(G, O);
|
|
46
|
+
const d = (M = (E = r == null ? void 0 : r.questions) == null ? void 0 : E[r.questions.length - 1]) == null ? void 0 : M.error, [F, v] = l.useState(!1), s = l.useCallback((a) => {
|
|
47
|
+
o && (a.data ?? (a.data = {}), a.data.hostAppName = m, o(a));
|
|
60
48
|
}, [m, o]);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
...
|
|
49
|
+
l.useEffect(() => {
|
|
50
|
+
s({
|
|
51
|
+
...L,
|
|
64
52
|
target: "loaded",
|
|
65
53
|
data: {
|
|
66
54
|
fileSize: u,
|
|
67
|
-
fileType:
|
|
55
|
+
fileType: h
|
|
68
56
|
}
|
|
69
57
|
});
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
}, [
|
|
58
|
+
}, [s, h, u, o]), l.useEffect(() => {
|
|
59
|
+
d && d === y.AGENT_NOT_FOUND && v(!0);
|
|
60
|
+
}, [d]);
|
|
73
61
|
const j = () => {
|
|
74
|
-
|
|
75
|
-
...
|
|
76
|
-
action:
|
|
62
|
+
A && (A(), s({
|
|
63
|
+
...L,
|
|
64
|
+
action: oe,
|
|
77
65
|
target: "clearChat"
|
|
78
66
|
}));
|
|
79
|
-
}, Q =
|
|
80
|
-
defaultOpen:
|
|
81
|
-
modal:
|
|
82
|
-
onOpenChange:
|
|
83
|
-
open:
|
|
84
|
-
children: [/* @__PURE__ */ e(
|
|
85
|
-
children:
|
|
86
|
-
}), /* @__PURE__ */
|
|
67
|
+
}, Q = l.useCallback(async () => (v(!1), p()), [p]), R = /* @__PURE__ */ g(n, {
|
|
68
|
+
defaultOpen: P,
|
|
69
|
+
modal: q,
|
|
70
|
+
onOpenChange: H,
|
|
71
|
+
open: O,
|
|
72
|
+
children: [/* @__PURE__ */ e(n.Trigger, {
|
|
73
|
+
children: _
|
|
74
|
+
}), /* @__PURE__ */ g(n.Content, {
|
|
87
75
|
className: t.contentAnswersModal,
|
|
88
76
|
"data-testid": "content-answers-modal",
|
|
89
77
|
size: "xlarge",
|
|
90
|
-
children: [/* @__PURE__ */ e(
|
|
78
|
+
children: [/* @__PURE__ */ e(n.Header, {
|
|
91
79
|
className: t.modalHeaderContainer,
|
|
92
|
-
children: /* @__PURE__ */
|
|
80
|
+
children: /* @__PURE__ */ g("div", {
|
|
93
81
|
className: t.modalHeader,
|
|
94
|
-
children: [!
|
|
82
|
+
children: [!z && /* @__PURE__ */ e($, {
|
|
95
83
|
className: t.BoxAIIconColor,
|
|
96
84
|
"data-testid": "content-answers-icon-color",
|
|
97
|
-
height:
|
|
98
|
-
width:
|
|
85
|
+
height: T,
|
|
86
|
+
width: T
|
|
99
87
|
}), /* @__PURE__ */ e(D, {
|
|
100
88
|
as: "span",
|
|
101
89
|
variant: "titleMedium",
|
|
102
|
-
children:
|
|
103
|
-
}), !
|
|
104
|
-
onSelectAgent:
|
|
105
|
-
recordAction:
|
|
106
|
-
}),
|
|
90
|
+
children: c.formatMessage(f.contentAnswersTitle)
|
|
91
|
+
}), !i && C && /* @__PURE__ */ e(te, {
|
|
92
|
+
onSelectAgent: B,
|
|
93
|
+
recordAction: s
|
|
94
|
+
}), i && /* @__PURE__ */ e(J, {
|
|
107
95
|
contentClassName: t.agentSelectorContent,
|
|
108
96
|
fetcher: Q,
|
|
109
97
|
hostAppName: m,
|
|
110
98
|
recordAction: o,
|
|
111
|
-
requestState: F ?
|
|
99
|
+
requestState: F ? ee.ERROR : void 0,
|
|
112
100
|
shouldHideAgentSelectorOnLoad: !0,
|
|
113
101
|
triggerChipClassName: t.agentSelectorTrigger
|
|
114
102
|
})]
|
|
115
103
|
})
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
variant: "standard",
|
|
121
|
-
children: /* @__PURE__ */ e($, {
|
|
122
|
-
"aria-label": n.formatMessage(c.clearConversationLabel),
|
|
123
|
-
className: t.clearButton,
|
|
124
|
-
"data-testid": "clear-conversation-button",
|
|
125
|
-
icon: V,
|
|
126
|
-
onClick: j,
|
|
127
|
-
size: "small"
|
|
128
|
-
})
|
|
129
|
-
}), /* @__PURE__ */ e(l.Close, {
|
|
130
|
-
"aria-label": h === "collapsible" ? n.formatMessage(c.collapseModalAriaLabel) : n.formatMessage(c.closeModalAriaLabel),
|
|
104
|
+
}), k && /* @__PURE__ */ e(re, {
|
|
105
|
+
onClick: j
|
|
106
|
+
}), /* @__PURE__ */ e(n.Close, {
|
|
107
|
+
"aria-label": N === "collapsible" ? c.formatMessage(f.collapseModalAriaLabel) : c.formatMessage(f.closeModalAriaLabel),
|
|
131
108
|
className: t["modal-close-button"],
|
|
132
|
-
icon:
|
|
109
|
+
icon: N === "collapsible" ? K : void 0,
|
|
133
110
|
size: "small"
|
|
134
|
-
}), /* @__PURE__ */ e(
|
|
111
|
+
}), /* @__PURE__ */ e(Y, {
|
|
135
112
|
className: t.boxAiContentAnswers,
|
|
136
|
-
hasCustomSuggestedQuestions:
|
|
137
|
-
isAgentSelectorEnabled: !
|
|
138
|
-
isAIStudioAgentSelectorEnabled:
|
|
139
|
-
isDebugModeEnabled:
|
|
140
|
-
isStopResponseEnabled:
|
|
141
|
-
recordAction:
|
|
113
|
+
hasCustomSuggestedQuestions: b,
|
|
114
|
+
isAgentSelectorEnabled: !i && C,
|
|
115
|
+
isAIStudioAgentSelectorEnabled: i,
|
|
116
|
+
isDebugModeEnabled: x,
|
|
117
|
+
isStopResponseEnabled: w,
|
|
118
|
+
recordAction: s,
|
|
142
119
|
...r
|
|
143
120
|
})]
|
|
144
121
|
})]
|
|
145
122
|
});
|
|
146
|
-
return
|
|
147
|
-
children: /* @__PURE__ */ e(
|
|
148
|
-
children:
|
|
123
|
+
return S ? /* @__PURE__ */ e(V, {
|
|
124
|
+
children: /* @__PURE__ */ e(Z, {
|
|
125
|
+
children: R
|
|
149
126
|
})
|
|
150
|
-
}) :
|
|
127
|
+
}) : R;
|
|
151
128
|
};
|
|
152
129
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
130
|
+
Re as IntelligenceModal,
|
|
131
|
+
Re as default
|
|
155
132
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"remarkable": "^2.0.1"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@box/blueprint-web": "^9.5.
|
|
17
|
+
"@box/blueprint-web": "^9.5.1",
|
|
18
18
|
"@box/blueprint-web-assets": "^4.31.0",
|
|
19
|
-
"@box/box-ai-agent-selector": "^0.18.
|
|
19
|
+
"@box/box-ai-agent-selector": "^0.18.3",
|
|
20
20
|
"@box/storybook-utils": "^0.8.0",
|
|
21
21
|
"@testing-library/react": "^15.0.6",
|
|
22
22
|
"react": "^18.3.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"**/*.css"
|
|
55
55
|
],
|
|
56
56
|
"license": "SEE LICENSE IN LICENSE",
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "039c742b65fea561ed44a219001de569b6430363"
|
|
58
58
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './lib/box-ai-content-answers';
|
|
2
2
|
export * from './lib/components/answer/answer-content';
|
|
3
3
|
export * from './lib/components/api-wrapper/api-wrapper';
|
|
4
|
+
export * from './lib/components/modal/clear-conversation-button';
|
|
4
5
|
export * from './lib/components/modal/modal';
|
|
5
6
|
export * from './lib/types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
interface ClearConversationButtonProps {
|
|
2
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
3
|
+
}
|
|
4
|
+
export declare const ClearConversationButton: ({ onClick }: ClearConversationButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default ClearConversationButton;
|
|
File without changes
|