@inkeep/agents-ui 0.14.20 → 0.14.21
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/color-mode/index.d.ts +21 -0
- package/dist/index.d.ts +1 -5103
- package/dist/primitives/atoms/avatars/ai.d.ts +3 -0
- package/dist/primitives/atoms/avatars/user.d.ts +3 -0
- package/dist/primitives/atoms/cmdk/command-score.d.ts +1 -0
- package/dist/primitives/atoms/cmdk/index.d.ts +460 -0
- package/dist/primitives/atoms/codeblock/index.d.ts +10 -0
- package/dist/primitives/atoms/custom-styles.d.ts +5 -0
- package/dist/primitives/atoms/dialog.d.ts +94 -0
- package/dist/primitives/atoms/error-boundary.d.ts +6 -0
- package/dist/primitives/atoms/icons/built-in-icon-renderer.d.ts +6 -0
- package/dist/primitives/atoms/icons/built-in-icons.d.ts +83 -0
- package/dist/primitives/atoms/icons/checkbox-icon.d.ts +1 -0
- package/dist/primitives/atoms/icons/collections/bi.d.ts +4 -0
- package/dist/primitives/atoms/icons/collections/fi.d.ts +2 -0
- package/dist/primitives/atoms/icons/collections/gr.d.ts +2 -0
- package/dist/primitives/atoms/icons/collections/io5.d.ts +34 -0
- package/dist/primitives/atoms/icons/collections/pi.d.ts +4 -0
- package/dist/primitives/atoms/icons/custom-icon.d.ts +6 -0
- package/dist/primitives/atoms/icons/generate-icon.d.ts +28 -0
- package/dist/primitives/atoms/icons/index.d.ts +2 -0
- package/dist/primitives/atoms/icons/inkeep-default-icons.d.ts +2 -0
- package/dist/primitives/atoms/link.d.ts +14 -0
- package/dist/primitives/atoms/markdown/components.d.ts +31 -0
- package/dist/primitives/atoms/markdown/index.d.ts +17 -0
- package/dist/primitives/atoms/markdown/rehype-inline-code-property.d.ts +1 -0
- package/dist/primitives/atoms/portal-with-theme.d.ts +2 -0
- package/dist/primitives/atoms/portal.d.ts +8 -0
- package/dist/primitives/atoms/select.d.ts +136 -0
- package/dist/primitives/atoms/shadow/context.d.ts +14 -0
- package/dist/primitives/atoms/shadow/create.d.ts +8 -0
- package/dist/primitives/atoms/shadow/index.d.ts +1 -0
- package/dist/primitives/atoms/shadow/root.d.ts +5 -0
- package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.d.ts +2 -0
- package/dist/primitives/atoms/shadow/utils.d.ts +9 -0
- package/dist/primitives/components/chat-button.d.ts +18 -0
- package/dist/primitives/components/embedded-chat/chat-provider.d.ts +19 -0
- package/dist/primitives/components/embedded-chat/use-captcha.d.ts +13 -0
- package/dist/primitives/components/embedded-chat/use-chat-action.d.ts +9 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +27 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-stream-processor.d.ts +28 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +27 -28
- package/dist/primitives/components/embedded-chat.cjs +3 -3
- package/dist/primitives/components/embedded-chat.d.ts +431 -0
- package/dist/primitives/components/embedded-chat.js +775 -776
- package/dist/primitives/components/embedded-search/search-provider.d.ts +21 -0
- package/dist/primitives/components/embedded-search/transform-results.d.ts +3 -0
- package/dist/primitives/components/embedded-search/url-query.d.ts +4 -0
- package/dist/primitives/components/embedded-search/use-inkeep-search.d.ts +19 -0
- package/dist/primitives/components/embedded-search/use-search-filter.d.ts +1 -0
- package/dist/primitives/components/embedded-search.d.ts +249 -0
- package/dist/primitives/components/factory.d.ts +19 -0
- package/dist/primitives/components/index.d.ts +10 -0
- package/dist/primitives/components/modal/modal-provider.d.ts +12 -0
- package/dist/primitives/components/modal/use-inkeep-modal.d.ts +7 -0
- package/dist/primitives/components/modal/widget-auto-focus.d.ts +2 -0
- package/dist/primitives/components/modal.d.ts +18 -0
- package/dist/primitives/components/presence.d.ts +8 -0
- package/dist/primitives/components/searchbar.d.ts +23 -0
- package/dist/primitives/components/sidebar-chat/index.d.ts +9 -0
- package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.d.ts +5 -0
- package/dist/primitives/components/tagline-logo-icon.d.ts +1 -0
- package/dist/primitives/components/use-component-trigger.d.ts +5 -0
- package/dist/primitives/constants/search.d.ts +1 -0
- package/dist/primitives/hooks/index.d.ts +11 -0
- package/dist/primitives/hooks/use-boolean.d.ts +10 -0
- package/dist/primitives/hooks/use-component-classnames.d.ts +6 -0
- package/dist/primitives/hooks/use-container-size.d.ts +5 -0
- package/dist/primitives/hooks/use-copy-to-clipboard.d.ts +3 -0
- package/dist/primitives/hooks/use-debounce.d.ts +1 -0
- package/dist/primitives/hooks/use-instant-update.d.ts +17 -0
- package/dist/primitives/hooks/use-is-mounted.d.ts +1 -0
- package/dist/primitives/hooks/use-media-query.d.ts +1 -0
- package/dist/primitives/hooks/use-resize-observer.d.ts +12 -0
- package/dist/primitives/hooks/use-scrolling-fades.d.ts +2 -0
- package/dist/primitives/hooks/use-settle-action.d.ts +3 -0
- package/dist/primitives/hooks/use-simple-scroll.d.ts +5 -0
- package/dist/primitives/hooks/use-streaming-events.d.ts +8 -0
- package/dist/primitives/index.d.ts +13 -0
- package/dist/primitives/providers/attachment-item-provider.d.ts +9 -0
- package/dist/primitives/providers/attachments-bar-provider.d.ts +30 -0
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.d.ts +8 -0
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/primitives/providers/chat-form-provider.d.ts +26 -0
- package/dist/primitives/providers/config-provider.d.ts +25 -0
- package/dist/primitives/providers/feedback-item-provider.d.ts +10 -0
- package/dist/primitives/providers/feedback-provider.d.ts +16 -0
- package/dist/primitives/providers/form-field-provider.d.ts +15 -0
- package/dist/primitives/providers/help-menu-provider.d.ts +11 -0
- package/dist/primitives/providers/hover-popover-provider.d.ts +10 -0
- package/dist/primitives/providers/index.d.ts +17 -0
- package/dist/primitives/providers/markdown-provider.d.ts +9 -0
- package/dist/primitives/providers/message-attachments-provider.d.ts +13 -0
- package/dist/primitives/providers/message-provider.d.ts +10 -0
- package/dist/primitives/providers/root-provider.d.ts +8 -0
- package/dist/primitives/providers/search-events-provider.d.ts +8 -0
- package/dist/primitives/providers/sidebar-chat-provider.d.ts +83 -0
- package/dist/primitives/providers/source-item-provider.d.ts +12 -0
- package/dist/primitives/providers/theme-provider.d.ts +3 -0
- package/dist/primitives/providers/widget-provider.d.ts +10 -0
- package/dist/primitives/utils/component-ids.d.ts +572 -0
- package/dist/primitives/utils/compose-event-handlers.d.ts +3 -0
- package/dist/primitives/utils/compose-refs.d.ts +5 -0
- package/dist/primitives/utils/default-settings.d.ts +167 -0
- package/dist/primitives/utils/form.d.ts +3 -0
- package/dist/primitives/utils/generate-uid.d.ts +2 -0
- package/dist/primitives/utils/get-message-metadata.d.ts +8 -0
- package/dist/primitives/utils/get-source-icon.d.ts +2 -0
- package/dist/primitives/utils/highlight-emphasis.d.ts +4 -0
- package/dist/primitives/utils/merge-props.d.ts +7 -0
- package/dist/primitives/utils/misc.d.ts +12 -0
- package/dist/primitives/utils/split-props.d.ts +15 -0
- package/dist/react/chat-button.d.ts +14 -0
- package/dist/react/embedded-chat.d.ts +14 -0
- package/dist/react/embedded-search-and-chat.d.ts +40 -0
- package/dist/react/embedded-search-and-chat.impl.d.ts +9 -0
- package/dist/react/embedded-search.d.ts +17 -0
- package/dist/react/index.d.ts +12 -0
- package/dist/react/modal.chat.d.ts +6 -0
- package/dist/react/modal.d.ts +23 -0
- package/dist/react/modal.search-and-chat.d.ts +6 -0
- package/dist/react/modal.search.d.ts +6 -0
- package/dist/react/searchbar.d.ts +13 -0
- package/dist/react/sidebar-chat.d.ts +6 -0
- package/dist/react/utils.d.ts +6 -0
- package/dist/react/widget-toggle.d.ts +14 -0
- package/dist/styled/components/chat-button.d.ts +8 -0
- package/dist/styled/components/data-summary-group.d.ts +11 -0
- package/dist/styled/components/embedded-chat.d.ts +190 -0
- package/dist/styled/components/embedded-search/results-loading.d.ts +1 -0
- package/dist/styled/components/embedded-search.d.ts +73 -0
- package/dist/styled/components/index.d.ts +11 -0
- package/dist/styled/components/loading-indicator.d.ts +1 -0
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.d.ts +4 -0
- package/dist/styled/components/message.js +46 -47
- package/dist/styled/components/modal.d.ts +6 -0
- package/dist/styled/components/searchbar.d.ts +11 -0
- package/dist/styled/components/shadow.d.ts +3 -0
- package/dist/styled/components/sidebar-chat.d.ts +6 -0
- package/dist/styled/components/ui/markdown-styles.d.ts +23 -0
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.d.ts +7 -0
- package/dist/styled/components/ui/recipes/attachment.d.ts +4 -0
- package/dist/styled/components/ui/recipes/button.d.ts +6 -0
- package/dist/styled/components/ui/recipes/checkbox.d.ts +4 -0
- package/dist/styled/components/ui/recipes/citation.d.ts +4 -0
- package/dist/styled/components/ui/recipes/icon.d.ts +2 -0
- package/dist/styled/components/ui/recipes/index.d.ts +15 -0
- package/dist/styled/components/ui/recipes/input.d.ts +5 -0
- package/dist/styled/components/ui/recipes/link.d.ts +2 -0
- package/dist/styled/components/ui/recipes/markdown.cjs +1 -1
- package/dist/styled/components/ui/recipes/markdown.d.ts +16 -0
- package/dist/styled/components/ui/recipes/markdown.js +1 -1
- package/dist/styled/components/ui/recipes/modal.d.ts +4 -0
- package/dist/styled/components/ui/recipes/popover.d.ts +4 -0
- package/dist/styled/components/ui/recipes/scrollable.d.ts +4 -0
- package/dist/styled/components/ui/recipes/select.d.ts +4 -0
- package/dist/styled/components/ui/recipes/skeleton.d.ts +2 -0
- package/dist/styled/components/ui/recipes/widget-toggle.d.ts +4 -0
- package/dist/styled/index.d.ts +2 -0
- package/dist/styled/utils.d.ts +4 -0
- package/dist/theme/color-utils.d.ts +1 -0
- package/dist/theme/colors.d.ts +104 -0
- package/dist/theme/index.d.ts +125 -0
- package/dist/theme/utils/create-css-variables.d.ts +2 -0
- package/dist/theme/utils/generate-theme-variables.d.ts +3 -0
- package/dist/types/color-mode.d.ts +44 -0
- package/dist/types/config/ai.d.ts +243 -0
- package/dist/types/config/base.d.ts +344 -0
- package/dist/types/config/components.d.ts +10 -0
- package/dist/types/config/filters.d.ts +17 -0
- package/dist/types/config/index.d.ts +36 -0
- package/dist/types/config/modal.d.ts +33 -0
- package/dist/types/config/search.d.ts +95 -0
- package/dist/types/config/settings/actions.d.ts +37 -0
- package/dist/types/config/settings/form.d.ts +128 -0
- package/dist/types/config/settings/jsonschema.d.ts +105 -0
- package/dist/types/config/settings/workflow.d.ts +86 -0
- package/dist/types/events.d.ts +173 -0
- package/dist/types/icons/built-in.d.ts +1 -0
- package/dist/types/icons/custom.d.ts +29 -0
- package/dist/types/icons/index.d.ts +2 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/js/index.d.ts +54 -0
- package/dist/types/message.d.ts +43 -0
- package/dist/types/shadow.d.ts +15 -0
- package/dist/types/sources.d.ts +108 -0
- package/dist/types/theme.d.ts +25 -0
- package/dist/types/widget.d.ts +28 -0
- package/package.json +2 -4
- package/dist/index.d.cts +0 -5103
- package/dist/types/message.cjs +0 -1
- package/dist/types/message.js +0 -5
- package/dist/types/types.d.cts +0 -1758
- package/dist/types/types.d.ts +0 -1758
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { AIChatFormSettings } from './settings/form';
|
|
2
|
+
import { GetHelpOption } from './settings/actions';
|
|
3
|
+
import { SearchAndChatFilters } from './filters';
|
|
4
|
+
import { ComponentsConfig } from './components';
|
|
5
|
+
export interface InkeepAIChatSettings {
|
|
6
|
+
/**
|
|
7
|
+
* Headers for requests
|
|
8
|
+
*/
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* API key for requests
|
|
12
|
+
*/
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Agent URL for chatstream API.
|
|
16
|
+
*/
|
|
17
|
+
agentUrl?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Context to be passed to the chatstream API.
|
|
20
|
+
*/
|
|
21
|
+
context?: Record<string, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* The placeholder text to display in the chat input field when empty.
|
|
24
|
+
* Use this to provide guidance on what kind of questions users can ask.
|
|
25
|
+
* @example "Ask me anything about our API documentation..."
|
|
26
|
+
*/
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A welcome message shown at the start of a new chat session.
|
|
30
|
+
* Supports markdown formatting for rich text styling.
|
|
31
|
+
* Use this to introduce the AI assistant's capabilities and set expectations.
|
|
32
|
+
* @example "👋 Hi! I'm here to help you with technical questions about our API..."
|
|
33
|
+
*/
|
|
34
|
+
introMessage?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The name of the product/service/topic that the chat assistant specializes in.
|
|
37
|
+
* This helps contextualize the chat experience for users.
|
|
38
|
+
* If not provided, defaults to the organization name from base settings.
|
|
39
|
+
* @example "MongoDB Atlas" or "React Router"
|
|
40
|
+
*/
|
|
41
|
+
chatSubjectName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The display name for the AI assistant in the chat interface.
|
|
44
|
+
* Choose a name that reflects the assistant's role and your brand.
|
|
45
|
+
* @example "Atlas Assistant" or "DevBot"
|
|
46
|
+
*/
|
|
47
|
+
aiAssistantName?: string;
|
|
48
|
+
/**
|
|
49
|
+
* URL to the AI assistant's avatar image.
|
|
50
|
+
* Should be a square image, recommended size 40x40px.
|
|
51
|
+
* Supports common image formats (PNG, JPG, SVG).
|
|
52
|
+
*
|
|
53
|
+
* You can pass a string or an object to configure for different color modes.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* {
|
|
57
|
+
* light: 'https://example.com/avatar-light.png',
|
|
58
|
+
* dark: 'https://example.com/avatar-dark.png',
|
|
59
|
+
* }
|
|
60
|
+
*/
|
|
61
|
+
aiAssistantAvatar?: string | {
|
|
62
|
+
light: string;
|
|
63
|
+
dark: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* URL to the user's avatar image in the chat interface.
|
|
67
|
+
* Should be a square image, recommended size 40x40px.
|
|
68
|
+
* Falls back to a default user icon if not provided.
|
|
69
|
+
*/
|
|
70
|
+
userAvatar?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Controls whether links in chat messages open in new browser tabs.
|
|
73
|
+
* Enable this to help users maintain their chat context when following links.
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
shouldOpenLinksInNewTab?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Custom heading text for the example questions section.
|
|
79
|
+
* Use this to better describe your suggested queries.
|
|
80
|
+
* @example "Common Questions" or "Try asking about..."
|
|
81
|
+
*/
|
|
82
|
+
exampleQuestionsLabel?: string;
|
|
83
|
+
/**
|
|
84
|
+
* A list of pre-written questions users can click to quickly start a conversation.
|
|
85
|
+
* These should reflect common use cases and help users understand the AI assistant's capabilities.
|
|
86
|
+
* @example ["How do I reset my password?", "What are the API rate limits?"]
|
|
87
|
+
*/
|
|
88
|
+
exampleQuestions?: string[];
|
|
89
|
+
/**
|
|
90
|
+
* Whether to visually emphasize the first example question.
|
|
91
|
+
* Use this to draw attention to the most important or common query.
|
|
92
|
+
*/
|
|
93
|
+
isFirstExampleQuestionHighlighted?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Enables the ability to share chat conversations via URL.
|
|
96
|
+
* Useful for allowing users to share helpful conversations with teammates.
|
|
97
|
+
*/
|
|
98
|
+
isShareButtonVisible?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The base URL path used when generating shareable chat links.
|
|
101
|
+
* Should match your application's routing structure.
|
|
102
|
+
* @example "/shared-chats/" or "/support/conversations/"
|
|
103
|
+
*/
|
|
104
|
+
shareChatUrlBasePath?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Controls the visibility of the copy chat button.
|
|
107
|
+
* Allows users to copy the entire chat transcript to their clipboard.
|
|
108
|
+
*/
|
|
109
|
+
isCopyChatButtonVisible?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Unique identifier for loading a specific conversation.
|
|
112
|
+
* Use this to restore a previous conversation state.
|
|
113
|
+
*/
|
|
114
|
+
conversationId?: string;
|
|
115
|
+
/**
|
|
116
|
+
* When enabled, prevents users from sending new messages.
|
|
117
|
+
* Useful for displaying archived or shared chat sessions.
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
isViewOnly?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Whether to make conversations public by default.
|
|
123
|
+
* @default undefined (private)
|
|
124
|
+
*/
|
|
125
|
+
conversationVisibility?: 'public' | 'private';
|
|
126
|
+
/**
|
|
127
|
+
* Configuration for the chat's disclaimer message.
|
|
128
|
+
* Use this to display important notices about AI limitations or data usage.
|
|
129
|
+
*/
|
|
130
|
+
disclaimerSettings?: AIChatDisclaimerSettings;
|
|
131
|
+
/**
|
|
132
|
+
* Callback function triggered whenever the user modifies their input message.
|
|
133
|
+
* @param message The current content of the input field
|
|
134
|
+
*/
|
|
135
|
+
onInputMessageChange?: (message: string) => void;
|
|
136
|
+
/**
|
|
137
|
+
* React ref for accessing the chat component's methods.
|
|
138
|
+
* Enables programmatic control of chat functions from parent components.
|
|
139
|
+
*/
|
|
140
|
+
chatFunctionsRef?: React.Ref<AIChatFunctions>;
|
|
141
|
+
/**
|
|
142
|
+
* Array of actions available in the "Get Help" menu.
|
|
143
|
+
* Use this to provide alternative support options like contact forms or documentation links.
|
|
144
|
+
*/
|
|
145
|
+
getHelpOptions?: GetHelpOption[];
|
|
146
|
+
/**
|
|
147
|
+
* Custom heading text for the workflows section.
|
|
148
|
+
* Use this to describe available automated processes or guided flows.
|
|
149
|
+
*/
|
|
150
|
+
workflowsHeader?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Collection of interactive workflows that can be triggered during chat.
|
|
153
|
+
* These can guide users through complex processes or data collection.
|
|
154
|
+
*/
|
|
155
|
+
/**
|
|
156
|
+
* Custom labels for the chat interface's action buttons.
|
|
157
|
+
* Use this for internationalization or to better match your application's terminology.
|
|
158
|
+
*/
|
|
159
|
+
toolbarButtonLabels?: AIChatToolbarButtonLabels;
|
|
160
|
+
/**
|
|
161
|
+
* Filters to apply to the chat results.
|
|
162
|
+
*/
|
|
163
|
+
filters?: SearchAndChatFilters;
|
|
164
|
+
/**
|
|
165
|
+
* Components to be rendered in the chat interface.
|
|
166
|
+
*/
|
|
167
|
+
components?: ComponentsConfig<any>;
|
|
168
|
+
artifacts?: ComponentsConfig<any>;
|
|
169
|
+
}
|
|
170
|
+
export interface AIChatDisclaimerSettings {
|
|
171
|
+
/**
|
|
172
|
+
* Controls whether the disclaimer message is shown.
|
|
173
|
+
* Enable this when you need to display important notices or legal disclaimers.
|
|
174
|
+
* @default false
|
|
175
|
+
*/
|
|
176
|
+
isEnabled?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The main text content of the disclaimer message.
|
|
179
|
+
* Should clearly communicate important information about AI usage or limitations.
|
|
180
|
+
* @example "AI responses are generated automatically and may require verification."
|
|
181
|
+
*/
|
|
182
|
+
label?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Additional information shown when hovering over the disclaimer.
|
|
185
|
+
* Use this to provide more detailed explanations or context.
|
|
186
|
+
*/
|
|
187
|
+
tooltip?: string;
|
|
188
|
+
}
|
|
189
|
+
export interface AIChatFunctions {
|
|
190
|
+
/**
|
|
191
|
+
* Programmatically sends a message in the chat.
|
|
192
|
+
* @param message Optional message text. If omitted, sends the current input value.
|
|
193
|
+
*/
|
|
194
|
+
submitMessage: (message?: string) => void;
|
|
195
|
+
/**
|
|
196
|
+
* Programmatically updates the text in the chat input field.
|
|
197
|
+
* @param message The new message text to set
|
|
198
|
+
*/
|
|
199
|
+
updateInputMessage: (message: string) => void;
|
|
200
|
+
/**
|
|
201
|
+
* Resets the chat to its initial state.
|
|
202
|
+
* Removes all messages and resets any active workflows.
|
|
203
|
+
*/
|
|
204
|
+
clearChat: () => void;
|
|
205
|
+
/**
|
|
206
|
+
* Displays a form overlay in the chat interface.
|
|
207
|
+
* @param formSettings Configuration object defining the form's fields and behavior
|
|
208
|
+
* @param getHelpOption Optional getHelpOption that triggered the form (for analytics)
|
|
209
|
+
*/
|
|
210
|
+
openForm: (formSettings: AIChatFormSettings, getHelpOption?: GetHelpOption) => void;
|
|
211
|
+
/**
|
|
212
|
+
* Programmatically sets focus to the chat input field.
|
|
213
|
+
* Useful after programmatic updates or when showing the chat interface.
|
|
214
|
+
*/
|
|
215
|
+
focusInput: () => void;
|
|
216
|
+
}
|
|
217
|
+
export interface AIChatToolbarButtonLabels {
|
|
218
|
+
/**
|
|
219
|
+
* Text shown on the button that clears the chat history.
|
|
220
|
+
* @example "Clear Chat" or "Start Over"
|
|
221
|
+
*/
|
|
222
|
+
clear?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Text shown on the button that generates a shareable chat link.
|
|
225
|
+
* @example "Share Chat" or "Get Link"
|
|
226
|
+
*/
|
|
227
|
+
share?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Text shown on the button that opens the help options menu.
|
|
230
|
+
* @example "Get Help" or "Support Options"
|
|
231
|
+
*/
|
|
232
|
+
getHelp?: string;
|
|
233
|
+
/**
|
|
234
|
+
* Text shown on the button that stops the AI from generating a response.
|
|
235
|
+
* @example "Stop" or "Cancel Response"
|
|
236
|
+
*/
|
|
237
|
+
stop?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Text shown on the button that copies the chat transcript.
|
|
240
|
+
* @example "Copy Chat" or "Copy Transcript"
|
|
241
|
+
*/
|
|
242
|
+
copyChat?: string;
|
|
243
|
+
}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { CustomIconMap } from '../icons';
|
|
2
|
+
import { InkeepCallbackEvent, InkeepFeedback } from '../events';
|
|
3
|
+
import { UrlQueryParam } from '../widget';
|
|
4
|
+
import { UserProvidedColorScheme, IkpTheme } from '../theme';
|
|
5
|
+
import { TransformSource } from '../sources';
|
|
6
|
+
import { ColorModeProviderProps } from '../color-mode';
|
|
7
|
+
import { SearchAndChatFilters } from './filters';
|
|
8
|
+
export interface InkeepBaseSettings {
|
|
9
|
+
/**
|
|
10
|
+
* The display name of your organization that will be shown in various UI elements.
|
|
11
|
+
* For example, this may appear in chat messages or headers.
|
|
12
|
+
*/
|
|
13
|
+
organizationDisplayName?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The primary brand color used throughout the widget UI.
|
|
16
|
+
* This color will be used to generate a cohesive color scheme.
|
|
17
|
+
* Should be provided as a valid CSS color value (hex, rgb, etc).
|
|
18
|
+
*/
|
|
19
|
+
primaryBrandColor: string;
|
|
20
|
+
/**
|
|
21
|
+
* Settings to control the color mode (light/dark) behavior.
|
|
22
|
+
* Can be used to sync with your application's theme or set a forced color mode.
|
|
23
|
+
* @see ColorModeConfig type for detailed configuration options
|
|
24
|
+
*/
|
|
25
|
+
colorMode?: ColorModeConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Theme customization settings for the widget.
|
|
28
|
+
* Allows customizing colors, typography, component styles, and more.
|
|
29
|
+
*/
|
|
30
|
+
theme?: UserTheme;
|
|
31
|
+
/**
|
|
32
|
+
* Custom icon overrides for the default icon set.
|
|
33
|
+
* Allows replacing any of the built-in icons with your own components.
|
|
34
|
+
*/
|
|
35
|
+
customIcons?: CustomIconMap;
|
|
36
|
+
/**
|
|
37
|
+
* Properties to identify and provide context about the current user.
|
|
38
|
+
* Used for personalization and analytics tracking.
|
|
39
|
+
* @see UserProperties interface for available fields
|
|
40
|
+
*/
|
|
41
|
+
userProperties?: UserProperties;
|
|
42
|
+
/**
|
|
43
|
+
* Authentication token for the current user.
|
|
44
|
+
* Used for authenticated API requests if required.
|
|
45
|
+
*/
|
|
46
|
+
userAuthToken?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Additional properties to be sent with analytics events.
|
|
49
|
+
* These properties will be merged with the event properties.
|
|
50
|
+
*/
|
|
51
|
+
analyticsProperties?: Record<string, unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* Handler for analytics events from the widget.
|
|
54
|
+
* @param event The analytics event object
|
|
55
|
+
*/
|
|
56
|
+
onEvent?: (event: InkeepCallbackEvent) => Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Handler for feedback events from the widget.
|
|
59
|
+
* @param feedback The feedback object
|
|
60
|
+
*/
|
|
61
|
+
onFeedback?: (feedback: InkeepFeedback & {
|
|
62
|
+
properties?: Record<string, unknown>;
|
|
63
|
+
}) => Promise<InkeepFeedback>;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to bypass the captcha challenge. Only enable this flag if using a server side API type api key, otherwise the api requests will fail without the challenge solution.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
shouldBypassCaptcha?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Function to transform source data before display.
|
|
71
|
+
* Allows customizing how source information is presented in the widget.
|
|
72
|
+
* @param source The original source data
|
|
73
|
+
* @returns The transformed source data
|
|
74
|
+
*/
|
|
75
|
+
transformSource?: TransformSource;
|
|
76
|
+
/**
|
|
77
|
+
* Reference to the shadow DOM host element if using custom Shadow DOM.
|
|
78
|
+
* Required when embedding the widget within a Shadow DOM.
|
|
79
|
+
*/
|
|
80
|
+
shadowHost?: HTMLElement | null;
|
|
81
|
+
/**
|
|
82
|
+
* Reference to the root element where the widget is mounted.
|
|
83
|
+
* Used for positioning and event handling.
|
|
84
|
+
*/
|
|
85
|
+
rootElement?: HTMLElement | null;
|
|
86
|
+
/**
|
|
87
|
+
* Custom tags for widget identification.
|
|
88
|
+
* Used in analytics to segment and filter widget instances.
|
|
89
|
+
* Array of string identifiers.
|
|
90
|
+
*/
|
|
91
|
+
tags?: string[];
|
|
92
|
+
/**
|
|
93
|
+
* Instance of the Prism syntax highlighting library.
|
|
94
|
+
* Required for code block syntax highlighting functionality.
|
|
95
|
+
*/
|
|
96
|
+
prism?: any;
|
|
97
|
+
/**
|
|
98
|
+
* Query parameters to automatically append to URLs in the widget.
|
|
99
|
+
* Useful for tracking or maintaining context in navigation.
|
|
100
|
+
* Object mapping parameter names to values.
|
|
101
|
+
*/
|
|
102
|
+
urlQueryParamsToAppend?: UrlQueryParam;
|
|
103
|
+
/**
|
|
104
|
+
* Base-level filters to apply to all search and chat operations.
|
|
105
|
+
* These are typically organization or user-level filters.
|
|
106
|
+
*/
|
|
107
|
+
filters?: SearchAndChatFilters;
|
|
108
|
+
}
|
|
109
|
+
export type UserProperties = {
|
|
110
|
+
/**
|
|
111
|
+
* The user ID.
|
|
112
|
+
*/
|
|
113
|
+
id?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The user email.
|
|
116
|
+
*/
|
|
117
|
+
email?: string;
|
|
118
|
+
/**
|
|
119
|
+
* The user name.
|
|
120
|
+
*/
|
|
121
|
+
name?: string;
|
|
122
|
+
/**
|
|
123
|
+
* The user cohorts.
|
|
124
|
+
*/
|
|
125
|
+
cohorts?: string[];
|
|
126
|
+
} & Record<string, unknown>;
|
|
127
|
+
export interface UserTheme extends Partial<IkpTheme> {
|
|
128
|
+
/**
|
|
129
|
+
* Whether to disable loading the default font.
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
132
|
+
disableLoadingDefaultFont?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* The syntax highlighter theme configuration for code blocks.
|
|
135
|
+
* Allows setting different themes for light and dark modes.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* syntaxHighlighter: {
|
|
140
|
+
* lightTheme: themes.github,
|
|
141
|
+
* darkTheme: themes.dracula
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
syntaxHighlighter?: SyntaxHighlighterTheme;
|
|
146
|
+
/**
|
|
147
|
+
* The primary colors used to generate the color scheme.
|
|
148
|
+
* These colors will be used to create variations for different UI states.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* primaryColors: {
|
|
153
|
+
* primary: '#26D6FF',
|
|
154
|
+
* secondary: '#6366F1'
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
primaryColors?: UserProvidedColorScheme;
|
|
159
|
+
/**
|
|
160
|
+
* The class name for the container that holds CSS variables.
|
|
161
|
+
* This class will be added to a wrapper div that provides theming context.
|
|
162
|
+
*
|
|
163
|
+
* @default 'ikp-variables'
|
|
164
|
+
*/
|
|
165
|
+
varsClassName?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Custom styles to be injected into the widget.
|
|
168
|
+
* Supports both inline styles and external stylesheets/resources.
|
|
169
|
+
* Styles are uniquely identified by their key to prevent duplicates.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* styles: [
|
|
174
|
+
* // External stylesheet or font
|
|
175
|
+
* {
|
|
176
|
+
* key: 'google-fonts',
|
|
177
|
+
* type: 'link',
|
|
178
|
+
* value: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap'
|
|
179
|
+
* },
|
|
180
|
+
* // Custom CSS rules
|
|
181
|
+
* {
|
|
182
|
+
* key: 'custom-theme',
|
|
183
|
+
* type: 'style',
|
|
184
|
+
* value: `
|
|
185
|
+
* .ikp-ai-chat-message {
|
|
186
|
+
* border-radius: 8px;
|
|
187
|
+
* padding: 12px;
|
|
188
|
+
* }
|
|
189
|
+
* [data-theme='dark'] .ikp-ai-chat-message {
|
|
190
|
+
* background: #2D3748;
|
|
191
|
+
* }
|
|
192
|
+
* `
|
|
193
|
+
* }
|
|
194
|
+
* ]
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
styles?: Style[];
|
|
198
|
+
}
|
|
199
|
+
export interface SyntaxHighlighterTheme {
|
|
200
|
+
lightTheme?: any;
|
|
201
|
+
darkTheme?: any;
|
|
202
|
+
}
|
|
203
|
+
export interface Style {
|
|
204
|
+
/**
|
|
205
|
+
* A unique identifier for the style.
|
|
206
|
+
* This is used to prevent duplicate styles and allow for style updates.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* key: 'custom-button-styles'
|
|
210
|
+
*/
|
|
211
|
+
key?: string;
|
|
212
|
+
/**
|
|
213
|
+
* The type of style to apply.
|
|
214
|
+
* - 'link': Adds a <link> tag to load external resources like fonts or stylesheets
|
|
215
|
+
* - 'style': Injects CSS directly into a <style> tag
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* type: 'link' // For loading external resources
|
|
219
|
+
* type: 'style' // For inline CSS
|
|
220
|
+
*/
|
|
221
|
+
type: 'link' | 'style';
|
|
222
|
+
/**
|
|
223
|
+
* The content of the style.
|
|
224
|
+
* For type='link', this should be a valid URL to an external resource.
|
|
225
|
+
* For type='style', this should be valid CSS code.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* // For type='link':
|
|
229
|
+
* value: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap'
|
|
230
|
+
*
|
|
231
|
+
* // For type='style':
|
|
232
|
+
* value: `.custom-button {
|
|
233
|
+
* background: blue;
|
|
234
|
+
* color: white;
|
|
235
|
+
* }`
|
|
236
|
+
*/
|
|
237
|
+
value: string;
|
|
238
|
+
}
|
|
239
|
+
export interface ColorModeConfig extends Omit<ColorModeProviderProps, 'children' | 'rootId' | 'shadowHostId'> {
|
|
240
|
+
/**
|
|
241
|
+
* Configuration for syncing the widget's color mode with an external element.
|
|
242
|
+
*
|
|
243
|
+
* This allows the widget to automatically match its color mode (light/dark) with your application's theme.
|
|
244
|
+
* The widget will observe changes to specified attributes on a target element and update its appearance accordingly.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* colorMode: {
|
|
249
|
+
* sync: {
|
|
250
|
+
* // Watch the document root for theme changes
|
|
251
|
+
* target: document.documentElement,
|
|
252
|
+
* // Monitor the data-theme attribute
|
|
253
|
+
* attributes: ['data-theme'],
|
|
254
|
+
* // Determine dark mode based on attribute value
|
|
255
|
+
* isDarkMode: (attrs) => attrs['data-theme'] === 'dark',
|
|
256
|
+
* // Optional callback when color mode changes
|
|
257
|
+
* onChange: (mode) => console.log('Color mode changed to:', mode)
|
|
258
|
+
* }
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
sync?: SyncColorMode;
|
|
263
|
+
}
|
|
264
|
+
export interface SyncColorMode {
|
|
265
|
+
/**
|
|
266
|
+
* The HTML element to watch for color mode changes.
|
|
267
|
+
* This element's attributes will be monitored for changes to determine the color mode.
|
|
268
|
+
*
|
|
269
|
+
* Common use cases include watching the document root or a specific app container.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* // Watch the document root element
|
|
274
|
+
* target: document.documentElement
|
|
275
|
+
*
|
|
276
|
+
* // Watch a specific container element
|
|
277
|
+
* target: document.querySelector('#app')
|
|
278
|
+
*
|
|
279
|
+
* // Watch a specific element by ID
|
|
280
|
+
* target: '#app'
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
target: HTMLElement | null | string;
|
|
284
|
+
/**
|
|
285
|
+
* The specific attributes to monitor for color mode changes.
|
|
286
|
+
* The observer will only trigger when these attributes change on the target element.
|
|
287
|
+
*
|
|
288
|
+
* Common attributes used for theming include:
|
|
289
|
+
* - data-theme: Custom theme attribute
|
|
290
|
+
* - color-scheme: Standard CSS color scheme
|
|
291
|
+
* - class: Class-based theming
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* // Watch data-theme attribute
|
|
296
|
+
* attributes: ['data-theme']
|
|
297
|
+
*
|
|
298
|
+
* // Watch color-scheme attribute
|
|
299
|
+
* attributes: ['color-scheme']
|
|
300
|
+
*
|
|
301
|
+
* // Watch class changes
|
|
302
|
+
* attributes: ['class']
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
attributes: string[];
|
|
306
|
+
/**
|
|
307
|
+
* A function that determines if dark mode is active based on the target element's attributes.
|
|
308
|
+
*
|
|
309
|
+
* The function receives an object containing the current values of all monitored attributes,
|
|
310
|
+
* where the keys are attribute names and values are the attribute values.
|
|
311
|
+
*
|
|
312
|
+
* @param attributes - Object containing the current values of monitored attributes
|
|
313
|
+
* @returns boolean - True if dark mode is detected, false otherwise
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* // Check data-theme attribute
|
|
318
|
+
* isDarkMode: (attributes) => attributes['data-theme'] === 'dark'
|
|
319
|
+
*
|
|
320
|
+
* // Check class for dark mode
|
|
321
|
+
* isDarkMode: (attributes) => /\bdark\b/.test(attributes['class'])
|
|
322
|
+
*
|
|
323
|
+
* // Check color-scheme
|
|
324
|
+
* isDarkMode: (attributes) => attributes['color-scheme'] === 'dark'
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
isDarkMode?: (attributes: Record<string, string | null>) => boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Optional callback function that is invoked whenever the color mode changes.
|
|
330
|
+
*
|
|
331
|
+
* This can be used to perform side effects or sync the color mode with other parts of your application.
|
|
332
|
+
*
|
|
333
|
+
* @param colorMode - The new color mode value ('light' | 'dark')
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* onChange: (colorMode) => {
|
|
338
|
+
* console.log(`Color mode changed to: ${colorMode}`);
|
|
339
|
+
* // Update other UI elements
|
|
340
|
+
* }
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
onChange?: (colorMode: string) => void;
|
|
344
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Message } from '../message';
|
|
2
|
+
export type ComponentsConfig<A extends Record<string, unknown>> = {
|
|
3
|
+
[K in keyof A]: (props: A[K], target: HTMLElement, context: null) => void | React.ReactNode;
|
|
4
|
+
} & {
|
|
5
|
+
IkpMessage?(props: {
|
|
6
|
+
message: Message;
|
|
7
|
+
renderComponent: (name: string, props: Record<string, unknown>) => React.ReactNode;
|
|
8
|
+
renderMarkdown: (text: string) => React.ReactNode;
|
|
9
|
+
}, target: HTMLElement, context: null): void | React.ReactNode;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SearchAndChatFilters {
|
|
2
|
+
attributes?: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
type QueryValue = boolean | number | string;
|
|
7
|
+
type QueryCondition = {
|
|
8
|
+
$eq: QueryValue;
|
|
9
|
+
} | {
|
|
10
|
+
$in: (number | string)[];
|
|
11
|
+
};
|
|
12
|
+
export type FilterQuery = Record<string, QueryCondition | QueryValue | QueryValue[]> | {
|
|
13
|
+
$and: FilterQuery[];
|
|
14
|
+
} | {
|
|
15
|
+
$or: FilterQuery[];
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InkeepAIChatSettings } from './ai';
|
|
2
|
+
import { InkeepBaseSettings } from './base';
|
|
3
|
+
import { InkeepSearchSettings } from './search';
|
|
4
|
+
export interface InkeepConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The prefix to use for the widget.
|
|
7
|
+
* @default 'ikp'
|
|
8
|
+
*/
|
|
9
|
+
prefix?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Identifies how the widget is being used/displayed. Used for analytics tracking
|
|
12
|
+
* and internal behavior configuration.
|
|
13
|
+
*
|
|
14
|
+
* This is automatically set by the widget components and typically
|
|
15
|
+
* should not be manually configured.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
componentType: any;
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for the chat.
|
|
22
|
+
*/
|
|
23
|
+
aiChatSettings: InkeepAIChatSettings & {
|
|
24
|
+
shouldAutoFocusInput?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Configuration for the base settings.
|
|
28
|
+
*/
|
|
29
|
+
baseSettings: InkeepBaseSettings;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration for the search settings.
|
|
32
|
+
*/
|
|
33
|
+
searchSettings: InkeepSearchSettings & {
|
|
34
|
+
shouldAutoFocusInput?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface InkeepModalSettings {
|
|
2
|
+
/**
|
|
3
|
+
* Controls whether the modal is open.
|
|
4
|
+
*/
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Handler called when the modal opens or closes.
|
|
8
|
+
*/
|
|
9
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the modal is open by default.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
defaultOpen?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The shortcut key.
|
|
17
|
+
*
|
|
18
|
+
* The key to trigger the modal when pressed with Cmd (Mac) / Ctrl (Windows).
|
|
19
|
+
*
|
|
20
|
+
* Set to `null` to disable the shortcut.
|
|
21
|
+
*
|
|
22
|
+
* @default 'k'
|
|
23
|
+
*/
|
|
24
|
+
shortcutKey?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* The trigger selector.
|
|
27
|
+
*
|
|
28
|
+
* The selector to trigger the modal when clicked.
|
|
29
|
+
*
|
|
30
|
+
* @default '[data-inkeep-modal-trigger]'
|
|
31
|
+
*/
|
|
32
|
+
triggerSelector?: string;
|
|
33
|
+
}
|