@box/box-ai-content-answers 0.82.1 → 0.83.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,10 +1,10 @@
1
- import { useReducer as Z, useEffect as $ } from "react";
1
+ import { useReducer as $, useEffect as D } from "react";
2
2
  import { R as a } from "../../../../chunks/types.js";
3
- import { useContentAnswers as D } from "./hooks/useContentAnswers.js";
4
- import { ContentAnswersRecord as I, ContentAnswersItemRecord as ee } from "./records.js";
5
- import te from "./reducer.js";
6
- import { jsx as se } from "react/jsx-runtime";
7
- const ae = ({
3
+ import { useContentAnswers as I } from "./hooks/useContentAnswers.js";
4
+ import { ContentAnswersRecord as ee, ContentAnswersItemRecord as te } from "./records.js";
5
+ import se from "./reducer.js";
6
+ import { jsx as oe } from "react/jsx-runtime";
7
+ const fe = ({
8
8
  WrappedComponent: f,
9
9
  createSessionRequest: m,
10
10
  getAgentConfig: S,
@@ -29,32 +29,33 @@ const ae = ({
29
29
  items: j,
30
30
  onCloseModal: U,
31
31
  onCitationClick: _,
32
- parentItem: v,
33
- restoredQuestions: x = [],
34
- restoredSession: y = null,
35
- shouldRenderProviders: L = !0,
36
- suggestedQuestions: N,
37
- warningNotice: O,
38
- warningNoticeAriaLabel: P
32
+ onItemClick: v,
33
+ parentItem: x,
34
+ restoredQuestions: y = [],
35
+ restoredSession: L = null,
36
+ shouldRenderProviders: N = !0,
37
+ suggestedQuestions: O,
38
+ warningNotice: P,
39
+ warningNoticeAriaLabel: b
39
40
  }) => {
40
- const [c, b] = Z(te, new I({
41
- item: new ee({
41
+ const [c, k] = $(se, new ee({
42
+ item: new te({
42
43
  id: o
43
44
  }),
44
- questions: x,
45
- encodedSession: y
45
+ questions: y,
46
+ encodedSession: L
46
47
  })), {
47
- clearConversation: k,
48
- createSession: z,
48
+ clearConversation: z,
49
+ createSession: B,
49
50
  fetchAgentConfig: i,
50
51
  fetchSuggestedQuestions: d,
51
- retryQuestion: B,
52
- sendQuestion: F,
53
- stopQuestion: G
54
- } = D({
52
+ retryQuestion: F,
53
+ sendQuestion: G,
54
+ stopQuestion: H
55
+ } = I({
55
56
  contentAnswers: c,
56
57
  createSessionRequest: m,
57
- dispatchStateUpdate: b,
58
+ dispatchStateUpdate: k,
58
59
  fetchTimeout: A,
59
60
  formatCitations: p,
60
61
  getAgentConfig: S,
@@ -67,57 +68,58 @@ const ae = ({
67
68
  itemID: o,
68
69
  itemIDs: u
69
70
  }), {
70
- encodedSession: H,
71
- error: J,
72
- isLoading: K,
73
- hasRequestInProgress: M = !1,
74
- questions: V,
71
+ encodedSession: J,
72
+ error: K,
73
+ isLoading: M,
74
+ hasRequestInProgress: V = !1,
75
+ questions: W,
75
76
  suggestedQuestions: t
76
77
  } = c;
77
- $(() => {
78
+ D(() => {
78
79
  s && t.requestState === a.NOT_STARTED && d();
79
80
  }, [s, d, t.requestState]);
80
- const W = {
81
- createSession: z,
82
- encodedSession: H,
83
- error: J,
81
+ const X = {
82
+ createSession: B,
83
+ encodedSession: J,
84
+ error: K,
84
85
  getAIStudioAgents: g,
85
86
  hostAppName: l,
86
87
  hasCustomSuggestedQuestions: !!e,
87
- hasRequestInProgress: M,
88
+ hasRequestInProgress: V,
88
89
  isAgentSelectorEnabled: w,
89
90
  isAIStudioAgentSelectorEnabled: q,
90
91
  isCitationsEnabled: n,
91
92
  isDebugModeEnabled: Q,
92
93
  isMarkdownEnabled: T,
93
- isLoading: K,
94
+ isLoading: M,
94
95
  isOpen: s,
95
96
  isResetChatEnabled: h,
96
97
  isStreamingEnabled: r,
97
98
  itemID: o,
98
99
  itemIDs: u,
99
100
  items: j,
100
- onClearAction: k,
101
+ onClearAction: z,
101
102
  onCloseModal: U,
102
103
  onCitationClick: _,
104
+ onItemClick: v,
103
105
  onSelectAgent: i,
104
106
  onAgentEditorToggle: i,
105
- parentItem: v,
106
- questions: V,
107
- retryQuestion: B,
108
- sendQuestion: F,
109
- shouldRenderProviders: L,
110
- stopQuestion: G,
107
+ parentItem: x,
108
+ questions: W,
109
+ retryQuestion: F,
110
+ sendQuestion: G,
111
+ shouldRenderProviders: N,
112
+ stopQuestion: H,
111
113
  suggestedQuestionsRequestState: e ? t.requestState : a.SUCCESS,
112
- suggestedQuestions: e ? t.suggestions : N,
113
- warningNotice: O,
114
- warningNoticeAriaLabel: P
115
- }, X = Object.fromEntries(Object.entries(W).filter(([oe, Y]) => Y !== void 0));
116
- return /* @__PURE__ */ se(f, {
117
- ...X
114
+ suggestedQuestions: e ? t.suggestions : O,
115
+ warningNotice: P,
116
+ warningNoticeAriaLabel: b
117
+ }, Y = Object.fromEntries(Object.entries(X).filter(([ne, Z]) => Z !== void 0));
118
+ return /* @__PURE__ */ oe(f, {
119
+ ...Y
118
120
  });
119
121
  };
120
122
  export {
121
- ae as ContentAnswersComponent,
122
- ae as default
123
+ fe as ContentAnswersComponent,
124
+ fe as default
123
125
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.82.1",
3
+ "version": "0.83.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.16.0",
@@ -56,5 +56,5 @@
56
56
  "**/*.css"
57
57
  ],
58
58
  "license": "SEE LICENSE IN LICENSE",
59
- "gitHead": "09007f7b059fe986902288b6369c6b3dc0a114a8"
59
+ "gitHead": "f2b659cfb16d0e070040f583df8f7cc6f0f50931"
60
60
  }
@@ -2,5 +2,5 @@ import { type ApiWrapperProps } from './types';
2
2
  export type ContentAnswersComponentProps = ApiWrapperProps & {
3
3
  WrappedComponent: React.ComponentType<ApiWrapperProps>;
4
4
  };
5
- export declare const ContentAnswersComponent: ({ WrappedComponent, createSessionRequest, getAgentConfig, getAIStudioAgents, fetchTimeout, formatCitations, getAnswer, getAnswerStreaming, getSuggestedQuestions, hostAppName, isAgentSelectorEnabled, isAIStudioAgentSelectorEnabled, isCitationsEnabled, isDebugModeEnabled, isMarkdownEnabled, isOpen, isResetChatEnabled, isStopResponseEnabled, isStreamingEnabled, itemID, itemIDs, items, onCloseModal, onCitationClick, parentItem, restoredQuestions, restoredSession, shouldRenderProviders, suggestedQuestions, warningNotice, warningNoticeAriaLabel, }: ContentAnswersComponentProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const ContentAnswersComponent: ({ WrappedComponent, createSessionRequest, getAgentConfig, getAIStudioAgents, fetchTimeout, formatCitations, getAnswer, getAnswerStreaming, getSuggestedQuestions, hostAppName, isAgentSelectorEnabled, isAIStudioAgentSelectorEnabled, isCitationsEnabled, isDebugModeEnabled, isMarkdownEnabled, isOpen, isResetChatEnabled, isStopResponseEnabled, isStreamingEnabled, itemID, itemIDs, items, onCloseModal, onCitationClick, onItemClick, parentItem, restoredQuestions, restoredSession, shouldRenderProviders, suggestedQuestions, warningNotice, warningNoticeAriaLabel, }: ContentAnswersComponentProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default ContentAnswersComponent;
@@ -89,6 +89,7 @@ export type ApiWrapperProps = {
89
89
  items?: Array<ItemType>;
90
90
  onCloseModal?: () => void;
91
91
  onCitationClick?: ItemClickHandler;
92
+ onItemClick?: ItemClickHandler;
92
93
  parentItem?: ItemType;
93
94
  restoredQuestions?: QuestionType[];
94
95
  restoredSession?: string;