@box/box-ai-content-answers 0.126.1 → 0.126.3
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,26 +1,26 @@
|
|
|
1
|
-
import { useBreakpoint as
|
|
2
|
-
import { ArrowsCollapse as
|
|
3
|
-
import { BoxAiLogo as
|
|
1
|
+
import { useBreakpoint as X, Breakpoint as Y, Modal as c, TooltipProvider as Z, Tooltip as $ } from "@box/blueprint-web";
|
|
2
|
+
import { ArrowsCollapse as ee } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { BoxAiLogo as oe } from "@box/blueprint-web-assets/icons/Logo";
|
|
4
4
|
import { Size8 as w } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import { BoxAiAgentSelectorWithApi as
|
|
6
|
-
import { useState as
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import { BoxAiContentAnswers as
|
|
9
|
-
import { A as
|
|
10
|
-
import { LOGGER_BASE_CONFIG as C, LOGGER_ACTION_CLICK as
|
|
11
|
-
import { s, C as
|
|
12
|
-
import
|
|
13
|
-
import { Title as
|
|
5
|
+
import { BoxAiAgentSelectorWithApi as te, AgentsProvider as se } from "@box/box-ai-agent-selector";
|
|
6
|
+
import { useState as ae, useMemo as le, useCallback as S, useEffect as u } from "react";
|
|
7
|
+
import { useIntl as re } from "react-intl";
|
|
8
|
+
import { BoxAiContentAnswers as ne } from "../../box-ai-content-answers.js";
|
|
9
|
+
import { A as ie, R as de } from "../../../../chunks/types.js";
|
|
10
|
+
import { LOGGER_BASE_CONFIG as C, LOGGER_ACTION_CLICK as ce } from "../common/constants.js";
|
|
11
|
+
import { s, C as me } from "../../../../chunks/clear-conversation-button.js";
|
|
12
|
+
import fe from "./hooks/useStopPropagationOnEsc.js";
|
|
13
|
+
import { Title as ge } from "./title.js";
|
|
14
14
|
import x from "./messages.js";
|
|
15
15
|
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
16
|
-
const
|
|
16
|
+
const ue = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-closeContentAnswersModal", Ce = (o) => o ? x.collapseModalAriaLabel : x.closeModalAriaLabel, pe = (o) => o ? ee : void 0, Me = (o) => {
|
|
17
17
|
const a = o === "collapsible";
|
|
18
18
|
return {
|
|
19
|
-
closeModalLabel:
|
|
20
|
-
closeModalTargetId:
|
|
21
|
-
closeModalIcon:
|
|
19
|
+
closeModalLabel: Ce(a),
|
|
20
|
+
closeModalTargetId: ue(a),
|
|
21
|
+
closeModalIcon: pe(a)
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, ke = ({
|
|
24
24
|
children: o,
|
|
25
25
|
getAIStudioAgents: a,
|
|
26
26
|
hasCustomSuggestedQuestions: B,
|
|
@@ -33,29 +33,30 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
33
33
|
extension: h,
|
|
34
34
|
onClearAction: T,
|
|
35
35
|
onSelectAgent: G,
|
|
36
|
+
onSelectedAgentCallback: P,
|
|
36
37
|
recordAction: l,
|
|
37
|
-
shouldRenderProviders:
|
|
38
|
-
shouldShowLandingPage:
|
|
39
|
-
stopPropagationOnEsc:
|
|
38
|
+
shouldRenderProviders: q = !0,
|
|
39
|
+
shouldShowLandingPage: H = !1,
|
|
40
|
+
stopPropagationOnEsc: z,
|
|
40
41
|
variant: b = "closable",
|
|
41
42
|
items: i,
|
|
42
43
|
parentItem: d,
|
|
43
|
-
...
|
|
44
|
+
...F
|
|
44
45
|
}) => {
|
|
45
46
|
var E, v;
|
|
46
47
|
const {
|
|
47
48
|
open: A,
|
|
48
|
-
defaultOpen:
|
|
49
|
-
onOpenChange:
|
|
50
|
-
modal:
|
|
49
|
+
defaultOpen: j,
|
|
50
|
+
onOpenChange: D,
|
|
51
|
+
modal: Q,
|
|
51
52
|
...r
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
const g = (v = (E = r == null ? void 0 : r.questions) == null ? void 0 : E[r.questions.length - 1]) == null ? void 0 : v.error, [
|
|
53
|
+
} = F, L = re(), U = X() <= Y.Medium;
|
|
54
|
+
fe(z, A);
|
|
55
|
+
const g = (v = (E = r == null ? void 0 : r.questions) == null ? void 0 : E[r.questions.length - 1]) == null ? void 0 : v.error, [W, O] = ae(!1), {
|
|
55
56
|
closeModalLabel: N,
|
|
56
|
-
closeModalTargetId:
|
|
57
|
-
closeModalIcon:
|
|
58
|
-
} =
|
|
57
|
+
closeModalTargetId: y,
|
|
58
|
+
closeModalIcon: K
|
|
59
|
+
} = le(() => Me(b), [b]), n = S((t) => {
|
|
59
60
|
l && (t.data ?? (t.data = {}), t.data.hostAppName = m, l(t));
|
|
60
61
|
}, [m, l]);
|
|
61
62
|
u(() => {
|
|
@@ -80,18 +81,18 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
80
81
|
}
|
|
81
82
|
});
|
|
82
83
|
}, [n, d, l]), u(() => {
|
|
83
|
-
g && g ===
|
|
84
|
+
g && g === ie.AGENT_NOT_FOUND && O(!0);
|
|
84
85
|
}, [g]);
|
|
85
|
-
const
|
|
86
|
+
const J = () => {
|
|
86
87
|
T && (T(), n({
|
|
87
88
|
...C,
|
|
88
|
-
action:
|
|
89
|
+
action: ce,
|
|
89
90
|
target: "clearChat"
|
|
90
91
|
}));
|
|
91
|
-
},
|
|
92
|
-
defaultOpen:
|
|
93
|
-
modal:
|
|
94
|
-
onOpenChange:
|
|
92
|
+
}, V = S(async () => (O(!1), a()), [a]), R = /* @__PURE__ */ p(c, {
|
|
93
|
+
defaultOpen: j,
|
|
94
|
+
modal: Q,
|
|
95
|
+
onOpenChange: D,
|
|
95
96
|
open: A,
|
|
96
97
|
children: [/* @__PURE__ */ e(c.Trigger, {
|
|
97
98
|
children: o
|
|
@@ -103,26 +104,27 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
103
104
|
className: s.modalHeaderContainer,
|
|
104
105
|
children: /* @__PURE__ */ p("div", {
|
|
105
106
|
className: s.modalHeader,
|
|
106
|
-
children: [!
|
|
107
|
+
children: [!U && /* @__PURE__ */ e(oe, {
|
|
107
108
|
className: s.BoxAIIconColor,
|
|
108
109
|
"data-testid": "content-answers-icon-color",
|
|
109
110
|
height: w,
|
|
110
111
|
width: w
|
|
111
|
-
}), /* @__PURE__ */ e(
|
|
112
|
+
}), /* @__PURE__ */ e(ge, {
|
|
112
113
|
isAIStudioAgentSelectorEnabled: f
|
|
113
|
-
}), f && /* @__PURE__ */ e(
|
|
114
|
+
}), f && /* @__PURE__ */ e(te, {
|
|
114
115
|
contentClassName: s.agentSelectorContent,
|
|
115
116
|
disabled: r.hasRequestInProgress,
|
|
116
|
-
fetcher:
|
|
117
|
+
fetcher: V,
|
|
117
118
|
hostAppName: m,
|
|
118
119
|
onSelectAgent: G,
|
|
120
|
+
onSelectedAgentCallback: P,
|
|
119
121
|
recordAction: l,
|
|
120
|
-
requestState:
|
|
122
|
+
requestState: W ? de.ERROR : void 0,
|
|
121
123
|
shouldHideAgentSelectorOnLoad: !0,
|
|
122
124
|
triggerChipClassName: s.agentSelectorTrigger
|
|
123
125
|
})]
|
|
124
126
|
})
|
|
125
|
-
}), /* @__PURE__ */ e(
|
|
127
|
+
}), /* @__PURE__ */ e(ne, {
|
|
126
128
|
className: s.boxAiContentAnswers,
|
|
127
129
|
hasCustomSuggestedQuestions: B,
|
|
128
130
|
hostAppName: m,
|
|
@@ -132,30 +134,30 @@ const ge = (o) => o ? "Modal.Close-collapseContentAnswersModal" : "Modal.Close-c
|
|
|
132
134
|
items: i,
|
|
133
135
|
parentItem: d,
|
|
134
136
|
recordAction: n,
|
|
135
|
-
shouldShowLandingPage:
|
|
137
|
+
shouldShowLandingPage: H,
|
|
136
138
|
...r
|
|
137
|
-
}), _ && /* @__PURE__ */ e(
|
|
138
|
-
onClick:
|
|
139
|
-
}), /* @__PURE__ */ e(
|
|
140
|
-
children: /* @__PURE__ */ e(
|
|
139
|
+
}), _ && /* @__PURE__ */ e(me, {
|
|
140
|
+
onClick: J
|
|
141
|
+
}), /* @__PURE__ */ e(Z, {
|
|
142
|
+
children: /* @__PURE__ */ e($, {
|
|
141
143
|
content: L.formatMessage(N),
|
|
142
144
|
"data-testid": "content-answers-close-modal-tooltip",
|
|
143
145
|
children: /* @__PURE__ */ e(c.Close, {
|
|
144
146
|
"aria-label": L.formatMessage(N),
|
|
145
147
|
className: s["modal-close-button"],
|
|
146
|
-
"data-target-id":
|
|
147
|
-
icon:
|
|
148
|
+
"data-target-id": y,
|
|
149
|
+
icon: K,
|
|
148
150
|
size: "small"
|
|
149
151
|
})
|
|
150
152
|
})
|
|
151
153
|
})]
|
|
152
154
|
})]
|
|
153
155
|
});
|
|
154
|
-
return
|
|
156
|
+
return q ? /* @__PURE__ */ e(se, {
|
|
155
157
|
children: R
|
|
156
158
|
}) : R;
|
|
157
159
|
};
|
|
158
160
|
export {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
ke as IntelligenceModal,
|
|
162
|
+
ke as default
|
|
161
163
|
};
|
|
@@ -113,6 +113,7 @@ export type ApiWrapperWithInjectedProps = ApiWrapperProps & {
|
|
|
113
113
|
onAgentEditorToggle: (agent: AgentType) => void;
|
|
114
114
|
onClearAction: () => void;
|
|
115
115
|
onSelectAgent: (agent: AgentType) => void;
|
|
116
|
+
onSelectedAgentCallback: (selectedAgent: AgentType) => void;
|
|
116
117
|
/**
|
|
117
118
|
* @deprecated Prefer passing chatMessages instead since this prop will be deprecated soon
|
|
118
119
|
*/
|
|
@@ -33,6 +33,8 @@ export type IntelligenceModalProps = ModalProps & Omit<BoxAiContentAnswersProps,
|
|
|
33
33
|
onClearAction?: () => void;
|
|
34
34
|
/** Callback function when an agent is selected */
|
|
35
35
|
onSelectAgent?: (agent: AgentType) => void;
|
|
36
|
+
/** Callback function when an agent is selected; does not get overridden */
|
|
37
|
+
onSelectedAgentCallback?: (agent: AgentType) => void;
|
|
36
38
|
/** Determines the modal variant */
|
|
37
39
|
variant?: 'closable' | 'collapsible';
|
|
38
40
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.126.
|
|
3
|
+
"version": "0.126.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.35.0",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.7.
|
|
20
|
+
"@box/blueprint-web": "^12.7.1",
|
|
21
21
|
"@box/blueprint-web-assets": "^4.48.0",
|
|
22
|
-
"@box/box-ai-agent-selector": "^0.41.
|
|
23
|
-
"@box/item-icon": "^0.9.
|
|
22
|
+
"@box/box-ai-agent-selector": "^0.41.16",
|
|
23
|
+
"@box/item-icon": "^0.9.151",
|
|
24
24
|
"@box/storybook-utils": "^0.13.1",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|