@box/box-ai-content-answers 0.69.0 → 0.69.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,109 +1,110 @@
1
- import { useReducer as J, useEffect as K } from "react";
2
- import { R as a } from "../../../../chunks/types.js";
3
- import { useContentAnswers as M } from "./hooks/useContentAnswers.js";
4
- import { ContentAnswersRecord as V, ContentAnswersItemRecord as W } from "./records.js";
5
- import X from "./reducer.js";
6
- import { jsx as Y } from "react/jsx-runtime";
1
+ import { useReducer as M, useEffect as V } from "react";
2
+ import { R as d } from "../../../../chunks/types.js";
3
+ import { useContentAnswers as W } from "./hooks/useContentAnswers.js";
4
+ import { ContentAnswersRecord as X, ContentAnswersItemRecord as Y } from "./records.js";
5
+ import Z from "./reducer.js";
6
+ import { jsx as $ } from "react/jsx-runtime";
7
7
  const re = ({
8
- WrappedComponent: d,
9
- createSessionRequest: f,
10
- getAgentConfig: m,
11
- getAIStudioAgents: S,
12
- fetchTimeout: g,
13
- formatCitations: A,
14
- getAnswer: p,
15
- getAnswerStreaming: C,
8
+ WrappedComponent: f,
9
+ createSessionRequest: m,
10
+ getAgentConfig: S,
11
+ getAIStudioAgents: g,
12
+ fetchTimeout: A,
13
+ formatCitations: p,
14
+ getAnswer: C,
15
+ getAnswerStreaming: R,
16
16
  getSuggestedQuestions: e,
17
- hostAppName: R,
18
- isAgentSelectorEnabled: w,
19
- isAIStudioAgentSelectorEnabled: Q,
17
+ hostAppName: w,
18
+ isAgentSelectorEnabled: Q,
19
+ isAIStudioAgentSelectorEnabled: T,
20
20
  isCitationsEnabled: n,
21
- isDebugModeEnabled: T,
22
- isMarkdownEnabled: h,
21
+ isDebugModeEnabled: h,
22
+ isMarkdownEnabled: l,
23
23
  isOpen: s,
24
- isResetChatEnabled: l,
25
- isStopResponseEnabled: q,
24
+ isResetChatEnabled: q,
25
+ isStopResponseEnabled: E,
26
26
  isStreamingEnabled: r,
27
27
  itemID: o,
28
- itemIDs: E,
28
+ itemIDs: u,
29
29
  onCloseModal: j,
30
30
  shouldRenderProviders: U = !0,
31
31
  suggestedQuestions: _,
32
32
  warningNotice: v,
33
33
  warningNoticeAriaLabel: x
34
34
  }) => {
35
- const [u, y] = J(X, new V({
36
- item: new W({
35
+ const [c, y] = M(Z, new X({
36
+ item: new Y({
37
37
  id: o
38
38
  })
39
39
  })), {
40
40
  clearConversation: L,
41
41
  createSession: N,
42
- fetchAgentConfig: c,
43
- fetchSuggestedQuestions: i,
42
+ fetchAgentConfig: i,
43
+ fetchSuggestedQuestions: a,
44
44
  retryQuestion: O,
45
45
  sendQuestion: P,
46
46
  stopQuestion: b
47
- } = M({
48
- contentAnswers: u,
49
- createSessionRequest: f,
47
+ } = W({
48
+ contentAnswers: c,
49
+ createSessionRequest: m,
50
50
  dispatchStateUpdate: y,
51
- fetchTimeout: g,
52
- formatCitations: A,
53
- getAgentConfig: m,
54
- getAnswerStreaming: C,
55
- getAnswer: p,
51
+ fetchTimeout: A,
52
+ formatCitations: p,
53
+ getAgentConfig: S,
54
+ getAnswerStreaming: R,
55
+ getAnswer: C,
56
56
  getSuggestedQuestions: e,
57
57
  isCitationsEnabled: n,
58
- isStopResponseEnabled: q,
58
+ isStopResponseEnabled: E,
59
59
  isStreamingEnabled: r,
60
- itemID: o
60
+ itemID: o,
61
+ itemIDs: u
61
62
  }), {
62
63
  encodedSession: k,
63
64
  error: z,
64
65
  isLoading: B,
65
- hasRequestInProgress: D = !1,
66
- questions: F,
66
+ hasRequestInProgress: F = !1,
67
+ questions: G,
67
68
  suggestedQuestions: t
68
- } = u;
69
- K(() => {
70
- s && t.requestState === a.NOT_STARTED && i();
71
- }, [s, i, t.requestState]);
72
- const G = {
69
+ } = c;
70
+ V(() => {
71
+ s && t.requestState === d.NOT_STARTED && a();
72
+ }, [s, a, t.requestState]);
73
+ const H = {
73
74
  createSession: N,
74
75
  encodedSession: k,
75
76
  error: z,
76
- getAIStudioAgents: S,
77
- hostAppName: R,
77
+ getAIStudioAgents: g,
78
+ hostAppName: w,
78
79
  hasCustomSuggestedQuestions: !!e,
79
- hasRequestInProgress: D,
80
- isAgentSelectorEnabled: w,
81
- isAIStudioAgentSelectorEnabled: Q,
80
+ hasRequestInProgress: F,
81
+ isAgentSelectorEnabled: Q,
82
+ isAIStudioAgentSelectorEnabled: T,
82
83
  isCitationsEnabled: n,
83
- isDebugModeEnabled: T,
84
- isMarkdownEnabled: h,
84
+ isDebugModeEnabled: h,
85
+ isMarkdownEnabled: l,
85
86
  isLoading: B,
86
87
  isOpen: s,
87
- isResetChatEnabled: l,
88
+ isResetChatEnabled: q,
88
89
  isStreamingEnabled: r,
89
90
  itemID: o,
90
- itemIDs: E,
91
+ itemIDs: u,
91
92
  onClearAction: L,
92
93
  onCloseModal: j,
93
- onSelectAgent: c,
94
- onAgentEditorToggle: c,
95
- questions: F,
94
+ onSelectAgent: i,
95
+ onAgentEditorToggle: i,
96
+ questions: G,
96
97
  retryQuestion: O,
97
98
  sendQuestion: P,
98
99
  shouldRenderProviders: U,
99
100
  stopQuestion: b,
100
- suggestedQuestionsRequestState: e ? t.requestState : a.SUCCESS,
101
+ suggestedQuestionsRequestState: e ? t.requestState : d.SUCCESS,
101
102
  suggestedQuestions: e ? t.suggestions : _,
102
103
  warningNotice: v,
103
104
  warningNoticeAriaLabel: x
104
- }, H = Object.fromEntries(Object.entries(G).filter(([Z, I]) => I !== void 0));
105
- return /* @__PURE__ */ Y(d, {
106
- ...H
105
+ }, J = Object.fromEntries(Object.entries(H).filter(([D, K]) => K !== void 0));
106
+ return /* @__PURE__ */ $(f, {
107
+ ...J
107
108
  });
108
109
  };
109
110
  export {
@@ -1,114 +1,116 @@
1
1
  import "../../../../styles/content.css";
2
- import { LoadingIndicator as j } from "@box/blueprint-web";
3
- import k from "clsx";
2
+ import { LoadingIndicator as k } from "@box/blueprint-web";
3
+ import y from "clsx";
4
4
  import * as e from "react";
5
- import { useIntl as y } from "react-intl";
6
- import H from "../../messages.js";
7
- import { Chat as O } from "../chat/chat.js";
8
- import { ModalError as T } from "../modal-error/modal-error.js";
9
- import { jsx as t, jsxs as V, Fragment as B } from "react/jsx-runtime";
10
- const F = "_loadingIndicatorWrapper_19quq_1", S = "_content_19quq_5", A = "_isLoading_19quq_17", D = "_messagesEnd_19quq_21", c = {
11
- loadingIndicatorWrapper: F,
12
- content: S,
13
- isLoading: A,
14
- messagesEnd: D
15
- }, $ = ({
5
+ import { useIntl as H } from "react-intl";
6
+ import O from "../../messages.js";
7
+ import { Chat as T } from "../chat/chat.js";
8
+ import { ModalError as V } from "../modal-error/modal-error.js";
9
+ import { jsx as t, jsxs as B, Fragment as F } from "react/jsx-runtime";
10
+ const S = "_loadingIndicatorWrapper_b2shl_1", A = "_content_b2shl_5", D = "_isLoading_b2shl_17", G = "_messagesEnd_b2shl_21", J = "_innerContent_b2shl_25", s = {
11
+ loadingIndicatorWrapper: S,
12
+ content: A,
13
+ isLoading: D,
14
+ messagesEnd: G,
15
+ innerContent: J
16
+ }, P = ({
16
17
  error: p,
17
18
  hasCustomSuggestedQuestions: g,
18
19
  hasRequestInProgress: a = !1,
19
- isErrorMessageShown: _ = !1,
20
- isSidebarOpen: h = !1,
20
+ isErrorMessageShown: h = !1,
21
+ isSidebarOpen: _ = !1,
21
22
  isStreamingEnabled: l = !1,
22
- setIsErrorMessageShown: v,
23
- onModalClose: E,
24
- questions: R,
25
- recordAction: d,
23
+ setIsErrorMessageShown: b,
24
+ onModalClose: v,
25
+ questions: C,
26
+ recordAction: u,
26
27
  showLoadingIndicator: m = !1,
27
- userInfo: b,
28
- suggestedQuestions: q,
29
- askSuggestedQuestion: C,
30
- setAskSuggestedQuestion: I,
31
- useAnimation: L,
28
+ userInfo: E,
29
+ suggestedQuestions: R,
30
+ askSuggestedQuestion: I,
31
+ setAskSuggestedQuestion: L,
32
+ useAnimation: N,
32
33
  ...w
33
34
  }) => {
34
- const u = e.useRef(null), i = e.useRef(null), f = e.useRef(null), s = e.useRef(!0), {
35
+ const d = e.useRef(null), i = e.useRef(null), f = e.useRef(null), c = e.useRef(!0), {
35
36
  formatMessage: x
36
- } = y(), r = e.useCallback((n) => {
37
- f.current && f.current.scrollIntoView && i.current && (!l || s.current) && f.current.scrollIntoView({
38
- behavior: n,
37
+ } = H(), n = e.useCallback((r) => {
38
+ f.current && f.current.scrollIntoView && i.current && (!l || c.current) && f.current.scrollIntoView({
39
+ behavior: r,
39
40
  block: "nearest"
40
41
  });
41
- }, [l]), N = () => {
42
+ }, [l]), W = () => {
42
43
  if (i.current) {
43
44
  const {
44
- scrollTop: n,
45
+ scrollTop: r,
45
46
  clientHeight: o,
46
- scrollHeight: z
47
- } = i.current, M = z - (n + o);
48
- if (a && M > 100) {
49
- s.current = !1;
47
+ scrollHeight: M
48
+ } = i.current, j = M - (r + o);
49
+ if (a && j > 100) {
50
+ c.current = !1;
50
51
  return;
51
52
  }
52
- s.current = !0;
53
+ c.current = !0;
53
54
  }
54
55
  };
55
56
  e.useEffect(() => {
56
- a && (s.current = !0, r("instant"));
57
- }, [r, a]), e.useEffect(() => {
58
- s.current = !0, r("instant");
59
- }, [r]), e.useLayoutEffect(() => {
60
- if (!u.current)
57
+ a && (c.current = !0, n("instant"));
58
+ }, [n, a]), e.useEffect(() => {
59
+ c.current = !0, n("instant");
60
+ }, [n]), e.useLayoutEffect(() => {
61
+ if (!d.current)
61
62
  return;
62
- const n = new ResizeObserver(() => {
63
- r(l ? "instant" : "smooth");
64
- }), o = u.current;
65
- return o && n.observe(o), () => {
66
- o && n.unobserve(o);
63
+ const r = new ResizeObserver(() => {
64
+ n(l ? "instant" : "smooth");
65
+ }), o = d.current;
66
+ return o && r.observe(o), () => {
67
+ o && r.unobserve(o);
67
68
  };
68
- }, [r, l]);
69
- const W = () => _ ? /* @__PURE__ */ t(T, {
70
- clearError: () => v(!1),
69
+ }, [n, l]);
70
+ const z = () => h ? /* @__PURE__ */ t(V, {
71
+ clearError: () => b(!1),
71
72
  error: p,
72
- onModalClose: E,
73
- recordAction: d
73
+ onModalClose: v,
74
+ recordAction: u
74
75
  }) : m ? /* @__PURE__ */ t("div", {
75
- className: c.loadingIndicatorWrapper,
76
- children: /* @__PURE__ */ t(j, {
77
- "aria-label": x(H.loading),
78
- className: c.loadingIndicator,
76
+ className: s.loadingIndicatorWrapper,
77
+ children: /* @__PURE__ */ t(k, {
78
+ "aria-label": x(O.loading),
79
+ className: s.loadingIndicator,
79
80
  "data-testid": "content-answers-modal-loading-indicator",
80
81
  size: "large"
81
82
  })
82
- }) : /* @__PURE__ */ V(B, {
83
- children: [/* @__PURE__ */ t(O, {
84
- askSuggestedQuestion: C,
83
+ }) : /* @__PURE__ */ B(F, {
84
+ children: [/* @__PURE__ */ t(T, {
85
+ askSuggestedQuestion: I,
85
86
  hasCustomSuggestedQuestions: g,
86
87
  hasRequestInProgress: a,
87
- isSidebarOpen: h,
88
- questions: R,
89
- recordAction: d,
90
- setAskSuggestedQuestion: I,
91
- suggestedQuestions: q,
92
- useAnimation: L,
93
- userInfo: b,
88
+ isSidebarOpen: _,
89
+ questions: C,
90
+ recordAction: u,
91
+ setAskSuggestedQuestion: L,
92
+ suggestedQuestions: R,
93
+ useAnimation: N,
94
+ userInfo: E,
94
95
  ...w
95
96
  }), /* @__PURE__ */ t("div", {
96
97
  ref: f,
97
- className: c.messagesEnd
98
+ className: s.messagesEnd
98
99
  })]
99
100
  });
100
101
  return /* @__PURE__ */ t("div", {
101
102
  ref: i,
102
- className: k(c.content, m ? c.isLoading : null),
103
+ className: y(s.content, m ? s.isLoading : null),
103
104
  "data-testid": "content-answers-content",
104
- onScroll: N,
105
+ onScroll: W,
105
106
  children: /* @__PURE__ */ t("div", {
106
- ref: u,
107
- children: W()
107
+ ref: d,
108
+ className: s.innerContent,
109
+ children: z()
108
110
  })
109
111
  });
110
112
  };
111
113
  export {
112
- $ as Content,
113
- $ as default
114
+ P as Content,
115
+ P as default
114
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.69.0",
3
+ "version": "0.69.2",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.16.0",
@@ -54,5 +54,5 @@
54
54
  "**/*.css"
55
55
  ],
56
56
  "license": "SEE LICENSE IN LICENSE",
57
- "gitHead": "b4a64fc7d3792a0bcf1ab8f2e75b7f4a989a6d7a"
57
+ "gitHead": "00d4574fc4e1c707bbf03d25a588cc4642281efa"
58
58
  }
@@ -1 +1 @@
1
- ._loadingIndicatorWrapper_19quq_1{width:100%}._content_19quq_5{flex:1 1 auto;width:auto;max-height:35.375rem;padding:0 1.25rem 1.25rem;overflow:auto}@container box-ai-sidebar (max-width: 380px){._content_19quq_5{padding:0 1rem 1rem}}._content_19quq_5._isLoading_19quq_17{display:flex;align-items:center}._content_19quq_5 ._messagesEnd_19quq_21{margin-bottom:-1.25rem;padding-bottom:1.25rem}@media (max-width: 374px){._content_19quq_5{flex:1;max-height:unset;padding:1rem;overflow-x:hidden}._content_19quq_5 ._messagesEnd_19quq_21{margin-bottom:-1rem;padding-bottom:1rem}}
1
+ ._loadingIndicatorWrapper_b2shl_1{width:100%}._content_b2shl_5{flex:1 1 auto;width:auto;max-height:35.375rem;padding:0 1.25rem 1.25rem;overflow:auto}@container box-ai-sidebar (max-width: 380px){._content_b2shl_5{padding:0 1rem 1rem}}._content_b2shl_5._isLoading_b2shl_17{display:flex;align-items:center}._content_b2shl_5 ._messagesEnd_b2shl_21{margin-bottom:-1.25rem;padding-bottom:1.25rem}._content_b2shl_5 ._innerContent_b2shl_25{width:100%}@media (max-width: 374px){._content_b2shl_5{flex:1;max-height:unset;padding:1rem;overflow-x:hidden}._content_b2shl_5 ._messagesEnd_b2shl_21{margin-bottom:-1rem;padding-bottom:1rem}}