@box/box-ai-content-answers 0.149.12 → 0.149.14
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.
- package/dist/esm/lib/components/api-wrapper/content-answers-component.js +84 -86
- package/dist/types/lib/components/api-wrapper/api-wrapper.d.ts +2 -2
- package/dist/types/lib/components/api-wrapper/stories/shared.d.ts +7 -1
- package/dist/types/lib/components/api-wrapper/types.d.ts +3 -1
- package/dist/types/lib/components/sidebar/content.d.ts +7 -1
- package/package.json +6 -6
|
@@ -1,83 +1,81 @@
|
|
|
1
1
|
import { useReducer as re, useEffect as de } from "react";
|
|
2
|
-
import { R as
|
|
2
|
+
import { R as l } from "../../../../chunks/types.js";
|
|
3
3
|
import { useContentAnswers as ae } from "./hooks/useContentAnswers.js";
|
|
4
4
|
import { ContentAnswersRecord as ue, ContentAnswersItemRecord as ge } from "./records.js";
|
|
5
5
|
import ce from "./reducer.js";
|
|
6
6
|
import { jsx as Se } from "react/jsx-runtime";
|
|
7
|
-
const Qe = (
|
|
7
|
+
const Qe = (i) => {
|
|
8
8
|
const {
|
|
9
|
-
WrappedComponent:
|
|
9
|
+
WrappedComponent: m,
|
|
10
10
|
cachedSuggestedQuestions: r = [],
|
|
11
|
-
createSessionRequest:
|
|
11
|
+
createSessionRequest: f,
|
|
12
12
|
enterpriseId: h,
|
|
13
|
-
fetchTimeout:
|
|
13
|
+
fetchTimeout: A,
|
|
14
14
|
formatCitations: p,
|
|
15
|
-
getAIStudioAgents:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
items: u,
|
|
15
|
+
getAIStudioAgents: C,
|
|
16
|
+
getAnswer: w,
|
|
17
|
+
getAnswerStreaming: Q,
|
|
18
|
+
getSuggestedQuestions: t,
|
|
19
|
+
hostAppName: E,
|
|
20
|
+
isAIStudioAgentSelectorEnabled: R,
|
|
21
|
+
isCitationsEnabled: b,
|
|
22
|
+
isDebugModeEnabled: I,
|
|
23
|
+
isMarkdownEnabled: q,
|
|
24
|
+
isReactMarkdownEnabled: T,
|
|
25
|
+
isOpen: s,
|
|
26
|
+
isStopResponseEnabled: L,
|
|
27
|
+
isStreamingEnabled: d,
|
|
28
|
+
itemID: n,
|
|
29
|
+
items: a,
|
|
31
30
|
onCitationClick: P,
|
|
32
|
-
onCloseModal:
|
|
33
|
-
onItemClick:
|
|
34
|
-
onSuggestedQuestionsFetched:
|
|
35
|
-
parentItem:
|
|
36
|
-
restoredQuestions:
|
|
37
|
-
restoredSession:
|
|
38
|
-
restoredShouldShowLandingPage:
|
|
39
|
-
sendErrorLog:
|
|
40
|
-
shouldRenderProviders:
|
|
41
|
-
suggestedQuestions:
|
|
42
|
-
userId:
|
|
43
|
-
warningNotice:
|
|
44
|
-
warningNoticeAriaLabel:
|
|
45
|
-
|
|
31
|
+
onCloseModal: k,
|
|
32
|
+
onItemClick: D,
|
|
33
|
+
onSuggestedQuestionsFetched: M,
|
|
34
|
+
parentItem: N,
|
|
35
|
+
restoredQuestions: O = [],
|
|
36
|
+
restoredSession: j = null,
|
|
37
|
+
restoredShouldShowLandingPage: v = !0,
|
|
38
|
+
sendErrorLog: U,
|
|
39
|
+
shouldRenderProviders: _ = !0,
|
|
40
|
+
suggestedQuestions: x,
|
|
41
|
+
userId: F,
|
|
42
|
+
warningNotice: y,
|
|
43
|
+
warningNoticeAriaLabel: W,
|
|
44
|
+
shouldPreinitSession: z
|
|
45
|
+
} = i, [u, B] = re(ce, new ue({
|
|
46
46
|
item: new ge({
|
|
47
|
-
id:
|
|
47
|
+
id: n
|
|
48
48
|
}),
|
|
49
|
-
questions:
|
|
50
|
-
encodedSession:
|
|
51
|
-
shouldShowLandingPage:
|
|
49
|
+
questions: O,
|
|
50
|
+
encodedSession: j,
|
|
51
|
+
shouldShowLandingPage: v
|
|
52
52
|
})), {
|
|
53
53
|
clearConversation: G,
|
|
54
54
|
createSession: H,
|
|
55
|
-
fetchAgentConfig:
|
|
56
|
-
fetchSuggestedQuestions:
|
|
55
|
+
fetchAgentConfig: g,
|
|
56
|
+
fetchSuggestedQuestions: c,
|
|
57
57
|
retryQuestion: J,
|
|
58
58
|
sendQuestion: K,
|
|
59
59
|
setAnswerFeedback: V,
|
|
60
60
|
stopQuestion: X
|
|
61
61
|
} = ae({
|
|
62
|
-
contentAnswers:
|
|
63
|
-
createSessionRequest:
|
|
62
|
+
contentAnswers: u,
|
|
63
|
+
createSessionRequest: f,
|
|
64
64
|
dispatchStateUpdate: B,
|
|
65
65
|
enterpriseId: h,
|
|
66
|
-
fetchTimeout:
|
|
66
|
+
fetchTimeout: A,
|
|
67
67
|
formatCitations: p,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
userId: y,
|
|
80
|
-
...t
|
|
68
|
+
getAnswerStreaming: Q,
|
|
69
|
+
getAnswer: w,
|
|
70
|
+
getSuggestedQuestions: t,
|
|
71
|
+
isStopResponseEnabled: L,
|
|
72
|
+
isStreamingEnabled: d,
|
|
73
|
+
itemID: n,
|
|
74
|
+
items: a,
|
|
75
|
+
onSuggestedQuestionsFetched: M,
|
|
76
|
+
sendErrorLog: U,
|
|
77
|
+
userId: F,
|
|
78
|
+
shouldPreinitSession: z
|
|
81
79
|
}), {
|
|
82
80
|
encodedSession: Y,
|
|
83
81
|
error: Z,
|
|
@@ -86,52 +84,52 @@ const Qe = (t) => {
|
|
|
86
84
|
questions: te,
|
|
87
85
|
shouldShowLandingPage: se,
|
|
88
86
|
suggestedQuestions: e
|
|
89
|
-
} =
|
|
87
|
+
} = u;
|
|
90
88
|
de(() => {
|
|
91
|
-
|
|
92
|
-
}, [
|
|
89
|
+
s && e.requestState === l.NOT_STARTED && c();
|
|
90
|
+
}, [s, c, e.requestState]);
|
|
93
91
|
const ne = r.length > 0;
|
|
94
|
-
let
|
|
95
|
-
ne ?
|
|
92
|
+
let o = x, S = l.SUCCESS;
|
|
93
|
+
ne ? o = r : t && (o = e.suggestions, S = e.requestState);
|
|
96
94
|
const oe = Object.fromEntries(Object.entries({
|
|
97
95
|
createSession: H,
|
|
98
96
|
encodedSession: Y,
|
|
99
97
|
error: Z,
|
|
100
|
-
getAIStudioAgents:
|
|
101
|
-
hostAppName:
|
|
102
|
-
hasCustomSuggestedQuestions: !!
|
|
98
|
+
getAIStudioAgents: C,
|
|
99
|
+
hostAppName: E,
|
|
100
|
+
hasCustomSuggestedQuestions: !!t,
|
|
103
101
|
hasRequestInProgress: ee,
|
|
104
|
-
isAIStudioAgentSelectorEnabled:
|
|
105
|
-
isCitationsEnabled:
|
|
106
|
-
isDebugModeEnabled:
|
|
107
|
-
isMarkdownEnabled:
|
|
108
|
-
isReactMarkdownEnabled:
|
|
102
|
+
isAIStudioAgentSelectorEnabled: R,
|
|
103
|
+
isCitationsEnabled: b,
|
|
104
|
+
isDebugModeEnabled: I,
|
|
105
|
+
isMarkdownEnabled: q,
|
|
106
|
+
isReactMarkdownEnabled: T,
|
|
109
107
|
isLoading: $,
|
|
110
|
-
isOpen:
|
|
111
|
-
isStreamingEnabled:
|
|
112
|
-
itemID:
|
|
113
|
-
items:
|
|
108
|
+
isOpen: s,
|
|
109
|
+
isStreamingEnabled: d,
|
|
110
|
+
itemID: n,
|
|
111
|
+
items: a,
|
|
114
112
|
onClearAction: G,
|
|
115
|
-
onCloseModal:
|
|
113
|
+
onCloseModal: k,
|
|
116
114
|
onCitationClick: P,
|
|
117
|
-
onItemClick:
|
|
118
|
-
onSelectAgent:
|
|
119
|
-
onAgentEditorToggle:
|
|
120
|
-
parentItem:
|
|
115
|
+
onItemClick: D,
|
|
116
|
+
onSelectAgent: g,
|
|
117
|
+
onAgentEditorToggle: g,
|
|
118
|
+
parentItem: N,
|
|
121
119
|
questions: te,
|
|
122
120
|
retryQuestion: J,
|
|
123
121
|
sendQuestion: K,
|
|
124
122
|
setAnswerFeedback: V,
|
|
125
|
-
shouldRenderProviders:
|
|
123
|
+
shouldRenderProviders: _,
|
|
126
124
|
shouldShowLandingPage: se,
|
|
127
125
|
stopQuestion: X,
|
|
128
|
-
suggestedQuestionsRequestState:
|
|
129
|
-
suggestedQuestions:
|
|
130
|
-
warningNotice:
|
|
131
|
-
warningNoticeAriaLabel:
|
|
126
|
+
suggestedQuestionsRequestState: S,
|
|
127
|
+
suggestedQuestions: o,
|
|
128
|
+
warningNotice: y,
|
|
129
|
+
warningNoticeAriaLabel: W
|
|
132
130
|
}).filter(([me, ie]) => ie !== void 0));
|
|
133
|
-
return /* @__PURE__ */ Se(
|
|
134
|
-
...
|
|
131
|
+
return /* @__PURE__ */ Se(m, {
|
|
132
|
+
...i,
|
|
135
133
|
...oe
|
|
136
134
|
});
|
|
137
135
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ApiWrapperProps } from './types';
|
|
2
|
-
export declare const withApiWrapper: (WrappedComponent:
|
|
1
|
+
import { ApiWrapperProps, InjectedProps } from './types';
|
|
2
|
+
export declare const withApiWrapper: <T extends object>(WrappedComponent: React.ComponentType<T & InjectedProps>) => React.ComponentType<T & ApiWrapperProps>;
|
|
3
3
|
export default withApiWrapper;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const _default: React.ComponentType<import('../types').ApiWrapperProps & {
|
|
3
|
+
shouldTriggerCreateSessionError: boolean;
|
|
4
|
+
shouldAddLoadingOnCreateSession: boolean;
|
|
5
|
+
shouldCreateSessionOnInit?: boolean;
|
|
6
|
+
shouldShowLoadingIndicator?: boolean;
|
|
7
|
+
}>;
|
|
2
8
|
export default _default;
|
|
@@ -108,7 +108,7 @@ export type UseContentAnswersProps = ApiWrapperProps & {
|
|
|
108
108
|
contentAnswers: ContentAnswersRecordType;
|
|
109
109
|
dispatchStateUpdate: React.Dispatch<unknown>;
|
|
110
110
|
};
|
|
111
|
-
export type
|
|
111
|
+
export type InjectedProps = {
|
|
112
112
|
chatMessages?: (QuestionType | WelcomeMessageType)[];
|
|
113
113
|
createSession: (shouldAddLoading?: boolean, shouldTriggerError?: boolean) => void;
|
|
114
114
|
encodedSession: string | null;
|
|
@@ -128,7 +128,9 @@ export type ApiWrapperWithInjectedProps = ApiWrapperProps & {
|
|
|
128
128
|
setAnswerFeedback: (questionId: string, feedbackValue: FeedbackValue) => void;
|
|
129
129
|
shouldRenderProviders: boolean;
|
|
130
130
|
stopQuestion: StopQuestion;
|
|
131
|
+
shouldShowLandingPage?: boolean;
|
|
131
132
|
};
|
|
133
|
+
export type ApiWrapperWithInjectedProps = ApiWrapperProps & InjectedProps;
|
|
132
134
|
export type StreamResponseTimeout = {
|
|
133
135
|
chunk: number;
|
|
134
136
|
initial: number;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { AgentListResponse } from '@box/box-ai-agent-selector';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const _default: React.ComponentType<{
|
|
4
|
+
getAIStudioAgents: () => Promise<AgentListResponse>;
|
|
5
|
+
hostAppName: string;
|
|
6
|
+
isAIStudioAgentSelectorEnabled: boolean;
|
|
7
|
+
} & import('../api-wrapper/types').ApiWrapperProps>;
|
|
2
8
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "0.149.
|
|
3
|
+
"version": "0.149.14",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.56.1",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.
|
|
21
|
-
"@box/blueprint-web-assets": "^4.
|
|
22
|
-
"@box/box-ai-agent-selector": "^0.
|
|
23
|
-
"@box/item-icon": "^0.24.
|
|
24
|
-
"@box/storybook-utils": "^0.14.
|
|
20
|
+
"@box/blueprint-web": "^12.76.0",
|
|
21
|
+
"@box/blueprint-web-assets": "^4.68.0",
|
|
22
|
+
"@box/box-ai-agent-selector": "^0.60.0",
|
|
23
|
+
"@box/item-icon": "^0.24.13",
|
|
24
|
+
"@box/storybook-utils": "^0.14.4",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|
|
27
27
|
"react-dom": "^18.3.0",
|