@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.
@@ -1,83 +1,81 @@
1
1
  import { useReducer as re, useEffect as de } from "react";
2
- import { R as m } from "../../../../chunks/types.js";
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 = (t) => {
7
+ const Qe = (i) => {
8
8
  const {
9
- WrappedComponent: f,
9
+ WrappedComponent: m,
10
10
  cachedSuggestedQuestions: r = [],
11
- createSessionRequest: A,
11
+ createSessionRequest: f,
12
12
  enterpriseId: h,
13
- fetchTimeout: C,
13
+ fetchTimeout: A,
14
14
  formatCitations: p,
15
- getAIStudioAgents: w,
16
- getAgentConfig: Q,
17
- getAnswer: E,
18
- getAnswerStreaming: R,
19
- getSuggestedQuestions: s,
20
- hostAppName: b,
21
- isAIStudioAgentSelectorEnabled: I,
22
- isCitationsEnabled: d,
23
- isDebugModeEnabled: q,
24
- isMarkdownEnabled: T,
25
- isReactMarkdownEnabled: L,
26
- isOpen: n,
27
- isStopResponseEnabled: k,
28
- isStreamingEnabled: a,
29
- itemID: o,
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: D,
33
- onItemClick: M,
34
- onSuggestedQuestionsFetched: N,
35
- parentItem: O,
36
- restoredQuestions: j = [],
37
- restoredSession: v = null,
38
- restoredShouldShowLandingPage: U = !0,
39
- sendErrorLog: _,
40
- shouldRenderProviders: x = !0,
41
- suggestedQuestions: F,
42
- userId: y,
43
- warningNotice: W,
44
- warningNoticeAriaLabel: z
45
- } = t, [g, B] = re(ce, new ue({
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: o
47
+ id: n
48
48
  }),
49
- questions: j,
50
- encodedSession: v,
51
- shouldShowLandingPage: U
49
+ questions: O,
50
+ encodedSession: j,
51
+ shouldShowLandingPage: v
52
52
  })), {
53
53
  clearConversation: G,
54
54
  createSession: H,
55
- fetchAgentConfig: c,
56
- fetchSuggestedQuestions: S,
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: g,
63
- createSessionRequest: A,
62
+ contentAnswers: u,
63
+ createSessionRequest: f,
64
64
  dispatchStateUpdate: B,
65
65
  enterpriseId: h,
66
- fetchTimeout: C,
66
+ fetchTimeout: A,
67
67
  formatCitations: p,
68
- getAgentConfig: Q,
69
- getAnswerStreaming: R,
70
- getAnswer: E,
71
- getSuggestedQuestions: s,
72
- isCitationsEnabled: d,
73
- isStopResponseEnabled: k,
74
- isStreamingEnabled: a,
75
- itemID: o,
76
- items: u,
77
- onSuggestedQuestionsFetched: N,
78
- sendErrorLog: _,
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
- } = g;
87
+ } = u;
90
88
  de(() => {
91
- n && e.requestState === m.NOT_STARTED && S();
92
- }, [n, S, e.requestState]);
89
+ s && e.requestState === l.NOT_STARTED && c();
90
+ }, [s, c, e.requestState]);
93
91
  const ne = r.length > 0;
94
- let i = F, l = m.SUCCESS;
95
- ne ? i = r : s && (i = e.suggestions, l = e.requestState);
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: w,
101
- hostAppName: b,
102
- hasCustomSuggestedQuestions: !!s,
98
+ getAIStudioAgents: C,
99
+ hostAppName: E,
100
+ hasCustomSuggestedQuestions: !!t,
103
101
  hasRequestInProgress: ee,
104
- isAIStudioAgentSelectorEnabled: I,
105
- isCitationsEnabled: d,
106
- isDebugModeEnabled: q,
107
- isMarkdownEnabled: T,
108
- isReactMarkdownEnabled: L,
102
+ isAIStudioAgentSelectorEnabled: R,
103
+ isCitationsEnabled: b,
104
+ isDebugModeEnabled: I,
105
+ isMarkdownEnabled: q,
106
+ isReactMarkdownEnabled: T,
109
107
  isLoading: $,
110
- isOpen: n,
111
- isStreamingEnabled: a,
112
- itemID: o,
113
- items: u,
108
+ isOpen: s,
109
+ isStreamingEnabled: d,
110
+ itemID: n,
111
+ items: a,
114
112
  onClearAction: G,
115
- onCloseModal: D,
113
+ onCloseModal: k,
116
114
  onCitationClick: P,
117
- onItemClick: M,
118
- onSelectAgent: c,
119
- onAgentEditorToggle: c,
120
- parentItem: O,
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: x,
123
+ shouldRenderProviders: _,
126
124
  shouldShowLandingPage: se,
127
125
  stopQuestion: X,
128
- suggestedQuestionsRequestState: l,
129
- suggestedQuestions: i,
130
- warningNotice: W,
131
- warningNoticeAriaLabel: z
126
+ suggestedQuestionsRequestState: S,
127
+ suggestedQuestions: o,
128
+ warningNotice: y,
129
+ warningNoticeAriaLabel: W
132
130
  }).filter(([me, ie]) => ie !== void 0));
133
- return /* @__PURE__ */ Se(f, {
134
- ...t,
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: any) => (props: ApiWrapperProps) => import("react/jsx-runtime").JSX.Element;
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
- declare const _default: (props: import('../types').ApiWrapperProps) => import("react/jsx-runtime").JSX.Element;
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 ApiWrapperWithInjectedProps = ApiWrapperProps & {
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
- declare const _default: (props: import('../api-wrapper/types').ApiWrapperProps) => import("react/jsx-runtime").JSX.Element;
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.12",
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.75.6",
21
- "@box/blueprint-web-assets": "^4.67.0",
22
- "@box/box-ai-agent-selector": "^0.59.12",
23
- "@box/item-icon": "^0.24.12",
24
- "@box/storybook-utils": "^0.14.3",
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",