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