@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.
@@ -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 R } from "./lib/components/answer/answer-content.js";
3
- import { withApiWrapper as p } from "./lib/components/api-wrapper/api-wrapper.js";
4
- import { IntelligenceModal as E } from "./lib/components/modal/modal.js";
5
- import { A as x, C as a, R as f } from "../chunks/types.js";
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
- x as ANSWER_ERROR,
8
- R as AnswerContent,
8
+ E as ANSWER_ERROR,
9
+ n as AnswerContent,
9
10
  e as BoxAiContentAnswers,
10
- a as CONTENT_ERROR,
11
- E as IntelligenceModal,
12
- f as REQUEST_STATE,
13
- p as withApiWrapper
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 "../../../../styles/modal.css";
2
- import { useBreakpoint as U, Breakpoint as W, Modal as l, Text as D, Tooltip as K, IconButton as $ } from "@box/blueprint-web";
3
- import { ArrowsCollapse as J } from "@box/blueprint-web-assets/icons/Fill";
4
- import { Trash as V } from "@box/blueprint-web-assets/icons/Line";
5
- import { BoxAiLogo as X } from "@box/blueprint-web-assets/icons/Logo";
6
- import { Size8 as x } from "@box/blueprint-web-assets/tokens/tokens";
7
- import { BoxAiAgentSelectorWithApi as Y, AgentsProvider as Z } from "@box/box-ai-agent-selector";
8
- import i from "react";
9
- import { useIntl as y } from "react-intl";
10
- import { BoxAiContentAnswers as ee } from "../../box-ai-content-answers.js";
11
- import { AgentsProvider as te } from "../../contexts/AgentsContext.js";
12
- import { A as oe, R as re } from "../../../../chunks/types.js";
13
- import { AgentSelector as ne } from "../agents/agent-selector.js";
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 c from "./messages.js";
17
- import { jsxs as _, jsx as e } from "react/jsx-runtime";
18
- const le = "_BoxAIIconColor_1ed3r_1", ie = "_modalHeader_1ed3r_5", ce = "_contentAnswersModal_1ed3r_10", de = "_boxAiContentAnswers_1ed3r_17", me = "_clearButton_1ed3r_25", ge = "_contentAnswerModal_1ed3r_1", _e = "_modalHeaderContainer_1ed3r_54", fe = "_agentSelectorTrigger_1ed3r_62", Ce = "_agentSelectorContent_1ed3r_73", t = {
19
- BoxAIIconColor: le,
20
- modalHeader: ie,
21
- contentAnswersModal: ce,
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: d,
36
- isDebugModeEnabled: O,
37
- isResetChatEnabled: I,
38
- isStopResponseEnabled: L = !1,
23
+ isAIStudioAgentSelectorEnabled: i,
24
+ isDebugModeEnabled: x,
25
+ isResetChatEnabled: k,
26
+ isStopResponseEnabled: w = !1,
39
27
  itemSize: u,
40
- extension: A,
41
- onClearAction: p,
42
- onSelectAgent: R,
28
+ extension: h,
29
+ onClearAction: A,
30
+ onSelectAgent: B,
43
31
  recordAction: o,
44
- shouldRenderProviders: E = !0,
45
- stopPropagationOnEsc: H,
46
- variant: h = "closable",
47
- ...k
32
+ shouldRenderProviders: S = !0,
33
+ stopPropagationOnEsc: G,
34
+ variant: N = "closable",
35
+ ...I
48
36
  }) => {
49
- var v, T;
37
+ var E, M;
50
38
  const {
51
- open: M,
52
- defaultOpen: G,
53
- onOpenChange: P,
54
- modal: z,
39
+ open: O,
40
+ defaultOpen: P,
41
+ onOpenChange: H,
42
+ modal: q,
55
43
  ...r
56
- } = k, n = y(), q = U() <= W.Medium;
57
- se(H, M);
58
- const g = (T = (v = r == null ? void 0 : r.questions) == null ? void 0 : v[r.questions.length - 1]) == null ? void 0 : T.error, [F, b] = i.useState(!1), a = i.useCallback((s) => {
59
- o && (s.data ?? (s.data = {}), s.data.hostAppName = m, o(s));
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
- i.useEffect(() => {
62
- a({
63
- ...B,
49
+ l.useEffect(() => {
50
+ s({
51
+ ...L,
64
52
  target: "loaded",
65
53
  data: {
66
54
  fileSize: u,
67
- fileType: A
55
+ fileType: h
68
56
  }
69
57
  });
70
- }, [a, A, u, o]), i.useEffect(() => {
71
- g && g === oe.AGENT_NOT_FOUND && b(!0);
72
- }, [g]);
58
+ }, [s, h, u, o]), l.useEffect(() => {
59
+ d && d === y.AGENT_NOT_FOUND && v(!0);
60
+ }, [d]);
73
61
  const j = () => {
74
- p && (p(), a({
75
- ...B,
76
- action: ae,
62
+ A && (A(), s({
63
+ ...L,
64
+ action: oe,
77
65
  target: "clearChat"
78
66
  }));
79
- }, Q = i.useCallback(async () => (b(!1), f()), [f]), w = /* @__PURE__ */ _(l, {
80
- defaultOpen: G,
81
- modal: z,
82
- onOpenChange: P,
83
- open: M,
84
- children: [/* @__PURE__ */ e(l.Trigger, {
85
- children: N
86
- }), /* @__PURE__ */ _(l.Content, {
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(l.Header, {
78
+ children: [/* @__PURE__ */ e(n.Header, {
91
79
  className: t.modalHeaderContainer,
92
- children: /* @__PURE__ */ _("div", {
80
+ children: /* @__PURE__ */ g("div", {
93
81
  className: t.modalHeader,
94
- children: [!q && /* @__PURE__ */ e(X, {
82
+ children: [!z && /* @__PURE__ */ e($, {
95
83
  className: t.BoxAIIconColor,
96
84
  "data-testid": "content-answers-icon-color",
97
- height: x,
98
- width: x
85
+ height: T,
86
+ width: T
99
87
  }), /* @__PURE__ */ e(D, {
100
88
  as: "span",
101
89
  variant: "titleMedium",
102
- children: n.formatMessage(c.contentAnswersTitle)
103
- }), !d && C && /* @__PURE__ */ e(ne, {
104
- onSelectAgent: R,
105
- recordAction: a
106
- }), d && /* @__PURE__ */ e(Y, {
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 ? re.ERROR : void 0,
99
+ requestState: F ? ee.ERROR : void 0,
112
100
  shouldHideAgentSelectorOnLoad: !0,
113
101
  triggerChipClassName: t.agentSelectorTrigger
114
102
  })]
115
103
  })
116
- }), I && /* @__PURE__ */ e(K, {
117
- content: n.formatMessage(c.clearConversationLabel),
118
- "data-testid": "clear-conversation-tooltip",
119
- side: "top",
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: h === "collapsible" ? J : void 0,
109
+ icon: N === "collapsible" ? K : void 0,
133
110
  size: "small"
134
- }), /* @__PURE__ */ e(ee, {
111
+ }), /* @__PURE__ */ e(Y, {
135
112
  className: t.boxAiContentAnswers,
136
- hasCustomSuggestedQuestions: S,
137
- isAgentSelectorEnabled: !d && C,
138
- isAIStudioAgentSelectorEnabled: d,
139
- isDebugModeEnabled: O,
140
- isStopResponseEnabled: L,
141
- recordAction: a,
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 E ? /* @__PURE__ */ e(Z, {
147
- children: /* @__PURE__ */ e(te, {
148
- children: w
123
+ return S ? /* @__PURE__ */ e(V, {
124
+ children: /* @__PURE__ */ e(Z, {
125
+ children: R
149
126
  })
150
- }) : w;
127
+ }) : R;
151
128
  };
152
129
  export {
153
- He as IntelligenceModal,
154
- He as default
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.74.2",
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.0",
17
+ "@box/blueprint-web": "^9.5.1",
18
18
  "@box/blueprint-web-assets": "^4.31.0",
19
- "@box/box-ai-agent-selector": "^0.18.2",
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": "b2faf0831bb50c94a2fad4178d7e8b580c5a6c6e"
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;