@box/box-ai-content-answers 0.127.1 → 0.128.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.
@@ -1,15 +1,19 @@
1
- const E = "modal", s = "answers", O = "programmatic", _ = "click", c = "keypress", o = {
2
- action: O,
1
+ const E = "modal", s = "answers", _ = "programmatic", o = "click", t = "keypress", c = {
2
+ action: _,
3
3
  component: E,
4
4
  feature: s
5
- }, t = ["xls", "xlsx", "csv", "tsv"], G = ["xls", "xlsx", "xlsm", "xlsb", "csv", "ods", "gsheet"];
5
+ }, I = "data_ready", n = "component_initialized", O = "js_ready", T = ["xls", "xlsx", "csv", "tsv"], A = ["xls", "xlsx", "xlsm", "xlsb", "csv", "ods", "gsheet"], N = "boxai_sidebar";
6
6
  export {
7
- t as INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS,
8
- _ as LOGGER_ACTION_CLICK,
9
- c as LOGGER_ACTION_KEYPRESS,
10
- O as LOGGER_ACTION_PROGRAMMATIC,
11
- o as LOGGER_BASE_CONFIG,
7
+ I as EVENT_DATA_READY,
8
+ n as EVENT_INITIALIZED,
9
+ O as EVENT_JS_READY,
10
+ T as INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS,
11
+ o as LOGGER_ACTION_CLICK,
12
+ t as LOGGER_ACTION_KEYPRESS,
13
+ _ as LOGGER_ACTION_PROGRAMMATIC,
14
+ c as LOGGER_BASE_CONFIG,
12
15
  E as LOGGER_COMPONENT,
13
16
  s as LOGGER_FEATURE,
14
- G as SPREADSHEET_FILE_EXTENSIONS
17
+ N as ORIGIN_BOXAI_SIDEBAR,
18
+ A as SPREADSHEET_FILE_EXTENSIONS
15
19
  };
@@ -0,0 +1,6 @@
1
+ import r from "lodash/get";
2
+ const e = typeof r(window, "performance.mark") == "function", p = (o) => e && window.performance.mark(o);
3
+ export {
4
+ e as isMarkSupported,
5
+ p as mark
6
+ };
@@ -1,58 +1,62 @@
1
- import { Text as X, Tooltip as Y, IconButton as Z } from "@box/blueprint-web";
1
+ import { Text as K, Tooltip as X, IconButton as Z } from "@box/blueprint-web";
2
2
  import { ArrowsExpand as ee } from "@box/blueprint-web-assets/icons/Fill";
3
3
  import { useAgents as te, BoxAiAgentSelectorWithApi as ne } from "@box/box-ai-agent-selector";
4
- import Q from "clsx";
5
- import y from "lodash/isEqual";
4
+ import H from "clsx";
5
+ import $ from "lodash/isEqual";
6
6
  import * as u from "react";
7
7
  import { useIntl as oe } from "react-intl";
8
8
  import { BoxAiContentAnswers as se } from "../../box-ai-content-answers.js";
9
9
  import { withApiWrapper as ae } from "../api-wrapper/api-wrapper.js";
10
- import { C as ie } from "../../../../chunks/clear-conversation-button.js";
11
- import { IntelligenceModal as re } from "../modal/modal.js";
12
- import { IntelligenceSidebarContext as ce } from "./context.js";
10
+ import { ORIGIN_BOXAI_SIDEBAR as ie, EVENT_JS_READY as re } from "../common/constants.js";
11
+ import { mark as ce } from "../common/performance.js";
12
+ import { C as de } from "../../../../chunks/clear-conversation-button.js";
13
+ import { IntelligenceModal as le } from "../modal/modal.js";
14
+ import { IntelligenceSidebarContext as be } from "./context.js";
13
15
  import C from "./messages.js";
14
- import de from "./title.js";
15
- import { jsxs as p, Fragment as H, jsx as e } from "react/jsx-runtime";
16
- import '../../../../styles/content.css';const le = "_bcsSidebarBase_gfv6u_2", be = "_bcsContent_gfv6u_2", Se = "_bcsBoxAISidebar_gfv6u_2", ue = "_bcsContentHeader_gfv6u_6", pe = "_bcsTitle_gfv6u_15", ge = "_bcsScrollContent_gfv6u_22", he = "_withModalOpen_gfv6u_32", Ae = "_bcsBoxAISidebarAgentSelector_gfv6u_35", fe = "_bcsBoxAISidebarAgentSelectorContainer_gfv6u_39", me = "_bcsBoxAISidebarChatActions_gfv6u_43", Ie = "_bcsBoxAISidebarContent_gfv6u_47", _e = "_bcsBoxAISidebarExpand_gfv6u_50", xe = "_bcsBoxAISidebarTitlePart_gfv6u_53", Ce = "_sidebarChip_gfv6u_77", Be = "_bcsContentSubheader_gfv6u_90", ve = "_bcsScrollContentWrapper_gfv6u_99", we = "_withSubheader_gfv6u_104", Te = "_expanded_gfv6u_107", t = {
17
- bcsSidebarBase: le,
18
- bcsContent: be,
19
- bcsBoxAISidebar: Se,
20
- bcsContentHeader: ue,
21
- bcsTitle: pe,
22
- bcsScrollContent: ge,
23
- withModalOpen: he,
24
- bcsBoxAISidebarAgentSelector: Ae,
25
- bcsBoxAISidebarAgentSelectorContainer: fe,
26
- bcsBoxAISidebarChatActions: me,
27
- bcsBoxAISidebarContent: Ie,
28
- bcsBoxAISidebarExpand: _e,
29
- bcsBoxAISidebarTitlePart: xe,
30
- sidebarChip: Ce,
31
- bcsContentSubheader: Be,
32
- bcsScrollContentWrapper: ve,
33
- withSubheader: we,
34
- expanded: Te
35
- }, Ee = ({
16
+ import Se from "./title.js";
17
+ import { jsxs as p, Fragment as y, jsx as e } from "react/jsx-runtime";
18
+ import '../../../../styles/content.css';const ue = "_bcsSidebarBase_gfv6u_2", pe = "_bcsContent_gfv6u_2", Ae = "_bcsBoxAISidebar_gfv6u_2", ge = "_bcsContentHeader_gfv6u_6", he = "_bcsTitle_gfv6u_15", me = "_bcsScrollContent_gfv6u_22", fe = "_withModalOpen_gfv6u_32", _e = "_bcsBoxAISidebarAgentSelector_gfv6u_35", Ie = "_bcsBoxAISidebarAgentSelectorContainer_gfv6u_39", xe = "_bcsBoxAISidebarChatActions_gfv6u_43", Ce = "_bcsBoxAISidebarContent_gfv6u_47", Be = "_bcsBoxAISidebarExpand_gfv6u_50", ve = "_bcsBoxAISidebarTitlePart_gfv6u_53", we = "_sidebarChip_gfv6u_77", Te = "_bcsContentSubheader_gfv6u_90", Ee = "_bcsScrollContentWrapper_gfv6u_99", Ne = "_withSubheader_gfv6u_104", Pe = "_expanded_gfv6u_107", t = {
19
+ bcsSidebarBase: ue,
20
+ bcsContent: pe,
21
+ bcsBoxAISidebar: Ae,
22
+ bcsContentHeader: ge,
23
+ bcsTitle: he,
24
+ bcsScrollContent: me,
25
+ withModalOpen: fe,
26
+ bcsBoxAISidebarAgentSelector: _e,
27
+ bcsBoxAISidebarAgentSelectorContainer: Ie,
28
+ bcsBoxAISidebarChatActions: xe,
29
+ bcsBoxAISidebarContent: Ce,
30
+ bcsBoxAISidebarExpand: Be,
31
+ bcsBoxAISidebarTitlePart: ve,
32
+ sidebarChip: we,
33
+ bcsContentSubheader: Te,
34
+ bcsScrollContentWrapper: Ee,
35
+ withSubheader: Ne,
36
+ expanded: Pe
37
+ }, Me = `${ie}_${re}`;
38
+ ce(Me);
39
+ const Le = ({
36
40
  actions: B,
37
41
  children: i,
38
42
  className: n,
39
43
  elementId: d = "",
40
- sidebarView: g = "",
44
+ sidebarView: A = "",
41
45
  title: l,
42
46
  subheader: r,
43
47
  ...c
44
48
  }) => {
45
- const b = `${d}${d === "" ? "" : "_"}${g}`, h = `${b}-content`;
49
+ const b = `${d}${d === "" ? "" : "_"}${A}`, g = `${b}-content`;
46
50
  return /* @__PURE__ */ p("div", {
47
51
  "aria-labelledby": b,
48
- className: Q(t.bcsContent, n),
52
+ className: H(t.bcsContent, n),
49
53
  "data-testid": "bcs-content",
50
- id: h,
54
+ id: g,
51
55
  role: "tabpanel",
52
56
  ...c,
53
57
  children: [/* @__PURE__ */ p("div", {
54
58
  className: t.bcsContentHeader,
55
- children: [l && /* @__PURE__ */ e(X, {
59
+ children: [l && /* @__PURE__ */ e(K, {
56
60
  as: "h3",
57
61
  className: t.bcsTitle,
58
62
  children: l
@@ -69,60 +73,60 @@ import '../../../../styles/content.css';const le = "_bcsSidebarBase_gfv6u_2", be
69
73
  })]
70
74
  });
71
75
  };
72
- function Pe(B) {
76
+ function Oe(B) {
73
77
  const {
74
78
  createSession: i,
75
79
  encodedSession: n,
76
80
  onClearAction: d,
77
- getAIStudioAgents: g,
81
+ getAIStudioAgents: A,
78
82
  hasRequestInProgress: l,
79
83
  hostAppName: r,
80
84
  isAIStudioAgentSelectorEnabled: c,
81
85
  isLoading: b,
82
- isResetChatEnabled: h,
83
- onSelectAgent: P,
84
- questions: A,
85
- shouldShowLandingPage: N = !0,
86
- sendQuestion: f,
86
+ isResetChatEnabled: g,
87
+ onSelectAgent: N,
88
+ questions: h,
89
+ shouldShowLandingPage: P = !0,
90
+ sendQuestion: m,
87
91
  stopQuestion: v,
88
- ...L
92
+ ...M
89
93
  } = B, {
90
- formatMessage: m
91
- } = oe(), M = u.useRef(!1), [w, O] = u.useState(!1), {
94
+ formatMessage: f
95
+ } = oe(), L = u.useRef(!1), [w, O] = u.useState(!1), {
92
96
  cache: s,
93
- contentName: q,
97
+ contentName: R,
94
98
  elementId: V,
95
- fileExtension: $,
96
- isFeedbackEnabled: U,
97
- isFeedbackFormEnabled: W,
98
- isStopResponseEnabled: k,
99
+ fileExtension: Q,
100
+ isFeedbackEnabled: k,
101
+ isFeedbackFormEnabled: q,
102
+ isStopResponseEnabled: U,
99
103
  items: T,
100
- itemSize: j,
101
- onFeedbackFormSubmit: F,
102
- onUserInteraction: R,
104
+ itemSize: D,
105
+ onFeedbackFormSubmit: W,
106
+ onUserInteraction: F,
103
107
  recordAction: S,
104
- setCacheValue: I,
105
- shouldPreinitSession: _
106
- } = u.useContext(ce), {
107
- agents: z,
108
- requestState: D,
108
+ setCacheValue: _,
109
+ shouldPreinitSession: I
110
+ } = u.useContext(be), {
111
+ agents: j,
112
+ requestState: z,
109
113
  selectedAgent: E
110
114
  } = te(), {
111
115
  questions: a
112
116
  } = s;
113
- s.shouldShowLandingPage !== N && I("shouldShowLandingPage", N), s.encodedSession !== n && I("encodedSession", n), y(s.questions, A) || I("questions", A), y(s.agents.selectedAgent, E) || I("agents", {
114
- agents: z,
115
- requestState: D,
117
+ s.shouldShowLandingPage !== P && _("shouldShowLandingPage", P), s.encodedSession !== n && _("encodedSession", n), $(s.questions, h) || _("questions", h), $(s.agents.selectedAgent, E) || _("agents", {
118
+ agents: j,
119
+ requestState: z,
116
120
  selectedAgent: E
117
121
  });
118
122
  const x = (o = !1) => {
119
- !_ && !n && !b && i && i(!0, !1), o && R && R();
120
- }, G = () => {
121
- O(!1);
123
+ !I && !n && !b && i && i(!0, !1), o && F && F();
122
124
  }, J = () => {
125
+ O(!1);
126
+ }, Y = () => {
123
127
  x(), O(!0);
124
128
  };
125
- u.useEffect(() => (_ && !n && i && i(!0, !0), n && a.length > 0 && a[a.length - 1].isCompleted === !1 && f({
129
+ u.useEffect(() => (I && !n && i && i(!0, !0), n && a.length > 0 && a[a.length - 1].isCompleted === !1 && m({
126
130
  prompt: a[a.length - 1].prompt
127
131
  }), S && S({
128
132
  action: "programmatic",
@@ -139,46 +143,46 @@ function Pe(B) {
139
143
  v();
140
144
  }), []), u.useEffect(() => {
141
145
  const o = a[a.length - 1];
142
- !_ && !M.current && n && (o != null && o.isLoading) && (f(o, E, !1), M.current = !0);
146
+ !I && !L.current && n && (o != null && o.isLoading) && (m(o, E, !1), L.current = !0);
143
147
  }, [n]);
144
- const K = () => /* @__PURE__ */ p("div", {
148
+ const G = () => /* @__PURE__ */ p("div", {
145
149
  className: t.bcsBoxAISidebarTitlePart,
146
- children: [/* @__PURE__ */ e(de, {
150
+ children: [/* @__PURE__ */ e(Se, {
147
151
  isAIStudioAgentSelectorEnabled: c
148
152
  }), c && /* @__PURE__ */ e("div", {
149
153
  className: t.bcsBoxAISidebarAgentSelector,
150
154
  children: /* @__PURE__ */ e(ne, {
151
155
  disabled: l,
152
- fetcher: g,
156
+ fetcher: A,
153
157
  hostAppName: r,
154
158
  onAgentsListOpen: x,
155
- onSelectAgent: P,
159
+ onSelectAgent: N,
156
160
  recordAction: S,
157
161
  shouldHideAgentSelectorOnLoad: !0,
158
162
  variant: "sidebar"
159
163
  })
160
164
  })]
161
165
  });
162
- return /* @__PURE__ */ p(H, {
163
- children: [/* @__PURE__ */ e(Ee, {
164
- actions: /* @__PURE__ */ p(H, {
165
- children: [K(), h && /* @__PURE__ */ e(ie, {
166
+ return /* @__PURE__ */ p(y, {
167
+ children: [/* @__PURE__ */ e(Le, {
168
+ actions: /* @__PURE__ */ p(y, {
169
+ children: [G(), g && /* @__PURE__ */ e(de, {
166
170
  onClick: d
167
- }), /* @__PURE__ */ e(Y, {
168
- content: m(C.sidebarBoxAISwitchToModalView),
171
+ }), /* @__PURE__ */ e(X, {
172
+ content: f(C.sidebarBoxAISwitchToModalView),
169
173
  "data-testid": "content-answers-open-modal-tooltip",
170
174
  variant: "standard",
171
175
  children: /* @__PURE__ */ e(Z, {
172
- "aria-label": m(C.sidebarBoxAISwitchToModalView),
176
+ "aria-label": f(C.sidebarBoxAISwitchToModalView),
173
177
  className: t.bcsBoxAISidebarExpand,
174
178
  "data-target-id": "IconButton-expandBoxAISidebar",
175
179
  icon: ee,
176
- onClick: J,
180
+ onClick: Y,
177
181
  size: "small"
178
182
  })
179
183
  })]
180
184
  }),
181
- className: Q(t.bcsBoxAISidebar, {
185
+ className: H(t.bcsBoxAISidebar, {
182
186
  [t.withModalOpen]: w
183
187
  }),
184
188
  elementId: V,
@@ -187,60 +191,60 @@ function Pe(B) {
187
191
  className: t.bcsBoxAISidebarContent,
188
192
  children: /* @__PURE__ */ e(se, {
189
193
  className: t.bcsBoxAISidebarContentAnswers,
190
- contentName: q,
191
- contentType: m(C.sidebarBoxAIContent),
194
+ contentName: R,
195
+ contentType: f(C.sidebarBoxAIContent),
192
196
  hostAppName: r,
193
197
  isAIStudioAgentSelectorEnabled: c,
194
- isFeedbackEnabled: U,
195
- isFeedbackFormEnabled: W,
196
- isStopResponseEnabled: k,
198
+ isFeedbackEnabled: k,
199
+ isFeedbackFormEnabled: q,
200
+ isStopResponseEnabled: U,
197
201
  items: T,
198
- onFeedbackFormSubmit: F,
202
+ onFeedbackFormSubmit: W,
199
203
  onUserIntentToUseAI: x,
200
- questions: A,
204
+ questions: h,
201
205
  recordAction: S,
202
206
  shouldShowLandingPage: s.shouldShowLandingPage,
203
- showLoadingIndicator: b && _,
207
+ showLoadingIndicator: b && I,
204
208
  stopQuestion: v,
205
- submitQuestion: f,
209
+ submitQuestion: m,
206
210
  variant: "sidebar",
207
- ...L
211
+ ...M
208
212
  })
209
213
  })
210
- }), /* @__PURE__ */ e(re, {
211
- contentName: q,
212
- contentType: m(C.sidebarBoxAIContent),
213
- extension: $,
214
- getAIStudioAgents: g,
214
+ }), /* @__PURE__ */ e(le, {
215
+ contentName: R,
216
+ contentType: f(C.sidebarBoxAIContent),
217
+ extension: Q,
218
+ getAIStudioAgents: A,
215
219
  hasRequestInProgress: l,
216
220
  hostAppName: r,
217
221
  isAIStudioAgentSelectorEnabled: c,
218
- isFeedbackEnabled: U,
219
- isFeedbackFormEnabled: W,
220
- isResetChatEnabled: h,
221
- isStopResponseEnabled: k,
222
+ isFeedbackEnabled: k,
223
+ isFeedbackFormEnabled: q,
224
+ isResetChatEnabled: g,
225
+ isStopResponseEnabled: U,
222
226
  items: T,
223
- itemSize: j,
227
+ itemSize: D,
224
228
  onClearAction: d,
225
- onFeedbackFormSubmit: F,
226
- onOpenChange: G,
227
- onSelectAgent: P,
229
+ onFeedbackFormSubmit: W,
230
+ onOpenChange: J,
231
+ onSelectAgent: N,
228
232
  onUserIntentToUseAI: x,
229
233
  open: w,
230
- questions: A,
234
+ questions: h,
231
235
  recordAction: w ? S : void 0,
232
236
  shouldShowLandingPage: s.shouldShowLandingPage,
233
237
  showLoadingIndicator: !1,
234
238
  stopPropagationOnEsc: !0,
235
239
  stopQuestion: v,
236
- submitQuestion: f,
240
+ submitQuestion: m,
237
241
  variant: "collapsible",
238
- ...L,
242
+ ...M,
239
243
  shouldRenderProviders: !1
240
244
  })]
241
245
  });
242
246
  }
243
- const je = ae(Pe);
247
+ const Ke = ae(Oe);
244
248
  export {
245
- je as default
249
+ Ke as default
246
250
  };
@@ -5,5 +5,9 @@ export declare const LOGGER_ACTION_PROGRAMMATIC = "programmatic";
5
5
  export declare const LOGGER_ACTION_CLICK = "click";
6
6
  export declare const LOGGER_ACTION_KEYPRESS = "keypress";
7
7
  export declare const LOGGER_BASE_CONFIG: RecordActionType;
8
+ export declare const EVENT_DATA_READY = "data_ready";
9
+ export declare const EVENT_INITIALIZED = "component_initialized";
10
+ export declare const EVENT_JS_READY = "js_ready";
8
11
  export declare const INTELLIGENT_QUERY_COMPATIBLE_SPREADSHEET_EXTENSIONS: string[];
9
12
  export declare const SPREADSHEET_FILE_EXTENSIONS: string[];
13
+ export declare const ORIGIN_BOXAI_SIDEBAR = "boxai_sidebar";
@@ -0,0 +1,3 @@
1
+ declare const isMarkSupported: boolean;
2
+ declare const mark: (markName: string) => PerformanceMark;
3
+ export { isMarkSupported, mark };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.127.1",
3
+ "version": "0.128.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.35.0",