forked from box/box-ui-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoxAISidebarContext.ts
43 lines (40 loc) · 1.43 KB
/
BoxAISidebarContext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as React from 'react';
import noop from 'lodash/noop';
import { RecordActionType as AgentSelectorRecordActionType } from '@box/box-ai-agent-selector';
import { RecordActionType as ContentAnswersRecordActionType } from '@box/box-ai-content-answers';
import type { ItemType } from '@box/box-ai-content-answers';
import type { BoxAISidebarCache, BoxAISidebarCacheSetter } from '../types/BoxAISidebarTypes';
type BoxAISidebarRecordActionType =
| AgentSelectorRecordActionType
| ContentAnswersRecordActionType
| (Omit<ContentAnswersRecordActionType, 'data'> & {
data: {
items: Array<Pick<ItemType, 'fileType' | 'status'>>;
};
});
export interface BoxAISidebarContextValues {
cache: BoxAISidebarCache;
contentName: string;
elementId: string;
fileExtension: string;
isFeedbackEnabled: boolean;
isStopResponseEnabled: boolean;
items: Array<ItemType>;
itemSize?: string;
onUserInteraction?: () => void;
recordAction: (params: BoxAISidebarRecordActionType) => void;
setCacheValue: BoxAISidebarCacheSetter;
shouldPreinitSession: boolean;
}
export const BoxAISidebarContext = React.createContext<BoxAISidebarContextValues>({
cache: null,
contentName: '',
elementId: '',
fileExtension: '',
isFeedbackEnabled: false,
isStopResponseEnabled: false,
items: [],
recordAction: noop,
setCacheValue: noop,
shouldPreinitSession: true,
});